Пример #1
0
    public function output_block($level)
    {
        if (!$this->get('social_twitter_message_id') || $level < -3) {
            return;
        }
        $twitter_data = @json_decode($this->get('data'), true);
        // any previous messages?
        if ($level <= 0) {
            if ($this->get('reply_to_id')) {
                // this tweet is a reply to a previous tweet!
                ?>
				<div class="twitter_previous_messages">
					<?php 
                $reply_message = new ucm_twitter_message($this->twitter_account, $this->get('reply_to_id'));
                $reply_message->output_block($level - 1);
                ?>
				</div>
				<?php 
            } else {
                if ($this->get('type') == _TWITTER_MESSAGE_TYPE_DIRECT) {
                    // find previous message(s)
                    $from = preg_replace('#[^0-9]#', '', $this->get('twitter_from_id'));
                    $to = preg_replace('#[^0-9]#', '', $this->get('twitter_to_id'));
                    if ($from && $to) {
                        $sql = "SELECT * FROM `" . _DB_PREFIX . "social_twitter_message` WHERE `type` = " . _TWITTER_MESSAGE_TYPE_DIRECT . " AND message_time <= " . (int) $this->get('message_time') . " AND social_twitter_message_id != " . (int) $this->social_twitter_message_id . " AND ( (`twitter_from_id` = {$from} AND `twitter_to_id` = {$to}) OR (`twitter_from_id` = {$to} AND `twitter_to_id` = {$from}) ) ORDER BY `message_time` DESC LIMIT 1";
                        $previous = qa1($sql);
                        if ($previous && $previous['social_twitter_message_id']) {
                            ?>
						<div class="twitter_previous_messages twitter_direct">
							<?php 
                            $reply_message = new ucm_twitter_message($this->twitter_account, $previous['social_twitter_message_id']);
                            $reply_message->output_block($level - 1);
                            ?>
						</div>
						<?php 
                        }
                    }
                }
            }
        }
        $message_from = isset($twitter_data['user']) ? $twitter_data['user'] : (isset($twitter_data['sender']) ? $twitter_data['sender'] : false);
        if ($this->get('summary')) {
            if ($message_from && $this->get('type') != _TWITTER_MESSAGE_TYPE_DIRECT) {
                $message_from['tweet_id'] = isset($twitter_data['id_str']) ? $twitter_data['id_str'] : false;
            }
            //echo '<pre>'; print_r($twitter_data); echo '</pre>';
            ?>
			<div class="twitter_comment <?php 
            echo $level != 0 ? ' twitter_comment_clickable' : 'twitter_comment_current';
            ?>
" data-id="<?php 
            echo $this->social_twitter_message_id;
            ?>
" data-link="<?php 
            echo module_social_twitter::link_open_twitter_message($this->get('social_twitter_id'), $this->social_twitter_message_id);
            ?>
" data-title="<?php 
            echo _l('Tweet');
            ?>
">
				<div class="twitter_comment_picture">
					<?php 
            if (isset($twitter_data['user']['id_str'])) {
                $pic = array('screen_name' => isset($twitter_data['user']['screen_name']) ? $twitter_data['user']['screen_name'] : '', 'image' => isset($twitter_data['user']['profile_image_url_https']) ? $twitter_data['user']['profile_image_url_https'] : '');
            } else {
                if (isset($twitter_data['sender']['id_str'])) {
                    $pic = array('screen_name' => isset($twitter_data['sender']['screen_name']) ? $twitter_data['sender']['screen_name'] : '', 'image' => isset($twitter_data['sender']['profile_image_url_https']) ? $twitter_data['sender']['profile_image_url_https'] : '');
                } else {
                    $pic = false;
                }
            }
            if ($pic) {
                ?>
						<img src="<?php 
                echo $pic['image'];
                ?>
">
						<?php 
            }
            ?>
				</div>
				<div class="twitter_comment_header">
					<?php 
            _e('From:');
            echo ' ';
            echo $message_from ? ucm_twitter::format_person($message_from) : 'N/A';
            ?>
					<span><?php 
            $time = strtotime($this->get('message_time'));
            echo $time ? ' @ ' . print_date($time, true) : '';
            if ($this->get('user_id')) {
                echo ' (sent by ' . module_user::link_open($this->get('user_id'), true) . ')';
            }
            ?>
					</span>
				</div>
				<div class="twitter_comment_body">
					<?php 
            if (isset($twitter_data['entities']['media']) && is_array($twitter_data['entities']['media'])) {
                foreach ($twitter_data['entities']['media'] as $media) {
                    if ($media['type'] == 'photo') {
                        ?>
								<div class="twitter_picture">
									<?php 
                        if (isset($media['url']) && $media['url']) {
                            ?>
 <a
										href="<?php 
                            echo htmlspecialchars($media['url']);
                            ?>
"
										target="_blank"> <?php 
                        }
                        ?>
										<img src="<?php 
                        echo htmlspecialchars($media['media_url_https']);
                        ?>
">
										<?php 
                        if (isset($media['url']) && $media['url']) {
                            ?>
 </a> <?php 
                        }
                        ?>
								</div>
							<?php 
                    }
                }
            }
            ?>
					<div>
						<?php 
            echo forum_text($this->get('summary'));
            ?>
					</div>
					<div class="twitter_comment_stats">
						<?php 
            $data = @json_decode($this->get('data'), true);
            //print_r($data);
            if ($data && (isset($data['retweet_count']) && $data['retweet_count'] > 0 || isset($data['favorite_count']) && $data['favorite_count'] > 0)) {
                if (isset($data['retweet_count']) && $data['retweet_count'] > 0) {
                    echo _l('Retweets: %s', $data['retweet_count']);
                }
                echo ' ';
                if (isset($data['favorite_count']) && $data['favorite_count'] > 0) {
                    echo _l('Favorites: %s', $data['favorite_count']);
                }
            }
            ?>
					</div>
				</div>
				<div class="twitter_comment_actions">
					<?php 
            if ($this->can_reply) {
                ?>
						<a href="#" class="twitter_reply_button"><?php 
                _e('Reply');
                ?>
</a>
					<?php 
            }
            ?>
				</div>
			</div>
		<?php 
        }
        ?>
		<?php 
        if ($level == 0) {
            ?>
			<div class="twitter_comment_replies">
			<?php 
            //if(strpos($twitter_data['message'],'picture')){
            //echo '<pre>'; print_r($twitter_data); echo '</pre>';
            //}
            if ($this->can_reply) {
                $this->reply_box($level, $message_from);
            }
            ?>
			</div>
		<?php 
        }
        if ($level >= 0) {
            // any follow up messages?
            if ($this->get('type') == _TWITTER_MESSAGE_TYPE_DIRECT) {
                $from = preg_replace('#[^0-9]#', '', $this->get('twitter_from_id'));
                $to = preg_replace('#[^0-9]#', '', $this->get('twitter_to_id'));
                if ($from && $to) {
                    $sql = "SELECT * FROM `" . _DB_PREFIX . "social_twitter_message` WHERE `type` = " . _TWITTER_MESSAGE_TYPE_DIRECT . " AND message_time >= " . (int) $this->get('message_time') . " AND social_twitter_message_id != " . (int) $this->social_twitter_message_id . " AND ( (`twitter_from_id` = {$from} AND `twitter_to_id` = {$to}) OR (`twitter_from_id` = {$to} AND `twitter_to_id` = {$from}) ) ORDER BY `message_time` ASC LIMIT 1";
                    $next = qa1($sql);
                    if ($next && $next['social_twitter_message_id']) {
                        ?>
						<div class="twitter_next_messages twitter_direct">
							<?php 
                        $reply_message = new ucm_twitter_message($this->twitter_account, $next['social_twitter_message_id']);
                        $reply_message->output_block($level + 1);
                        ?>
						</div>
						<?php 
                    }
                }
            } else {
                $next = get_multiple('social_twitter_message', array('social_twitter_id' => $this->twitter_account->get('social_twitter_id'), 'reply_to_id' => $this->social_twitter_message_id), 'social_twitter_message_id');
                if ($next) {
                    foreach ($next as $n) {
                        // this tweet is a reply to a previous tweet!
                        if ($n['social_twitter_message_id']) {
                            ?>
							<div class="twitter_next_messages">
								<?php 
                            $reply_message = new ucm_twitter_message($this->twitter_account, $n['social_twitter_message_id']);
                            $reply_message->output_block($level + 1);
                            ?>
							</div>
							<?php 
                        }
                    }
                }
            }
        }
    }
            
            	<p>User Token: <?php echo htmlspecialchars($oauth_creds['oauth_token']) ?><br />
            	User Secret: <?php echo htmlspecialchars($oauth_creds['oauth_token_secret']) ?></p>
            	<?php*/
        }
        return false;
    }
    $params = uri_params();
    if (!isset($params['oauth_token'])) {
        // Step 1: Request a temporary token and
        // Step 2: Direct the user to the authorize web page
        request_token($tmhOAuth);
    } else {
        // Step 3: This is the code that runs when Twitter redirects the user to the callback. Exchange the temporary token for a permanent access token
        $oauth_creds = access_token($tmhOAuth);
        if ($oauth_creds && isset($oauth_creds['oauth_token']) && !empty($oauth_creds['oauth_token']) && isset($oauth_creds['oauth_token_secret']) && !empty($oauth_creds['oauth_token_secret'])) {
            // yay we're connected to twitter!
            // write these to the database so we can do stuff on the backend.
            $twitter_account->update('twitter_name', $oauth_creds['screen_name']);
            $twitter_account->update('twitter_id', $oauth_creds['user_id']);
            $twitter_account->update('user_key', $oauth_creds['oauth_token']);
            $twitter_account->update('user_secret', $oauth_creds['oauth_token_secret']);
            $twitter_account->update('last_checked', time());
            set_message('Successfully connected to Twitter');
            redirect_browser(module_social_twitter::link_open($social_twitter_id));
        } else {
            echo 'Failed to connect to twitter';
            echo $tmhOAuth->response['response'];
        }
    }
}
Пример #3
0
	    <?php 
        }
    }
}
if ($social_twitter_id && !$social_twitter_message_id && module_social::can_i('create', 'Twitter Comments', 'Social', 'social')) {
    $twitter = new ucm_twitter_account($social_twitter_id);
    if ($social_twitter_id && $twitter->get('social_twitter_id') == $social_twitter_id) {
        $module->page_title = $twitter->get('twitter_name');
        /* @var $pages ucm_twitter_page[] */
        $pages = $twitter->get('pages');
        //print_r($pages);
        ?>

	    <form action="<?php 
        echo module_social_twitter::link_open_message_view($social_twitter_id);
        ?>
" method="post" enctype="multipart/form-data">
		    <input type="hidden" name="_process" value="send_twitter_message">
		    <?php 
        module_form::print_form_auth();
        ?>
		    <?php 
        $fieldset_data = array('heading' => isset($_REQUEST['display_mode']) && $_REQUEST['display_mode'] == 'ajax' ? false : array('type' => 'h3', 'title' => 'Compose Tweet'), 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array('twitter_account' => array('title' => _l('Twitter Account'), 'fields' => array()), 'message' => array('title' => _l('Message'), 'field' => array('type' => 'textarea', 'name' => 'message', 'id' => 'twitter_compose_message', 'value' => '')), 'type' => array('title' => _l('Type'), 'fields' => array('<input type="radio" name="post_type" id="post_type_wall" value="wall" checked> ', '<label for="post_type_wall">', _l('Normal Tweet'), '</label>', '<input type="radio" name="post_type" id="post_type_picture" value="picture"> ', '<label for="post_type_picture">', _l('Picture Tweet'), '</label>')), 'picture' => array('title' => _l('Picture'), 'fields' => array('<input type="file" name="picture" value=""> (ensure picture is smaller than 1200x1200)', '<span class="twitter-type-picture twitter-type-option"></span>')), 'debug' => array('title' => _l('Debug'), 'field' => array('type' => 'check', 'name' => 'debug', 'value' => '1', 'checked' => false, 'help' => 'Show debug output while posting the message'))));
        //foreach($accounts as $twitter_account_id => $account){
        // do we have a picture?
        $fieldset_data['elements']['twitter_account']['fields'][] = '<div id="twitter_compose_account_select">' . '<input type="checkbox" name="compose_account_id[' . $twitter->get('social_twitter_id') . ']" value="1" checked> ' . ($twitter->get_picture() ? '<img src="' . $twitter->get_picture() . '">' : '') . htmlspecialchars($twitter->get('twitter_name')) . '</div>';
        //}
        echo module_form::generate_fieldset($fieldset_data);
        $form_actions = array('class' => 'action_bar action_bar_center', 'elements' => array());
        echo module_form::generate_form_actions($form_actions);
Пример #4
0
        });
        $table_manager->set_columns($columns);
        $table_manager->row_callback = function ($message) use(&$twitter, &$table_manager) {
            $twitter_message = new ucm_twitter_message($twitter, $message['social_twitter_message_id']);
            $table_manager->row_class = 'twitter_message_row' . (!isset($message['read_time']) || !$message['read_time'] ? ' message_row_unread' : '');
            $table_manager->row_attributes = array('data-id' => (int) $message['social_twitter_message_id'], 'data-social_twitter_id' => (int) $message['social_twitter_id']);
            return array('twitter_message' => $twitter_message);
        };
        $table_manager->set_rows($all_messages);
        $table_manager->pagination = true;
        $table_manager->print_table();
        ?>
	    </form>
	    <script type="text/javascript">
		    $(function () {
			    ucm.social.init();
			    ucm.social.twitter.api_url = '<?php 
        echo module_social_twitter::link_social_ajax_functions();
        ?>
';
			    ucm.social.twitter.init();
		    });
	    </script>

		<div id="social_modal_popup" title="">
		    <div class="modal_inner" style="height:100%;"></div>
		</div>

    <?php 
    }
}
Пример #5
0
<?php

/** 
 * Copyright: dtbaker 2012
 * Licence: Please check CodeCanyon.net for licence details. 
 * More licence clarification available here:  http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ 
 * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
 * Package Date: 2015-11-25 02:55:20 
 * IP Address: 67.79.165.254
 */
if (isset($_REQUEST['social_twitter_id']) && !empty($_REQUEST['social_twitter_id'])) {
    $social_twitter_id = (int) $_REQUEST['social_twitter_id'];
    $social_twitter = module_social_twitter::get($social_twitter_id);
    include 'twitter_account_edit.php';
} else {
    if (_DEMO_MODE) {
        ?>
		<p>Demo Mode Notice: <strong>This is a public demo. Please only use TEST accounts here as others will see them.</strong></p>
		<?php 
    }
    print_heading('Twitter Settings');
    ?>
	<p>Please go to <a href="https://apps.twitter.com/" target="_blank">https://apps.twitter.com/</a> and create an app. Enter your API Keys below: <?php 
    _h('Signin with Twitter at https://apps.twitter.com/ and click the Create New App button. Enter a Name, Description, Website and in the Callback URL just put your website address. Once created, go to Permissions and choose "Read, write, and direct messages" then go to API Keys and copy your API Key and API Secret from here into the below form.');
    ?>
</p>
	<?php 
    module_config::print_settings_form(array(array('key' => 'social_twitter_api_key', 'default' => '', 'type' => 'text', 'description' => 'App API Key ', 'help' => 'The API key obtained from creating your app on dev.twitter.com '), array('key' => 'social_twitter_api_secret', 'default' => '', 'type' => 'text', 'description' => 'App API Secret ', 'help' => 'The API secret obtained from creating your app on dev.twitter.com ')));
    // show twitter app settings here.
    include 'twitter_account_list.php';
Пример #6
0
    public function process()
    {
        if ("save_twitter" == $_REQUEST['_process']) {
            $social_twitter_id = isset($_REQUEST['social_twitter_id']) ? (int) $_REQUEST['social_twitter_id'] : 0;
            $twitter = new ucm_twitter_account($social_twitter_id);
            if (isset($_POST['butt_del']) && module_social::can_i('delete', 'Twitter', 'Social', 'social')) {
                if (module_form::confirm_delete('social_twitter_id', "Really delete this Twitter account from the system? All messages will be lost.", self::link_open($_REQUEST['social_twitter_id']))) {
                    $twitter->delete();
                    set_message("Twitter account deleted successfully");
                    redirect_browser(self::link_open(false));
                }
            }
            $twitter->save_data($_POST);
            $social_twitter_id = $twitter->get('social_twitter_id');
            if (isset($_POST['butt_save_connect'])) {
                $redirect = $this->link_open($social_twitter_id, false, false, 'twitter_account_connect');
            } else {
                set_message('Twitter account saved successfully');
                $redirect = $this->link_open($social_twitter_id);
            }
            redirect_browser($redirect);
            exit;
        } else {
            if ("send_twitter_message" == $_REQUEST['_process']) {
                if (module_form::check_secure_key()) {
                    // queue the message into the twitter_message table
                    // if there's a scheduled date in the past we send it in the past, no date we send straight away, date in the future we leave it in the db table for the cron job to pick up.
                    //print_r($_POST);exit;
                    $send_time = false;
                    // default: now
                    if (isset($_POST['schedule_date']) && isset($_POST['schedule_time']) && !empty($_POST['schedule_date']) && !empty($_POST['schedule_time'])) {
                        $date = $_POST['schedule_date'];
                        $time_hack = $_POST['schedule_time'];
                        $time_hack = str_ireplace('am', '', $time_hack);
                        $time_hack = str_ireplace('pm', '', $time_hack);
                        $bits = explode(':', $time_hack);
                        if (strpos($_POST['schedule_time'], 'pm')) {
                            $bits[0] += 12;
                        }
                        // add the time if it exists
                        $date .= ' ' . implode(':', $bits) . ':00';
                        $send_time = strtotime(input_date($date, true));
                    } else {
                        if (isset($_POST['schedule_date']) && !empty($_POST['schedule_date'])) {
                            $send_time = strtotime(input_date($_POST['schedule_date'], true));
                        }
                    }
                    //echo print_date($send_time,true);
                    //echo '<br>';
                    //echo date('c',$send_time);
                    //exit;
                    $send_accounts = isset($_POST['compose_account_id']) && is_array($_POST['compose_account_id']) ? $_POST['compose_account_id'] : array();
                    $page_count = 0;
                    $last_twitter_account_id = false;
                    if ($send_accounts) {
                        foreach ($send_accounts as $twitter_account_id => $tf) {
                            if (!$tf) {
                                continue;
                            }
                            // see if this is an available account.
                            $twitter_account = new ucm_twitter_account($twitter_account_id);
                            //todo: check permissiont o access thi saccount
                            if ($twitter_account->get('social_twitter_id') == $twitter_account_id) {
                                // push to db! then send.
                                $last_twitter_account_id = $twitter_account_id;
                                $twitter_message = new ucm_twitter_message($twitter_account, false);
                                $twitter_message->create_new();
                                $twitter_message->update('social_twitter_id', $twitter_account->get('social_twitter_id'));
                                $twitter_message->update('summary', isset($_POST['message']) ? $_POST['message'] : '');
                                $twitter_message->update('type', 'pending');
                                $twitter_message->update('data', json_encode($_POST));
                                $twitter_message->update('user_id', module_security::get_loggedin_id());
                                // do we send this one now? or schedule it later.
                                $twitter_message->update('status', _SOCIAL_MESSAGE_STATUS_PENDINGSEND);
                                if ($send_time) {
                                    // schedule for sending at a different time (now or in the past)
                                    $twitter_message->update('message_time', $send_time);
                                } else {
                                    // send it now.
                                    $twitter_message->update('message_time', 0);
                                }
                                if (isset($_FILES['picture']['tmp_name']) && is_uploaded_file($_FILES['picture']['tmp_name'])) {
                                    $twitter_message->add_attachment($_FILES['picture']['tmp_name']);
                                }
                                $twitter_message->send_queued(isset($_POST['debug']) && $_POST['debug']);
                                $page_count++;
                            } else {
                                // log error?
                            }
                        }
                    }
                    set_message(_l('Message delivered successfully to %s Twitter accounts', $page_count));
                    $redirect = $this->link_open_message_view($last_twitter_account_id);
                    redirect_browser($redirect);
                }
                exit;
            } else {
                if ("ajax_social_twitter" == $_REQUEST['_process']) {
                    // ajax functions from wdsocial. copied from the datafeed.php sample files.
                    header('Content-type: text/javascript');
                    if (module_form::check_secure_key()) {
                        $social_twitter_id = isset($_REQUEST['social_twitter_id']) ? (int) $_REQUEST['social_twitter_id'] : 0;
                        $twitter = new ucm_twitter_account($social_twitter_id);
                        if ($social_twitter_id && $twitter->get('social_twitter_id') == $social_twitter_id) {
                            $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : false;
                            $message_id = isset($_REQUEST['social_twitter_message_id']) ? (int) $_REQUEST['social_twitter_message_id'] : 0;
                            $twitter_message = new ucm_twitter_message();
                            $twitter_message->load($message_id);
                            if ($twitter_message->get('social_twitter_id') == $social_twitter_id && $twitter_message->get('social_twitter_message_id') == $message_id) {
                                switch ($action) {
                                    case "send-message-reply":
                                        if (module_social::can_i('create', 'Twitter Comments', 'Social', 'social')) {
                                            $return = array();
                                            $message = isset($_POST['message']) && $_POST['message'] ? $_POST['message'] : '';
                                            $debug = isset($_POST['debug']) && $_POST['debug'] ? $_POST['debug'] : false;
                                            if ($message) {
                                                ob_start();
                                                //$twitter_message->send_reply( $message, $debug );
                                                $new_twitter_message = new ucm_twitter_message($twitter, false);
                                                $new_twitter_message->create_new();
                                                $new_twitter_message->update('reply_to_id', $twitter_message->get('social_twitter_message_id'));
                                                $new_twitter_message->update('social_twitter_id', $twitter->get('social_twitter_id'));
                                                $new_twitter_message->update('summary', $message);
                                                //$new_twitter_message->update('type','pending');
                                                $new_twitter_message->update('data', json_encode($_POST));
                                                $new_twitter_message->update('user_id', module_security::get_loggedin_id());
                                                // do we send this one now? or schedule it later.
                                                $new_twitter_message->update('status', _SOCIAL_MESSAGE_STATUS_PENDINGSEND);
                                                if (isset($_FILES['picture']['tmp_name']) && is_uploaded_file($_FILES['picture']['tmp_name'])) {
                                                    $new_twitter_message->add_attachment($_FILES['picture']['tmp_name']);
                                                }
                                                $worked = $new_twitter_message->send_queued(isset($_POST['debug']) && $_POST['debug']);
                                                $return['message'] = ob_get_clean();
                                                if ($debug) {
                                                    // just return message
                                                } else {
                                                    if ($worked) {
                                                        // success, redicet!
                                                        set_message(_l('Message sent and conversation archived.'));
                                                        $return['redirect'] = module_social_twitter::link_open_message_view($social_twitter_id);
                                                    } else {
                                                        // failed, no debug, force debug and show error.
                                                    }
                                                }
                                            }
                                            echo json_encode($return);
                                        }
                                        break;
                                    case "set-answered":
                                        if (module_social::can_i('edit', 'Twitter Comments', 'Social', 'social')) {
                                            $twitter_message->update('status', _SOCIAL_MESSAGE_STATUS_ANSWERED);
                                            ?>

									$('.twitter_message_row[data-id=<?php 
                                            echo $message_id;
                                            ?>
]').hide();
									<?php 
                                            // if this is a direct message, we also archive all other messages in it.
                                            if ($twitter_message->get('type') == _TWITTER_MESSAGE_TYPE_DIRECT) {
                                                $from = preg_replace('#[^0-9]#', '', $twitter_message->get('twitter_from_id'));
                                                $to = preg_replace('#[^0-9]#', '', $twitter_message->get('twitter_to_id'));
                                                if ($from && $to) {
                                                    $sql = "SELECT * FROM `" . _DB_PREFIX . "social_twitter_message` WHERE `type` = " . _TWITTER_MESSAGE_TYPE_DIRECT . " AND `status` = " . (int) _SOCIAL_MESSAGE_STATUS_UNANSWERED . " AND social_twitter_id = " . (int) $twitter_message->get('twitter_account')->get('social_twitter_id') . " AND ( (`twitter_from_id` = '{$from}' AND `twitter_to_id` = '{$to}') OR (`twitter_from_id` = '{$to}' AND `twitter_to_id` = '{$from}') ) ";
                                                    $others = qa($sql);
                                                    if (count($others)) {
                                                        foreach ($others as $other_message) {
                                                            $ucm_twitter_message = new ucm_twitter_message(false, $other_message['social_twitter_message_id']);
                                                            if ($ucm_twitter_message->get('social_twitter_message_id') == $other_message['social_twitter_message_id']) {
                                                                $ucm_twitter_message->update('status', _SOCIAL_MESSAGE_STATUS_ANSWERED);
                                                                ?>

														$('.twitter_message_row[data-id=<?php 
                                                                echo $ucm_twitter_message->get('social_twitter_message_id');
                                                                ?>
]').hide();
													<?php 
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    case "set-unanswered":
                                        if (module_social::can_i('edit', 'Twitter Comments', 'Social', 'social')) {
                                            $twitter_message->update('status', _SOCIAL_MESSAGE_STATUS_UNANSWERED);
                                            ?>

					                $('.twitter_message_row[data-id=<?php 
                                            echo $message_id;
                                            ?>
]').hide();
					                <?php 
                                        }
                                        break;
                                }
                                //echo 'The status is '.$twitter_message->get('status');
                            }
                        }
                    }
                    exit;
                }
            }
        }
    }
Пример #7
0
$heading = array('type' => 'h3', 'title' => 'Twitter Account');
?>

<form action="" method="post">
	<input type="hidden" name="_process" value="save_twitter">
	<input type="hidden" name="social_twitter_id" value="<?php 
echo $twitter->get('social_twitter_id');
?>
">

	<?php 
module_form::print_form_auth();
$fieldset_data = array('heading' => $heading, 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array(array('title' => _l('Account Name'), 'field' => array('type' => 'text', 'name' => 'account_name', 'value' => $twitter->get('account_name'), 'help' => 'Choose a name for this account. This name will be shown here in the system.'))));
// check if this is active, if not prmopt the user to re-connect.
if ($twitter->is_active()) {
    $fieldset_data['elements'][] = array('title' => _l('Last Checked'), 'fields' => array(print_date($twitter->get('last_checked'), true), '(<a href="' . module_social_twitter::link_open_twitter_account_refresh($social_twitter_id) . '" target="_blank">' . _l('Refresh') . '</a>)'));
    $fieldset_data['elements'][] = array('title' => _l('Twitter Name'), 'fields' => array(htmlspecialchars($twitter->get('twitter_name'))));
    $fieldset_data['elements'][] = array('title' => _l('Twitter ID'), 'fields' => array(htmlspecialchars($twitter->get('twitter_id'))));
    $fieldset_data['elements'][] = array('title' => _l('Import DM\'s'), 'fields' => array(array('type' => 'checkbox', 'value' => $twitter->get('import_dm'), 'name' => 'import_dm', 'help' => 'Enable this to import Direct Messages from this twitter account')));
    $fieldset_data['elements'][] = array('title' => _l('Import Mentions'), 'fields' => array(array('type' => 'checkbox', 'value' => $twitter->get('import_mentions'), 'name' => 'import_mentions', 'help' => 'Enable this to import any tweets that mention your name')));
    $fieldset_data['elements'][] = array('title' => _l('Import Tweets'), 'fields' => array(array('type' => 'checkbox', 'name' => 'import_tweets', 'value' => $twitter->get('import_tweets'), 'help' => 'Enable this to import any tweets that originated from this account')));
} else {
}
echo module_form::generate_fieldset($fieldset_data);
$form_actions = array('class' => 'action_bar action_bar_center', 'elements' => array());
echo module_form::generate_form_actions($form_actions);
if (!$twitter->is_active()) {
    // show a 'save' and button as normal
    $form_actions['elements'][] = array('type' => 'save_button', 'name' => 'butt_save_connect', 'value' => _l('Save & Connect to Twitter'));
} else {
    $form_actions['elements'][] = array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save'));
Пример #8
0
?>
</th>-->
    </tr>
    </thead>
    <tbody>
    <?php 
$c = 0;
foreach ($twitter_accounts as $twitter_account) {
    ?>
        <tr class="<?php 
    echo $c++ % 2 ? "odd" : "even";
    ?>
">
            <td class="row_action">
                <?php 
    echo module_social_twitter::link_open($twitter_account['social_twitter_id'], true, $twitter_account);
    ?>
            </td>
            <td>
                <?php 
    echo print_date($twitter_account['last_checked'], true);
    ?>
            </td>
            <!--<td>
                <?php 
    /*
     */
    ?>
            </td>-->
        </tr>
    <?php 
Пример #9
0
        ?>
">
				<td class="row_action">
					<img src="<?php 
        echo _BASE_HREF;
        ?>
includes/plugin_social_twitter/images/twitter-logo.png"
					     class="twitter_icon">
					<?php 
        echo htmlspecialchars($twitter_account->get('account_name'));
        ?>
					<br/>
				</td>
				<td>
					<a href="<?php 
        echo module_social_twitter::link_open_twitter_message($account['social_twitter_id'], false);
        ?>
" class="socialtwitter_message_open social_modal btn btn-success btn-sm" data-modal-title="<?php 
        echo _l('Compose Tweet');
        ?>
"><?php 
        _e('Compose Tweet');
        ?>
</a>
				</td>
			</tr>
		<?php 
    }
}
?>
  </tbody>