Beispiel #1
0
 public function retrieve()
 {
     global $wpdb, $_wt_options;
     $id = $this->id;
     $data = null;
     if ($id) {
         $data = $wpdb->get_results($wpdb->prepare("SELECT \n\t\t\t\t*  \n\t\t\t\tFROM " . WORDTOUR_EVENTS . " AS e \n\t\t\t\tLEFT JOIN " . WORDTOUR_VENUES . " AS v \n\t\t\t\tON e.event_venue_id = v.venue_id \n\t\t\t\tLEFT JOIN " . WORDTOUR_ARTISTS . " AS a\n\t\t\t\tON e.event_artist_id = a.artist_id \n\t\t\t\tLEFT JOIN " . WORDTOUR_TOUR . " AS t\n\t\t\t\tON e.event_tour_id = t.tour_id \n\t\t\t\tLEFT JOIN " . WORDTOUR_EVENTS_META . " AS m ON e.event_meta_id = m.meta_id\n\t\t\t\tWHERE e.event_id = {$id} ORDER BY id ASC"), "ARRAY_A");
         if (is_array($data)) {
             $event = $data[0];
             $event["event_more_artists"] = array();
             foreach ($data as $e) {
                 if (!$e["event_is_headline"]) {
                     $event["event_more_artists"][] = array("id" => $e["artist_id"], "name" => $e["artist_name"]);
                 }
             }
             $event_wpdb = clone $wpdb;
             $this->meta_id = $event["event_meta_id"];
             $social = new WT_Social();
             $fbstatus = $social->get_by_event($this->id, "fbstatus");
             $ebstatus = $social->get_by_event($this->id, "ebevent");
             $fbevent = $social->get_by_event($this->id, "fbevent");
             $twitter = $social->get_by_event($this->id, "twitter");
             $post = $social->get_by_event($this->id, "post");
             $data = array_merge($data, array("post_ref_id" => $post ? admin_url("post.php?action=edit&post={$post['social_ref_id']}") : 0, "facebook_event_id" => $fbevent ? $fbevent["social_ref_id"] : 0, "twitter_status_date" => $twitter ? $twitter["social_publish_time"] : 0, "facebook_status_date" => $fbstatus ? $fbstatus["social_publish_time"] : 0, "eventbrite_status_date" => $ebstatus ? $ebstatus["social_publish_time"] : 0, "eventbrite_event_id" => $ebstatus ? $ebstatus["social_ref_id"] : 0));
             $event["event_thumbnail"] = get_attachment_data($this->get_thumbnail("event"));
             $event["event_videos"] = $this->get_videos("event");
             $event["event_gallery"] = $this->get_gallery("event");
             $event["event_category"] = $this->get_category("event");
             $event["event_genre"] = $this->get_genre("event");
         }
     }
     //$this->db_result("error",$event_wpdb,array("msg"=>"Can't retrieve event(<i>Missing event id</i>)"));
     return parent::retrieve($event);
 }
Beispiel #2
0
 public function retrieve()
 {
     global $wpdb, $_wt_options;
     $tour_id = $this->id;
     $tour = null;
     if ($tour_id) {
         $tour = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . WORDTOUR_TOUR . " WHERE tour_id={$tour_id}"), "ARRAY_A");
         if ($tour) {
             $tour = array_merge($tour, array("is_default" => $_wt_options->options("default_tour") == $tour_id ? 1 : 0, "tour_thumbnail" => get_attachment_data($this->get_thumbnail("tour")), "tour_videos" => $this->get_videos("tour"), "tour_gallery" => $this->get_gallery("tour"), "tour_category" => $this->get_category("tour"), "tour_genre" => $this->get_genre("tour")));
         }
     }
     return parent::retrieve($tour);
 }
Beispiel #3
0
 public function retrieve()
 {
     global $wpdb, $_wt_options;
     $track_id = $this->id;
     $track = null;
     if ($track_id) {
         $track = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . WORDTOUR_TRACKS . " AS t LEFT JOIN " . WORDTOUR_ARTISTS . " AS a ON t.track_artist_id = a.artist_id WHERE t.track_id={$track_id}"), "ARRAY_A");
         if ($track) {
             $track["track_thumbnail"] = get_attachment_data($this->get_thumbnail("track"));
             $track["track_genre"] = $this->get_genre("track");
         }
     }
     return parent::retrieve($track);
 }
Beispiel #4
0
 public function retrieve()
 {
     global $wpdb, $_wt_options;
     $album_id = $this->id;
     $album = null;
     if ($album_id) {
         $album = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . WORDTOUR_ALBUMS . " AS t LEFT JOIN " . WORDTOUR_ARTISTS . " AS a ON t.album_artist_id = a.artist_id WHERE t.album_id={$album_id}"), "ARRAY_A");
         if ($album) {
             $album["album_thumbnail"] = get_attachment_data($this->get_thumbnail("album"));
             $album["album_tracks"] = $this->get_tracks();
             $album["album_genre"] = $this->get_genre("album");
         }
     }
     return parent::retrieve($album);
 }
Beispiel #5
0
 public function retrieve()
 {
     global $wpdb, $_wt_options;
     $id = $this->id;
     $data = null;
     if ($id) {
         $data = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . WORDTOUR_VENUES . " WHERE venue_id={$id}"), "ARRAY_A");
         if ($data) {
             $data["is_default"] = $_wt_options->options("default_venue") == $id ? 1 : 0;
             $data["venue_thumbnail"] = get_attachment_data($this->get_thumbnail("venue"));
             $data["venue_videos"] = $this->get_videos("venue");
             $data["venue_gallery"] = $this->get_gallery("venue");
             $data["venue_category"] = $this->get_category("venue");
         }
     }
     return parent::retrieve($data);
 }
 public function retrieve()
 {
     global $wpdb, $_wt_options;
     $artist_id = $this->id;
     $artist = null;
     if ($artist_id) {
         $artist = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . WORDTOUR_ARTISTS . " WHERE artist_id={$artist_id}"), "ARRAY_A");
         if ($artist) {
             $artist["is_default"] = $_wt_options->options("default_artist") == $artist_id ? 1 : 0;
             $artist["artist_thumbnail"] = get_attachment_data($this->get_thumbnail("artist"));
             $artist["artist_videos"] = $this->get_videos("artist");
             $artist["artist_gallery"] = $this->get_gallery("artist");
             $artist["artist_category"] = $this->get_category("artist");
             $artist["artist_genre"] = $this->get_genre("artist");
         }
     }
     return parent::retrieve($artist);
 }
Beispiel #7
0
$order_dir = $sort_dir == 'a' ? 'ASC' : 'DESC';
$sort_by_text = array('t' => $user->lang['POST_TIME']);
$sort_by_sql = array('t' => 'blog_time');
$total_replies = $blog_data->get_reply_data('reply_count', $blog_id, array('sort_days' => $sort_days));
// Get the reply data if we need to
if ($total_replies > 0) {
    $reply_ids = $blog_data->get_reply_data('blog', $blog_id, array('start' => $start, 'limit' => $limit, 'order_dir' => $order_dir, 'sort_days' => $sort_days));
    $blog_data->get_user_data(false, true);
    update_edit_delete('reply');
} else {
    $reply_ids = false;
}
// Get the Poll Data
$blog_data->get_polls($blog_id);
// Get the Attachment Data
get_attachment_data($blog_id, $reply_ids);
blog_plugins::plugin_do('view_blog_start');
// Output some data
$template->assign_vars(array('META' => '<link rel="canonical" href="' . blog_url($user_id, $blog_id, false, $start > 0 ? array('start' => $start) : array()) . '" />', 'BLOG_CSS' => isset($user_settings[$user_id]['blog_css']) ? $user_settings[$user_id]['blog_css'] : '', 'U_PRINT_TOPIC' => !$user->data['is_bot'] ? $blog_urls['self_print'] : '', 'U_VIEW' => $blog_urls['self'], 'S_CATEGORY_MODE' => $category_id ? true : false, 'S_SINGLE' => true, 'U_QUICK_REPLY' => blog_url($user_id, $blog_id, false, array('page' => 'reply', 'mode' => 'add')), 'S_QUICK_REPLY' => $user->data['is_registered'] && $config['user_blog_quick_reply'] ? true : false));
// Quick Reply
add_form_key('postform');
// Parse the blog data and output it to the template
$template->assign_block_vars('blogrow', array_merge($blog_data->handle_blog_data($blog_id), $blog_data->handle_user_data($user_id)));
blog_plugins::plugin_do('view_blog_after_blogrow');
// to update the read count, we are only doing this if the user is not the owner, and the user doesn't view the shortened version, and we are not viewing the deleted blogs page
if ($user->data['user_id'] != $user_id) {
    $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_read_count = blog_read_count + 1 WHERE blog_id = ' . intval($blog_id);
    $db->sql_query($sql);
}
if ($total_replies > 0 || $sort_days != 0) {
    // for sorting and pagination
 public function media_out($media_id = 0)
 {
     $imgTag = "";
     $url = "";
     $height = 0;
     $width = 0;
     if ($media_id > 0) {
         $media = get_attachment_data($media_id);
         $imgTag = "<img src='" . $media["url"] . "' width='" . $media["width"] . "' height='" . $media["height"] . "'/>";
         $url = $media["url"];
         $height = $media["width"];
         $width = $media["height"];
     }
     return array("imgTag" => $imgTag, "url" => $url, "width" => $width, "height" => $height);
 }
 public function get_attachments($size = array())
 {
     $attachments = array();
     if ($this->data) {
         if (!empty($this->data["gallery_attachment"])) {
             foreach (unserialize($this->data["gallery_attachment"]) as $attachment) {
                 if (!count($size)) {
                     $attachments[] = get_attachment_data($attachment, $size);
                 } else {
                     $a = array();
                     foreach ($size as $s) {
                         $a[$s] = get_attachment_data($attachment, $s);
                     }
                     $attachments[] = $a;
                 }
             }
         }
     }
     return $attachments;
 }
Beispiel #10
0
 if ($mode == 'deleted') {
     page_header(sprintf($user->lang['USERNAMES_DELETED_BLOGS'], blog_data::$user[$user_id]['username']));
 } else {
     if ($user->data['username'] == blog_data::$user[$user_id]['username']) {
         page_header($user->lang['MY_BLOG']);
     } else {
         page_header(sprintf($user->lang['USERNAMES_BLOGS'], blog_data::$user[$user_id]['username']));
     }
 }
 // Output some data
 $template->assign_vars(array('META' => '<link rel="canonical" href="' . blog_url($user_id, false, false, $start > 0 ? array('start' => $start) : array()) . '" />', 'PAGINATION' => $pagination, 'PAGE_NUMBER' => on_page($total_blogs, $limit, $start), 'TOTAL_POSTS' => $total_blogs == 1 ? $user->lang['ONE_BLOG'] : sprintf($user->lang['CNT_BLOGS'], $total_blogs), 'U_BLOG_FEED' => $config['user_blog_enable_feeds'] ? blog_url($user_id, false, false, array('feed' => 'explain')) : '', 'U_PRINT_TOPIC' => !$user->data['is_bot'] ? $blog_urls['self_print'] : '', 'U_VIEW' => $blog_urls['self'], 'S_SORT' => true, 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_VIEW_REPLY_COUNT' => true, 'L_NO_DELETED_BLOGS' => $sort_days == 0 ? $user->lang['NO_DELETED_BLOGS'] : sprintf($user->lang['NO_DELETED_BLOGS_SORT_DAYS'], $limit_days[$sort_days]), 'L_NO_BLOGS_USER' => $sort_days == 0 ? $user->lang['NO_BLOGS_USER'] : sprintf($user->lang['NO_BLOGS_USER_SORT_DAYS'], $limit_days[$sort_days]), 'BLOG_CSS' => isset($user_settings[$user_id]['blog_css']) ? $user_settings[$user_id]['blog_css'] : ''));
 unset($pagination);
 // parse and output the blogs
 if ($blog_ids !== false) {
     // Get the Attachment Data
     get_attachment_data($blog_ids, false);
     // read blogs, for updating the read count
     $read_blogs = array();
     foreach ($blog_ids as $id) {
         $blogrow = array_merge($blog_data->handle_user_data(blog_data::$blog[$id]['user_id']), $blog_data->handle_blog_data($id, $config['user_blog_user_text_limit']));
         $template->assign_block_vars('blogrow', $blogrow);
         if (!$blogrow['S_SHORTENED']) {
             // for updating the read count later
             array_push($read_blogs, $id);
         }
     }
     // to update the read count, we are only doing this if the user is not the owner, and the user doesn't view the shortened version, and we are not viewing the deleted blogs page
     if ($user->data['user_id'] != $user_id && $mode != 'deleted' && sizeof($read_blogs)) {
         $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_read_count = blog_read_count + 1 WHERE ' . $db->sql_in_set('blog_id', $read_blogs);
         $db->sql_query($sql);
     }
Beispiel #11
0
             echo json_encode(array("error" => 1, "msg" => "Path '<i>{$full_path}</i>' doesnt exist"));
         }
     }
     break;
 case "map":
     echo json_encode(wt_get_map_str($_POST));
     break;
     // GENERAL
 // GENERAL
 case "get-key":
     echo json_encode(ajax_get_key());
     break;
     // THUMBNAIL
 // THUMBNAIL
 case "get-thumbnail":
     echo json_encode(get_attachment_data($_POST["attachment_id"]));
     break;
     // TWITTER
 // TWITTER
 case "update_twitter":
     $social = new Wt_Social();
     $social->insert($_POST["_nonce"], $_POST["type"], $_POST["event_id"], $_POST["ref_id"]);
     $social->db_response("json");
     break;
 case "update-facebook":
     $social = new Wt_Social();
     $social->insert($_POST["_nonce"], $_POST["type"], $_POST["event_id"], $_POST["ref_id"]);
     $social->db_response("json");
     break;
     // POST
 // POST