$bad_flag = false; foreach ($_REQUEST['follow_ids'] as $this_id) { $connection->post('friendships/create', array('user_id' => $this_id)); if ($connection->http_code == 200) { $good_flag = true; } else { $bad_flag = true; } } //Show appropriate error message if ($good_flag and !$bad_flag) { $response_msg = mainFuncs::push_response(26); } elseif ($good_flag and $bad_flag) { $response_msg = mainFuncs::push_response(27); } elseif (!$good_flag and $bad_flag) { $response_msg = mainFuncs::push_response(28); } } break; //End of tab switch } //End of data update POST } //Get account details if (!$q1a) { $q1a = $db->get_user_data($_REQUEST['twitter_id']); } include '../content/' . TWANDO_LANG . '/ajax.follow_settings_inc.php'; //End of is logged in } include '../include_bottom.php';
//Set return page if (strip_tags($_POST['return_url'] != "")) { $return_url = strip_tags($_POST['return_url']); } else { $return_url = ""; } $response_msg = ""; if (isset($_POST['a'])) { //Set login if ($_POST['a'] == 'login2') { //Set $_POST['username_login'] = strip_tags(trim($_POST['username_login'])); $_POST['password_login'] = strip_tags(trim($_POST['password_login'])); //Check Credentials if ($_POST['username_login'] != LOGIN_USER or $_POST['password_login'] != LOGIN_PASSWORD) { $error_array['message'] = mainFuncs::push_response(5); } else { //Set cookies $_SESSION['twando_username'] = $_POST['username_login']; //Redirect header("Location: " . BASE_LINK_URL . $return_url); //End of do login sequence } } } //Check if logged in if (mainFuncs::is_logged_in() != true) { $page_select = "not_logged_in"; } else { $page_select = "index"; }
</form> <input type="submit" value="Schedule Tweet" class="submit_button_style" onclick="ajax_tweet_settings_update('tab3','scheduletweet_form');" /> <br /><br /> *Tweets are posted based on your servers PHP time, which might not be your local time. The current PHP date and time is <?php echo date(TIMESTAMP_FORMAT); ?> . <br /> <?php break; case 'tab4': ?> <h2>Bulk CSV Tweet Upload</h2> <?php if ($_REQUEST['pass_msg']) { $response_msg = mainFuncs::push_response($_REQUEST['pass_msg']) . '<br />'; ?> <script type="text/javascript">$("#pass_msg").val('')</script> <?php } ?> <?php echo $response_msg; ?> <form method="post" action="tweet_settings.php?id=<?php echo $q1a['id']; ?> " name="bulkcsvupload" id="bulkcsvupload" enctype="multipart/form-data"> You can upload a CSV of as many tweets as you like below. The CSV should have 2 columns (no headers are required). Column one should have the post date and time in mySQL format (YYYY-MM-DD HH:MM). Column two should contain what you want to tweet (<a href="inc/csv/example.csv" target="_blank">example</a>). <br /><br />
/* Twando.com Free PHP Twitter Application http://www.twando.com/ */ if (!$content_id) { exit; } global $error_array, $return_url; ?> <h2>Login</h2> <?php if ($error_array['message'] != "") { echo $error_array['message'] . '<br />'; } else { echo mainFuncs::push_response(6) . '<br />'; } if (!empty($_POST['username_login'])) { $username = $_POST['username_login']; } else { $username = ""; } if (!empty($_POST['password_login'])) { $password = $_POST['password_login']; } else { $password = ""; } ?> <form method="post" action="<?php echo BASE_LINK_URL; ?>
/* Twando.com Free PHP Twitter Application http://www.twando.com/ */ if (!$content_id) { exit; } global $q1a, $response_msg; ?> <h2>Follow / Unfollow Settings for <?php echo htmlentities($q1a['screen_name']); ?> </h2> <?php if ($q1a['id'] == "") { echo mainFuncs::push_response(7); } else { ?> <div class="tab_row"> <input type="hidden" name="twitter_id" id="twitter_id" value="<?php echo $q1a['id']; ?> " /> <div class="tab_main" id="tab1"> <a href="javascript:ajax_follow_settings_tab('tab1');">Auto Follow Settings</a> </div><div class="tab_main" id="tab2"> <a href="javascript:ajax_follow_settings_tab('tab2');">Unfollow Exclusions</a> </div><div class="tab_main" id="tab3"> <a href="javascript:ajax_follow_settings_tab('tab3');">Follow Exclusions</a> </div><div class="tab_main" id="tab4"> <a href="javascript:ajax_follow_settings_tab('tab4');">Auto DM Message</a>
" /> </div> <?php } ?> <br style="clear: both;" /> <input type="hidden" name="search_type" id="search_type" value="<?php echo (int) $_REQUEST['search_type']; ?> " /> <input type="hidden" name="search_term" id="search_term" value="<?php echo strip_tags($_REQUEST['search_term']); ?> " /> <input type="hidden" name="search_lang" id="search_lang" value="<?php echo strip_tags($_REQUEST['search_lang']); ?> " /> <input type="hidden" name="a" value="stf2update" /> </form> <input type="submit" value="Follow Selected Users" class="submit_button_style" onclick="ajax_follow_settings_update('tab5','stf2_form');" /> <?php } else { echo mainFuncs::push_response(25); } } break; //End of switch } //End of if $_REQUEST['tab_id'] }
$bot_enabled = intval($_REQUEST['bot_status']); $follow_rate = intval($_REQUEST['follow_rate']); $follow_rule = $db->prep($_REQUEST['follow_rule']); $tweeting_rate = intval($_REQUEST['tweeting_rate']); $tweet_bot_enabled = intval($_REQUEST['tweet_bot_status']); $tweet_query = $db->prep($_REQUEST['tweet_query']); $tweet_template = $db->prep($_REQUEST['tweet_template']); $tweet_generation_rate = intval($_REQUEST['tweet_generation_rate']); $current_query = $db->fetch_array($db->query("SELECT tweet_query FROM " . DB_PREFIX . "users_config\r\n WHERE user_id='{$db->prep($_REQUEST['twitter_id'])}';")); if (!empty($current_query) && strcasecmp($current_query['tweet_query'], $tweet_query) != 0) { $db->query("UPDATE " . DB_PREFIX . "users_config\r\n SET tweet_generation_offset=0\r\n WHERE user_id='{$db->prep($_REQUEST['twitter_id'])}';"); } try { $db->query("\r\n INSERT INTO " . DB_PREFIX . "users_config\r\n (user_id, follow_bot_status, follow_rate, follow_rule, tweet_bot_status,\r\n tweet_template, tweet_query, tweeting_rate, tweet_generation_rate)\r\n VALUES ('{$db->prep($_REQUEST['twitter_id'])}', {$bot_enabled}, {$follow_rate}, '{$follow_rule}',\r\n {$tweet_bot_enabled}, '{$tweet_template}', '{$tweet_query}', {$tweeting_rate}, {$tweet_generation_rate})\r\n ON DUPLICATE KEY UPDATE\r\n follow_bot_status={$bot_enabled},\r\n follow_rate={$follow_rate},\r\n follow_rule='{$follow_rule}',\r\n tweet_bot_status={$tweet_bot_enabled},\r\n tweet_template='{$tweet_template}',\r\n tweet_query='{$tweet_query}',\r\n tweeting_rate={$tweeting_rate},\r\n tweet_generation_rate={$tweet_generation_rate};\r\n "); $response_msg = mainFuncs::push_response(35); } catch (Exception $ex) { $response_msg = mainFuncs::push_response(34); } break; //End of tab switch } //End of data update POST } //Get account details if (!$q1a) { $q1a = $db->get_user_data($_REQUEST['twitter_id']); } include '../content/' . TWANDO_LANG . '/ajax.follow_settings_inc.php'; //End of is logged in } include '../include_bottom.php';
<?php /* Twando.com Free PHP Twitter Application http://www.twando.com/ */ if (!$content_id) { exit; } global $db, $ap_creds; if ((int) $_GET['msg'] > 0) { $response_msg = mainFuncs::push_response((int) $_GET['msg']); } if (!$ap_creds['consumer_key'] or !$ap_creds['consumer_secret']) { ?> <h2>Register Your Application</h2> Before you can start using Twando, you must first register your application with Twitter. <ol> <li>First, <a href="install_tables.php">click here to install the MySQL tables</a> if you have not done so already.</li> <li>Next, visit <a href="https://dev.twitter.com/apps/new" target="_blank">https://dev.twitter.com/apps/new</a>; you will need to sign in to your Twitter account to register an app.</li> <li>Enter the values as demonstrated in <a href="inc/images/reg_ap.jpg" target="_blank">this picture</a>; your application URL is <b><?php echo BASE_LINK_URL; ?> </b>; your callback URL is <b><?php echo BASE_LINK_URL . 'callback.php'; ?> </b>.</li> <li>You will then be given a consumer key and consumer secret (<a href="inc/images/reg_ap2.jpg" target="_blank">example</a>). Enter these in the boxes below to complete the setup of your Twitter app.</li> <li>You must also make sure your application is set with <b>read/write access</b> on the settings page; <a href="inc/images/reg_ap3.jpg" target="_blank">click here to view</a>.</li> </ol> <form method="post" action="<?php
//Get users $uncached_users = array(); $uncached_users = $cron->get_uncached_users(1); $user_total = sizeof($uncached_users); //Loop and build if ($req_total > 0 and $user_total > 0) { foreach ($uncached_users as $this_id) { //Get user $content = $connection->get('users/show', array('user_id' => $this_id)); //If not a 200 code (i.e. 404) delete row from table if ($connection->http_code != 200) { $db->query("DELETE FROM " . DB_PREFIX . "user_cache WHERE twitter_id='" . $db->prep($this_id) . "'"); } $req_total--; if ($req_total <= 0) { break; } } //Optimise table $db->query("OPTIMIZE TABLE " . DB_PREFIX . "user_cache"); } //End of first pass check } //End of db loop } //Set cron status $cron->set_cron_state('follow', 0); echo mainFuncs::push_response(32); //End of run cron } include 'inc/include_bottom.php';