Index: trunk/extensions/InviteContacts/ImportContactsGmailClass.php |
— | — | @@ -0,0 +1,12 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class ImportContactsGmail extends ImportContacts { |
| 5 | + |
| 6 | + var $refering_site = 'http://mail.google.com/mail/'; |
| 7 | + var $browser_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7'; |
| 8 | + |
| 9 | + function __construct( $email, $password ) { |
| 10 | + parent::__construct( $email, $password ); |
| 11 | + } |
| 12 | + |
| 13 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/InviteFriendOnEdit.php |
— | — | @@ -0,0 +1,60 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Protect against register_globals vulnerabilities. |
| 5 | + * This line must be present before any global variable is referenced. |
| 6 | + */ |
| 7 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 8 | + die( "This file is an extension to the MediaWiki software and is not a valid access point.\n" ); |
| 9 | +} |
| 10 | + |
| 11 | +$wgHooks['ArticleSaveComplete'][] = 'wfInviteFriendToEdit'; |
| 12 | +$wgHooks['ArticleInsertComplete'][] = 'wfCreateOpinionCheck'; |
| 13 | +$wgHooks['OutputPageBeforeHTML'][] = 'wfInviteRedirect'; |
| 14 | + |
| 15 | +function wfInviteFriendToEdit( &$article, &$user, &$text, &$summary, &$minoredit, &$watchthis, &$sectionanchor, &$flags ) { |
| 16 | + if( !$flags & EDIT_NEW ) { |
| 17 | + // Increment edits for this page by one (for this user's session) |
| 18 | + $edits_views = $_SESSION['edits_views']; |
| 19 | + $page_edits_views = $edits_views[$article->getID()]; |
| 20 | + $edits_views[$article->getID()] = ( $page_edits_views + 1 ); |
| 21 | + |
| 22 | + $_SESSION['edits_views'] = $edits_views; |
| 23 | + } |
| 24 | + return true; |
| 25 | +} |
| 26 | + |
| 27 | +function wfCreateOpinionCheck( &$article, &$user, &$text, &$summary, &$minoredit, &$watchthis, &$sectionanchor, &$flags ) { |
| 28 | + global $wgTitle, $wgSendNewArticleToFriends; |
| 29 | + |
| 30 | + if( $wgSendNewArticleToFriends ) { |
| 31 | + // If the user has created a new opinion, we want to turn on a session flag |
| 32 | + $dbr = wfGetDB( DB_MASTER ); |
| 33 | + $res = $dbr->select( |
| 34 | + 'categorylinks', |
| 35 | + array( 'cl_to' ), |
| 36 | + array( 'cl_from' => $wgTitle->getArticleID() ), |
| 37 | + __METHOD__ |
| 38 | + ); |
| 39 | + foreach ( $res as $row ) { |
| 40 | + // @todo FIXME: this sucks, is way too site-specific and probably |
| 41 | + // strtoupper() doesn't play well with languages that have funny |
| 42 | + // characters (German, Finnish, French...) so we need to use some |
| 43 | + // Language method |
| 44 | + if( strtoupper( $row->cl_to ) == 'OPINIONS' ) { |
| 45 | + $_SESSION['new_opinion'] = $wgTitle->getText(); |
| 46 | + } |
| 47 | + } |
| 48 | + } |
| 49 | + return true; |
| 50 | +} |
| 51 | + |
| 52 | +function wfInviteRedirect() { |
| 53 | + global $wgOut, $wgSendNewArticleToFriends; |
| 54 | + if( $wgSendNewArticleToFriends ) { |
| 55 | + if( isset( $_SESSION['new_opinion'] ) ) { |
| 56 | + $invite = SpecialPage::getTitleFor( 'EmailNewArticle' ); |
| 57 | + $wgOut->redirect( $invite->getFullURL( '&page=' . $_SESSION['new_opinion'] ) ); |
| 58 | + unset( $_SESSION['new_opinion'] ); |
| 59 | + } |
| 60 | + } |
| 61 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/SpecialInviteContacts.body.php |
— | — | @@ -0,0 +1,206 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class InviteContacts extends SpecialPage { |
| 5 | + |
| 6 | + /** |
| 7 | + * Constructor |
| 8 | + */ |
| 9 | + public function __construct() { |
| 10 | + parent::__construct( 'InviteContacts' ); |
| 11 | + } |
| 12 | + |
| 13 | + /** |
| 14 | + * Show the special page |
| 15 | + * |
| 16 | + * @param $par Mixed: parameter passed to the page or null |
| 17 | + */ |
| 18 | + public function execute( $par ) { |
| 19 | + global $wgUser, $wgOut, $wgScriptPath, $wgPasswordSender, $wgEmailFrom; |
| 20 | + wfLoadExtensionMessages( 'InviteContacts' ); |
| 21 | + |
| 22 | + /** |
| 23 | + * Redirect anonymous in users to Login Page |
| 24 | + * It will automatically return them to the InviteContacts page |
| 25 | + */ |
| 26 | + if( $wgUser->getID() == 0 ) { |
| 27 | + $login = SpecialPage::getTitleFor( 'Userlogin' ); |
| 28 | + $wgOut->redirect( $login->getLocalURL( 'returnto=Special:InviteContacts' ) ); |
| 29 | + return false; |
| 30 | + } |
| 31 | + |
| 32 | + // Add CSS |
| 33 | + $wgOut->addExtensionStyle( $wgScriptPath . '/extensions/InviteContacts/css/invite.css' ); |
| 34 | + |
| 35 | + if( count( $_POST ) && $_SESSION['alreadysubmitted'] == false ) { |
| 36 | + $_SESSION['alreadysubmitted'] = true; |
| 37 | + |
| 38 | + $html_format = 'no'; // IMPORTANT: change this to "yes" ONLY if you are sending HTML format email |
| 39 | + $title = Title::makeTitle( NS_USER, $wgUser->getName() ); |
| 40 | + $subject = wfMsg( 'invite-subject', $wgUser->getName() ); |
| 41 | + |
| 42 | + $body = wfMsg( 'invite-body', $_POST['sendersemail'], $wgUser->getName(), $title->getFullURL() ); |
| 43 | + |
| 44 | +$message = <<<EOF |
| 45 | + |
| 46 | +$body |
| 47 | + |
| 48 | +EOF; |
| 49 | + |
| 50 | + if( $wgEmailFrom ) { |
| 51 | + $from = $wgEmailFrom; |
| 52 | + } else { |
| 53 | + $from = $wgPasswordSender; |
| 54 | + } |
| 55 | + $sendersemail = $_POST['sendersemail']; |
| 56 | + |
| 57 | + $confirm = ''; |
| 58 | + $loop = 0; |
| 59 | + foreach( $_POST['list'] as $to ) { |
| 60 | + $loop++; |
| 61 | + $confirm .= '<div class="invite-email-sent">' . $loop . '. ' . $to . '</div>'; |
| 62 | + if( $html_format == 'yes' ) { |
| 63 | + UserMailer::send( |
| 64 | + new MailAddress( $to ), |
| 65 | + new MailAddress( $from ), |
| 66 | + $subject, |
| 67 | + $message, |
| 68 | + new MailAddress( $from ), |
| 69 | + 'text/html; charset=UTF-8' |
| 70 | + ); |
| 71 | + } else { |
| 72 | + UserMailer::send( |
| 73 | + new MailAddress( $to ), |
| 74 | + new MailAddress( $from ), |
| 75 | + $subject, |
| 76 | + $message, |
| 77 | + new MailAddress( $sendersemail ) |
| 78 | + ); |
| 79 | + } |
| 80 | + } |
| 81 | + |
| 82 | + $wgOut->setPageTitle( wfMsg( 'invite-sent-page-title' ) ); |
| 83 | + $wgOut->addHTML( '<p class="user-message">' . wfMsg( 'invite-emailswentout' ) . ' ' . $confirm . '</p>' ); |
| 84 | + $wgOut->addHTML( '<div class="relationship-request-buttons"> |
| 85 | + <input type="button" value="' . wfMsg( 'mainpage' ) . '" onclick="window.location=\'' . $wgScriptPath . '/index.php?title=' . wfMsgForContent( 'mainpage' ) . '\'" />' ); |
| 86 | + if( class_exists( 'UserProfile' ) ) { |
| 87 | + $wgOut->addHTML( '<input type="button" value="' . wfMsg( 'invite-yourprofile' ) . '" onclick=\"window.location=\'' . Title::makeTitle( NS_USER_PROFILE, $wgUser->getName() )->getLocalURL() . '\'" />' ); |
| 88 | + } |
| 89 | + $wgOut->addHTML( |
| 90 | + '<input type="button" value="' . wfMsg( 'invite-youruserpage' ) . '" onclick=\"window.location=\'' . Title::makeTitle( NS_USER, $wgUser->getName() )->getLocalURL() . '\'" /> |
| 91 | + </div>' |
| 92 | + ); |
| 93 | + } else { |
| 94 | + $_SESSION['alreadysubmitted'] = false; |
| 95 | + |
| 96 | + $wgOut->addScriptFile( $wgScriptPath . '/extensions/InviteContacts/js/GetContacts.js' ); |
| 97 | + $wgOut->addScriptFile( $wgScriptPath . '/extensions/InviteContacts/js/ahah.js' ); |
| 98 | + |
| 99 | + $wgOut->setPageTitle( wfMsg( 'invite-find-friends' ) ); |
| 100 | + |
| 101 | + // Get network to import from |
| 102 | + $get = ( !empty( $GET ) && isset( $_GET['domain'] ) ) ? $_GET['domain'] : ''; |
| 103 | + if( empty( $get ) ) { |
| 104 | + $script = 'mygmail.php'; |
| 105 | + } else { |
| 106 | + $script = $get . '.php'; |
| 107 | + } |
| 108 | + |
| 109 | + $useCSV = false; |
| 110 | + if( $get == 'myoutlook' || $get == 'myexpress' || $get == 'mythunderbird' ) { |
| 111 | + $useCSV = true; |
| 112 | + } |
| 113 | + |
| 114 | + $formEnc = ''; |
| 115 | + if ( $useCSV ) { |
| 116 | + $formEnc = ' enctype="multipart/form-data" '; |
| 117 | + } |
| 118 | + |
| 119 | + $wgOut->addHTML( $this->_content( $useCSV, $script, $formEnc ) ); |
| 120 | + } |
| 121 | + } |
| 122 | + |
| 123 | + private function _content( $useCSV, $script, $formEnc ) { |
| 124 | + global $wgServer, $wgLanguageCode, $wgScriptPath, $wgUser; |
| 125 | + |
| 126 | + $out = '<div class="invite-links"> |
| 127 | + <span class="profile-on"> |
| 128 | + <a href="' . SpecialPage::getTitleFor( 'InviteContacts' )->escapeFullURL() . '">' . wfMsg( 'invite-find-friends' ) . '</a></span> - <a href="' . SpecialPage::getTitleFor( 'InviteEmail' )->escapeFullURL() . '">' . wfMsg( 'invite-friends' ) . '</a>'; |
| 129 | + |
| 130 | + if ( $wgUser->isLoggedIn() ) { |
| 131 | + if( class_exists( 'UserProfile' ) ) { |
| 132 | + $out .= ' - <a href="' . Title::makeTitle( NS_USER_PROFILE, $wgUser->getName() )->getLocalURL() . '"><strong>' . wfMsg( 'invite-yourprofile' ) . '</strong></a>'; |
| 133 | + } |
| 134 | + $out .= ' - <a href="' . Title::makeTitle( NS_USER, $wgUser->getName() )->getLocalURL() . '"><strong>' . wfMsg( 'invite-youruserpage' ) . '</strong></a>'; |
| 135 | + } |
| 136 | + |
| 137 | + $out .= '</div> |
| 138 | + <div class="invite-message">' . wfMsg( 'invite-getcontactsmaintitle' ) . '</div> |
| 139 | + <div id="target">'; |
| 140 | + |
| 141 | + if ( $useCSV != true ) { |
| 142 | + $out .= '<div class="invite-left"> |
| 143 | + <div class="invite-icons"> |
| 144 | + <img src="' . $wgScriptPath . '/extensions/InviteContacts/images/myyahoo.gif" border="0" alt="Yahoo!" /> |
| 145 | + <img src="' . $wgScriptPath . '/extensions/InviteContacts/images/mygmail.gif" border="0" alt="GMail" /> |
| 146 | + <img src="' . $wgScriptPath . '/extensions/InviteContacts/images/myhotmail.gif" border="0" alt="Hotmail" /> |
| 147 | + <img src="' . $wgScriptPath . '/extensions/InviteContacts/images/myaol.gif" border="0" alt="AOL" /> |
| 148 | + </div> |
| 149 | + <div class="invite-form"> |
| 150 | + <form name="emailform" action="javascript:submit(\'' . $wgServer . $wgScriptPath . '/extensions/InviteContacts/getmycontacts/' . $script . '\', \'POST\');"' . $formEnc . ' method="post" onsubmit="return getMailAccount(\'' . $wgServer . $wgScriptPath . '\', this.username.value, \'' . $wgLanguageCode . '\');"> |
| 151 | + <p class="invite-form-title">' . wfMsg( 'invite-form-email' ) . '</p> |
| 152 | + <p class="invite-form-input"><input type="text" name="username" size="34" /></p> |
| 153 | + <div class="cleared"></div> |
| 154 | + <p class="invite-form-title">' . wfMsg( 'invite-contact-passwd' ) . '</p> |
| 155 | + <p class="invite-form-input"><input type="password" name="password" size="34" /></p> |
| 156 | + <div class="cleared"></div> |
| 157 | + <p><input type="submit" value="' . wfMsg( 'invite-find-friends' ) . '" /></p> |
| 158 | + </form> |
| 159 | + </div> |
| 160 | + </div>'; |
| 161 | +/* $out .= '<div class="invite-right"> |
| 162 | + <h1>' . wfMsg( 'invite-donthaveemail' ) . '</h1> |
| 163 | + <p align="center"> |
| 164 | + <a href="' . SpecialPage::getTitleFor( 'InviteContactsCSV' )->getFullURL() . '"><img src="' . $wgScriptPath . '/extensions/InviteContacts/images/myoutlook.gif" border="0" alt="" /></a> |
| 165 | + <a href="' . SpecialPage::getTitleFor( 'InviteContactsCSV' )->getFullURL() . '"><img src="' . $wgScriptPath . '/extensions/InviteContacts/images/mythunderbird.gif" border="0" alt="" /></a> |
| 166 | + </p> |
| 167 | + <div class="cleared"></div> |
| 168 | + <p align="center"><input type="button" value="' . wfMsg( 'invite-uploadyourcontacts' ) . '" onclick="window.location=\'' . SpecialPage::getTitleFor( 'InviteContactsCSV' )->getFullURL() .'\'" /></p> |
| 169 | + </div> |
| 170 | + <div class="cleared"></div>';*/ |
| 171 | + } /*else { |
| 172 | + $out .= '<div class="invite-left"> |
| 173 | + <div class="invite-icons"> |
| 174 | + <img src="' . $wgScriptPath . '/extensions/InviteContacts/images/myoutlook.gif" border="0" alt="" /> |
| 175 | + <img src="' . $wgScriptPath . '/extensions/InviteContacts/images/mythunderbird.gif" border="0" alt="" /> |
| 176 | + </div> |
| 177 | + <div class="invite-form"> |
| 178 | + <form name="emailform" action="javascript:submit(\'' . $wgServer . '/extensions/InviteContacts/getmycontacts/' . $script . '\', \'POST\');" ' . $formEnc . ' method="post"> |
| 179 | + <p>' . wfMsg( 'invite-csvfilelimit' ) . '</p> |
| 180 | + <p class="invite-form-title">' . wfMsg( 'invite-selectcsvfile' ) . '</p> |
| 181 | + <p class="invite-form-input"><input name="ufile" type="file" id="ufile" size="28" /></p> |
| 182 | + <p><input type="submit" value="' . wfMsg( 'invite-uploadyourcontacts' ) . '"></p> |
| 183 | + </div> |
| 184 | + </div> |
| 185 | + <div class="invite-right"> |
| 186 | + <h1>' . wfMsg( 'invite-queshavewebmail' ) . '</h1> |
| 187 | + <p class="invite-right-image"> |
| 188 | + <a href="' . SpecialPage::getTitleFor( 'InviteContacts' )->getFullURL() . '"><img src="' . $wgScriptPath . '/extensions/InviteContacts/images/myyahoo.gif" border="0" alt="" /></a> |
| 189 | + <a href="' . SpecialPage::getTitleFor( 'InviteContacts' )->getFullURL() . '"><img src="' . $wgScriptPath . '/extensions/InviteContacts/images/mygmail.gif" border="0" alt="" /></a> |
| 190 | + </p> |
| 191 | + <p class="invite-right-image"> |
| 192 | + <a href="' . SpecialPage::getTitleFor( 'InviteContacts' )->getFullURL() . '"><img src="' . $wgScriptPath . '/extensions/InviteContacts/images/myhotmail.gif" border="0" alt="" /></a> |
| 193 | + <a href="' . SpecialPage::getTitleFor( 'InviteContacts' )->getFullURL() . '"><img src="' . $wgScriptPath . '/extensions/InviteContacts/images/myaol.gif" border="0" alt="" /></a> |
| 194 | + </p> |
| 195 | + <div class="cleared"></div> |
| 196 | + <p align="center"> |
| 197 | + <input type="button" value="' . wfMsg( 'invite-find-friends' ) . '" onclick="window.location=\'' . SpecialPage::getTitleFor( 'InviteContacts' )->getFullURL() . '\'" /> |
| 198 | + </p> |
| 199 | + </div> |
| 200 | + <div class="cleared"></div>'; |
| 201 | + }*/ |
| 202 | + |
| 203 | + $out .= '</div>'; |
| 204 | + |
| 205 | + return $out; |
| 206 | + } |
| 207 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/SpecialInviteContactsCSV.php |
— | — | @@ -0,0 +1,332 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +function mb_fgetcsv( $file, $delim = ',', $removeQuotes = true ) { |
| 5 | + $line = trim( fgets( $file ), "\r\n" ); |
| 6 | + $fields = array(); |
| 7 | + $fldCount = 0; |
| 8 | + $inQuotes = false; |
| 9 | + |
| 10 | + for( $i = 0; $i < mb_strlen( $line ); $i++ ) { |
| 11 | + if( !isset( $fields[$fldCount] ) ) { |
| 12 | + $fields[$fldCount] = ''; |
| 13 | + } |
| 14 | + $tmp = mb_substr( $line, $i, mb_strlen( $delim ) ); |
| 15 | + if( $tmp === $delim && !$inQuotes ) { |
| 16 | + $fldCount++; |
| 17 | + $i+= mb_strlen( $delim ) - 1; |
| 18 | + } elseif( $fields[$fldCount] == '' && mb_substr( $line, $i, 1 ) == '"' && !$inQuotes ) { |
| 19 | + if( !$removeQuotes ) { |
| 20 | + $fields[$fldCount] .= mb_substr( $line, $i, 1 ); |
| 21 | + } |
| 22 | + $inQuotes = true; |
| 23 | + } elseif( mb_substr( $line, $i, 1 ) == '"' ) { |
| 24 | + if( mb_substr( $line, $i + 1, 1 ) == '"' ) { |
| 25 | + $i++; |
| 26 | + $fields[$fldCount] .= mb_substr( $line, $i, 1 ); |
| 27 | + } else { |
| 28 | + if( !$removeQuotes ) { |
| 29 | + $fields[$fldCount] .= mb_substr( $line, $i, 1 ); |
| 30 | + } |
| 31 | + $inQuotes = false; |
| 32 | + } |
| 33 | + } else { |
| 34 | + $fields[$fldCount] .= mb_substr( $line, $i, 1 ); |
| 35 | + } |
| 36 | + } |
| 37 | + return $fields; |
| 38 | +} |
| 39 | + |
| 40 | +class InviteContactsCSV extends UnlistedSpecialPage { |
| 41 | + |
| 42 | + const FILE_SIZE = 20000; |
| 43 | + |
| 44 | + /** |
| 45 | + * Constructor |
| 46 | + */ |
| 47 | + public function __construct() { |
| 48 | + parent::__construct( 'InviteContactsCSV' ); |
| 49 | + } |
| 50 | + |
| 51 | + /** |
| 52 | + * Show the special page |
| 53 | + * |
| 54 | + * @param $par Mixed: parameter passed to the page or null |
| 55 | + */ |
| 56 | + public function execute( $par ) { |
| 57 | + global $wgUser, $wgOut, $wgRequest, $wgScriptPath, $wgPasswordSender, $wgEmailFrom; |
| 58 | + wfLoadExtensionMessages( 'InviteContacts' ); |
| 59 | + |
| 60 | + /** |
| 61 | + * Redirect Non-logged in users to Login Page |
| 62 | + * It will automatically return them to the InviteContactsCSV page |
| 63 | + */ |
| 64 | + if( $wgUser->getID() == 0 ){ |
| 65 | + $login = SpecialPage::getTitleFor( 'Userlogin' ); |
| 66 | + $wgOut->redirect( $login->getLocalURL( 'returnto=Special:InviteContactsCSV' ) ); |
| 67 | + return false; |
| 68 | + } |
| 69 | + |
| 70 | + // Add CSS & JS |
| 71 | + $wgOut->addExtensionStyle( $wgScriptPath . '/extensions/InviteContacts/css/invite.css' ); |
| 72 | + $wgOut->addScriptFile( $wgScriptPath . '/extensions/InviteContacts/js/GetContacts.js' ); |
| 73 | + $wgOut->addScriptFile( $wgScriptPath . '/extensions/InviteContacts/js/ahah.js' ); |
| 74 | + |
| 75 | + $this->domain = $wgRequest->getVal( 'domain' ); |
| 76 | + |
| 77 | + if ( count( $_POST ) ) { |
| 78 | + // Uploaded .csv file |
| 79 | + if( $_POST['upload_csv'] == 1 ) { |
| 80 | + |
| 81 | + $wgOut->setPageTitle( wfMsg( 'invite-friends' ) ); |
| 82 | + |
| 83 | + $output = '<div class="invite-links"> |
| 84 | + <span> |
| 85 | + <a href="' . $wgScriptPath . '/index.php?title=Special:InviteContactsCSV">' . wfMsg( 'invite-find-friends' ) . '</a> |
| 86 | + </span> - <a href="' . SpecialPage::getTitleFor( 'InviteEmail' ) . '">' . wfMsg( 'invite-friends' ) . '</a>'; |
| 87 | + |
| 88 | + if ( $wgUser->isLoggedIn() ) { |
| 89 | + if( class_exists( 'UserProfile' ) ) { |
| 90 | + $output .= ' - <a href="' . Title::makeTitle( NS_USER_PROFILE, $wgUser->getName() )->getLocalURL() . '"><strong>' . wfMsg( 'invite-yourprofile' ) . '</strong></a>'; |
| 91 | + } |
| 92 | + $output .= ' - <a href="' . Title::makeTitle( NS_USER, $wgUser->getName() )->getLocalURL() . '"><strong>' . wfMsg( 'invite-youruserpage' ) . '</strong></a>'; |
| 93 | + } |
| 94 | + |
| 95 | + $output .= '</div>'; |
| 96 | + |
| 97 | + $output .= '<form id="form_id" name="myform" method="post" action=""> |
| 98 | + <input type="hidden" name="sendersemail" value="' . $_POST['sendersemail'] . '" />'; |
| 99 | + $output .= '<div class="invite-message">' . wfMsg( 'invite-getcontactsmaintitle' ) . '.</div> |
| 100 | + <h1>' . wfMsg( 'invite-yourcontacts' ) . '</h1> |
| 101 | + <p class="contacts-message"> |
| 102 | + <span class="profile-on">' . wfMsg( 'invite-sharefriends' ) . '</span> |
| 103 | + </p> |
| 104 | + <p class="contacts-message"> |
| 105 | + <input type="submit" value="' . wfMsg( 'invite-friends' ) . '" name="B1" /> <a href="javascript:toggleChecked()">' . wfMsg( 'invite-uncheckallbtn' ) . '</a> |
| 106 | + </p> |
| 107 | + <div class="contacts-title-row"> |
| 108 | + <p class="contacts-checkbox"></p> |
| 109 | + <p class="contacts-title">' |
| 110 | + . wfMsg( 'invite-friendsname' ) . |
| 111 | + '</p> |
| 112 | + <p class="contacts-title">' |
| 113 | + . wfMsg( 'invite-emailaddr' ) . |
| 114 | + '</p> |
| 115 | + <div class="cleared"></div> |
| 116 | + </div> |
| 117 | + <div class="contacts">'; |
| 118 | + |
| 119 | + if( $wgRequest->getFileSize( 'ufile' ) > self::FILE_SIZE ) { |
| 120 | + $wgOut->addHTML( '<div class="upload-csv-error">' . wfMsg( 'invite-uploadfiletoolarge' ) . '</div>' ); |
| 121 | + $wgOut->addHTML( $this->displayForm() ); |
| 122 | + } |
| 123 | + |
| 124 | + // Opening .csv file for processing |
| 125 | + $fp = fopen( $wgRequest->getFileTempname( 'ufile' ), 'r' ); |
| 126 | + while( !feof( $fp ) ) { |
| 127 | + //$data = fgetcsv( $fp, 0, ',' ); // this uses the fgetcsv function to store the quote info in the array $data |
| 128 | + /* multibyte characters patch till php's fgetcsv handles them correctly */ |
| 129 | + $data = mb_fgetcsv( $fp, ',' ); |
| 130 | + |
| 131 | + switch( $wgRequest->getVal( 'email_client' ) ) { |
| 132 | + case 'outlook': |
| 133 | + $dataname = $data[1]; |
| 134 | + if( !empty( $dataname ) && $data[3] ) { |
| 135 | + $dataname = $data[1] . ' ' . $data[3]; |
| 136 | + } |
| 137 | + if( empty( $dataname ) ) { |
| 138 | + $dataname = $data[3]; |
| 139 | + } |
| 140 | + $email = $data[57]; |
| 141 | + break; |
| 142 | + case 'outlook_express': |
| 143 | + $email = $data[1]; |
| 144 | + $dataname = $data[0]; |
| 145 | + break; |
| 146 | + case 'thunderbird': |
| 147 | + $email = $data[4]; |
| 148 | + $dataname = $data[2]; |
| 149 | + if( empty( $dataname ) && ( $data[0] || $data[1] ) ) { |
| 150 | + $dataname = $data[0] . ' ' . $data[1]; |
| 151 | + } |
| 152 | + break; |
| 153 | + } |
| 154 | + if( empty( $dataname ) ) { |
| 155 | + $dataname = $email; |
| 156 | + } |
| 157 | + // Skip table if email is blank |
| 158 | + if( |
| 159 | + !empty( $email ) && $data[0] != 'First Name' && |
| 160 | + $data[0] != 'Name' && $data[1] != 'First Name' |
| 161 | + ) { |
| 162 | + $addresses[] = array( |
| 163 | + 'name' => $dataname, |
| 164 | + 'email' => $email |
| 165 | + ); |
| 166 | + } |
| 167 | + } |
| 168 | + |
| 169 | + if( $addresses ) { |
| 170 | + usort( $addresses, 'sortCSVContacts' ); |
| 171 | + |
| 172 | + foreach( $addresses as $address ) { |
| 173 | + $output .= '<div class="contacts-row"> |
| 174 | + <p class="contacts-checkbox"> |
| 175 | + <input type="checkbox" name="list[]" value="' . $address['email'] . '" checked="checked" /> |
| 176 | + </p> |
| 177 | + <p class="contacts-cell">' |
| 178 | + . $address['name'] . |
| 179 | + '</p> |
| 180 | + <p class="contacts-cell">' |
| 181 | + . $address['email'] . |
| 182 | + '</p> |
| 183 | + <div class="cleared"></div> |
| 184 | + </div>'; |
| 185 | + } |
| 186 | + } |
| 187 | + |
| 188 | + $output .= '</div>'; |
| 189 | + $output .= '<p> |
| 190 | + <input type="submit" value="' . wfMsg( 'invite-friends' ) . '" name="B1" /> <a href="javascript:toggleChecked()">' . wfMsg( 'uncheckallbtn' ) . '</a> |
| 191 | + </p> |
| 192 | + </form>'; |
| 193 | + |
| 194 | + $wgOut->addHTML( $output ); |
| 195 | + } else { // User clicked to send email to contacts |
| 196 | + $html_format = 'no'; // IMPORTANT: change this to "yes" ONLY if you are sending HTML format email |
| 197 | + $title = Title::makeTitle( NS_USER, $wgUser->getName() ); |
| 198 | + $subject = wfMsg( 'invite-subject', $wgUser->getName() ); |
| 199 | + |
| 200 | + $body = wfMsg( 'invite-body', $_POST['sendersemail'], $wgUser->getName(), $title->getFullURL() ); |
| 201 | + |
| 202 | +$message = <<<EOF |
| 203 | + |
| 204 | +$body |
| 205 | + |
| 206 | +EOF; |
| 207 | + |
| 208 | + if( $wgEmailFrom ) { |
| 209 | + $from = $wgEmailFrom; |
| 210 | + } else { |
| 211 | + $from = $wgPasswordSender; |
| 212 | + } |
| 213 | + $sendersemail = $_POST['sendersemail']; |
| 214 | + |
| 215 | + $confirm = ''; |
| 216 | + $loop = 0; |
| 217 | + foreach( $_POST['list'] as $to ) { |
| 218 | + $loop++; |
| 219 | + $confirm .= '<div class="invite-email-sent">' . $loop . '. ' . $to . '</div>'; |
| 220 | + if( $html_format == 'yes' ) { |
| 221 | + UserMailer::send( |
| 222 | + new MailAddress( $to ), new MailAddress( $from ), |
| 223 | + $subject, $message, new MailAddress( $from ), |
| 224 | + 'text/html; charset=UTF-8' |
| 225 | + ); |
| 226 | + } else { |
| 227 | + UserMailer::send( |
| 228 | + new MailAddress( $to ), new MailAddress( $from ), |
| 229 | + $subject, $message, new MailAddress( $sendersemail ) |
| 230 | + ); |
| 231 | + } |
| 232 | + } |
| 233 | + |
| 234 | + $wgOut->setPageTitle( wfMsg( 'invite-msg-sent' ) ); |
| 235 | + $wgOut->addHTML( '<p class="user-message">' . wfMsg( 'invite-emailswentout' ) . ' ' . $confirm . '</p>' ); |
| 236 | + $wgOut->addHTML( '<div class="relationship-request-buttons"> |
| 237 | + <input type="button" value="' . wfMsg( 'mainpage' ) . '" onclick="window.location=\'' . $wgScriptPath . '/index.php?title=' . wfMsgForContent( 'mainpage' ) . '\'" />' ); |
| 238 | + if( class_exists( 'UserProfile' ) ) { |
| 239 | + $wgOut->addHTML( '<input type="button" value="' . wfMsg( 'invite-yourprofile' ) . '" onclick=\'window.location="' . Title::makeTitle( NS_USER_PROFILE, $wgUser->getName() )->getLocalURL() . '\'" />' ); |
| 240 | + } |
| 241 | + $wgOut->addHTML( |
| 242 | + '<input type="button" value="' . wfMsg( 'invite-youruserpage' ) . '" onclick=\'window.location="' . Title::makeTitle( NS_USER, $wgUser->getName() )->getLocalURL() . '\'" /> |
| 243 | + </div>' |
| 244 | + ); |
| 245 | + } |
| 246 | + } else { |
| 247 | + $wgOut->setPageTitle( wfMsg( 'invite-friends' ) ); |
| 248 | + $wgOut->addHTML( $this->displayForm() ); |
| 249 | + } |
| 250 | + } |
| 251 | + |
| 252 | + function displayForm() { |
| 253 | + global $wgUser, $wgOut, $wgRequest, $wgScriptPath; |
| 254 | + |
| 255 | + $out = '<div class="invite-links"> |
| 256 | + <span><a href="' . SpecialPage::getTitleFor( 'InviteEmail' )->escapeFullURL() . '">' . wfMsg( 'invite-friends' ) . '</a>'; |
| 257 | + if ( $wgUser->isLoggedIn() ) { |
| 258 | + if( class_exists( 'UserProfile' ) ) { |
| 259 | + $out .= ' - <a href="' . Title::makeTitle( NS_USER_PROFILE, $wgUser->getName() )->getLocalURL() . '"><strong>' . wfMsg( 'invite-yourprofile' ) . '</strong></a>'; |
| 260 | + } |
| 261 | + $out .= ' - <a href="' . Title::makeTitle( NS_USER, $wgUser->getName() )->getLocalURL() . '"><strong>' . wfMsg( 'invite-youruserpage' ) . '</strong></a>'; |
| 262 | + } |
| 263 | + $out .= '</span> |
| 264 | + </div>'; |
| 265 | + $out .= "<script type=\"text/javascript\"> |
| 266 | + function uploadCSV( f ) { |
| 267 | + if( !f.sendersemail.value ) { |
| 268 | + alert( '" . wfMsg( 'invite-entervalidemail' ) . "' ); |
| 269 | + } else { |
| 270 | + document.emailform.submit(); |
| 271 | + } |
| 272 | + } |
| 273 | + </script>"; |
| 274 | + |
| 275 | + $out .= '<div class="invite-message">' . wfMsg( 'invite-getcontactsmaintitle' ) . '</div> |
| 276 | + <div id="target"> |
| 277 | + <div class="invite-left"> |
| 278 | + <div class="cleared"></div> |
| 279 | + <div class="invite-icons"> |
| 280 | + <img src="' . $wgScriptPath . '/extensions/InviteContacts/images/myoutlook.gif" border="0" alt="Outlook" /> |
| 281 | + <img src="' . $wgScriptPath . '/extensions/InviteContacts/images/myexpress.gif" border="0" alt="Outlook Express" /> |
| 282 | + <img src="' . $wgScriptPath . '/extensions/InviteContacts/images/mythunderbird.gif" border="0" alt="Thunderbird" /> |
| 283 | + </div> |
| 284 | + <div class="invite-form"> |
| 285 | + <form name="emailform" action="" enctype="multipart/form-data" method="post"> |
| 286 | + <input type="hidden" name="upload_csv" value="1" /> |
| 287 | + <p>' . wfMsg( 'invite-csvfilelimit' ) . '</p> |
| 288 | + <p class="invite-form-title">' . wfMsg( 'invite-selectemailclient' ) . '</p> |
| 289 | + <p class="invite-form-input"> |
| 290 | + <select name="email_client"> |
| 291 | + <option value="outlook">Outlook</option> |
| 292 | + <option value="outlook_express">Outlook Express</option> |
| 293 | + <option value="thunderbird">Thunderbird</option> |
| 294 | + </select> |
| 295 | + </p> |
| 296 | + <div class="cleared"></div> |
| 297 | + <p class="invite-form-title">' . wfMsg( 'invite-selectcsvfile' ) . '</p> |
| 298 | + <p class="invite-form-input"><input name="ufile" type="file" id="ufile" size="20" /></p> |
| 299 | + <div class="cleared"></div> |
| 300 | + <p class="invite-form-title">' . wfMsg( 'invite-verifyemail' ) . '</p> |
| 301 | + <p class="invite-form-input"><input name="sendersemail" type="text" id="sendersemail" size="28" value="' . $wgUser->getEmail() . '"/></p> |
| 302 | + <p><input type="button" onclick="javascript:uploadCSV(this.form)" value="' . wfMsg( 'invite-uploadyourcontacts' ) . '" /></p> |
| 303 | + </form> |
| 304 | + </div></div></div>'; |
| 305 | +/* $out .= '<div class="invite-right"> |
| 306 | + <h1>' . wfMsg( 'invite-queshavewebmail' ) . '</h1> |
| 307 | + <p class="invite-right-image"> |
| 308 | + <a href="' . SpecialPage::getTitleFor( 'InviteContacts' )->getFullURL() . '"><img src="' . $wgScriptPath . '/extensions/InviteContacts/images/myyahoo.gif\" border="0" alt="" /></a> |
| 309 | + <a href="' . SpecialPage::getTitleFor( 'InviteContacts' )->getFullURL() . '"><img src="' . $wgScriptPath . '/extensions/InviteContacts/images/mygmail.gif\" border="0" alt="" /></a> |
| 310 | + </p> |
| 311 | + <p class="invite-right-image"> |
| 312 | + <a href="' . SpecialPage::getTitleFor( 'InviteContacts' )->getFullURL() . '"><img src="' . $wgScriptPath . '/extensions/InviteContacts/images/myhotmail.gif" border="0" alt="" /></a> |
| 313 | + <a href="' . SpecialPage::getTitleFor( 'InviteContacts' )->getFullURL() . '"><img src="' . $wgScriptPath . '/extensions/InviteContacts/images/myaol.gif" border="0" alt="" /></a> |
| 314 | + </p> |
| 315 | + <div class="cleared"></div> |
| 316 | + <p align="center"> |
| 317 | + <input type="button" value="' . wfMsg( 'invite-friends' ) . '" onclick="window.location=\'' . SpecialPage::getTitleFor( 'InviteContacts' )->getFullURL() . '\'" /> |
| 318 | + </p> |
| 319 | + </div>*/ |
| 320 | + |
| 321 | + return $out; |
| 322 | + } |
| 323 | +} |
| 324 | + |
| 325 | +function sortCSVContacts( $x, $y ) { |
| 326 | + if ( strtoupper( $x['name'] ) == strtoupper( $y['name'] ) ) { |
| 327 | + return 0; |
| 328 | + } elseif ( strtoupper( $x['name'] ) < strtoupper( $y['name'] ) ) { |
| 329 | + return -1; |
| 330 | + } else { |
| 331 | + return 1; |
| 332 | + } |
| 333 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/SpecialInviteContacts.i18n.php |
— | — | @@ -0,0 +1,253 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalization file for InviteContacts extension. |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | +$messages = array(); |
| 10 | + |
| 11 | +/** English |
| 12 | + * @author Aaron Wright <aaron.wright@gmail.com> |
| 13 | + * @author David Pean <david.pean@gmail.com> |
| 14 | + */ |
| 15 | +$messages['en'] = array( |
| 16 | + 'invitecontacts' => 'Find Your Friends', |
| 17 | + 'invite-subject' => '$1 wants you to join {{SITENAME}}! ', |
| 18 | + 'invite-body' => 'Hi! |
| 19 | + |
| 20 | +Your friend, $1, wants you to join {{SITENAME}}. Check it out at http://{{SERVERNAME}} |
| 21 | + |
| 22 | +To join, just click this link and sign up! |
| 23 | + |
| 24 | +$4 |
| 25 | + |
| 26 | +The {{SITENAME}} Team', |
| 27 | + 'invite-emailanontext' => 'Please $1 to send out invite emails.', |
| 28 | + 'invite-notloggedin' => 'Not logged in', |
| 29 | + 'invite-sharearticle' => 'Share Your Article With Your Friends!', |
| 30 | + 'invite-sent-page-title' => 'Messages Sent!', |
| 31 | + 'invite-email-list-header' => 'Emails went out to the following addresses', |
| 32 | + 'invite-go-to-profile' => 'Let\'s Go To Your Profile!', |
| 33 | + 'invite-network-fans' => 'Are Your Friends $1 Fans? Invite Them.', |
| 34 | + 'invite-message' => '{{SITENAME}} is more fun with your friends. Invite your friends to join {{SITENAME}} by simply entering email addresses and an invitiation message and clicking "Send Email"', |
| 35 | + 'invite-privacy-message' => 'We are serious about keeping your private information private. We do not store the e-mail address or password provided to us.', |
| 36 | + 'invite-form-email' => 'Email Address', |
| 37 | + 'invite-form-password' => 'Password', |
| 38 | + 'invite-btn-addfriends' => 'Add Friends', |
| 39 | + 'invite-no-webmail' => 'Don\'t have web-mail?', |
| 40 | + 'invite-click-here' => 'Click Here', |
| 41 | + 'invite-skip-step' => 'Skip This Step', |
| 42 | + 'invite-csv-size-limit' => 'There is a 2MB limit for your .csv file', |
| 43 | + 'invite-csv-select-file' => 'Select File', |
| 44 | + 'invite-csv-btn-upload' => 'Upload Your Contacts', |
| 45 | + 'invite-csv-have-webmail' => 'Have webmail?', |
| 46 | + 'invite-sent' => 'Your Invitation Has Been Sent!', |
| 47 | + 'invite-back-to-userpage' => '< Back to Your User Page', |
| 48 | + 'invite-sent-thanks' => 'Thanks for spreading the word about {{SITENAME}}!', |
| 49 | + 'invite-more-friends' => 'Invite More Friends', |
| 50 | + 'invite-myfriends' => 'Invite My Friends', |
| 51 | + 'invite-nothanks' => 'No Thanks', |
| 52 | + 'invite-your-friends' => 'Invite Your Friends', |
| 53 | + 'invite-enter-emails' => 'Enter Emails', |
| 54 | + 'invite-comma-separated' => '(comma seperated for multiple addresses)', |
| 55 | + 'invite-customize-email' => 'Customize Your Email', |
| 56 | + 'invite-customize-subject' => 'Subject', |
| 57 | + 'invite-customize-body' => 'Email Body', |
| 58 | + 'invite-customize-send' => 'Send Email', |
| 59 | + 'invite-emailswentout' => 'Emails went out to the following addresses', |
| 60 | + 'invite-entervalidemail' => 'You must enter an email address', |
| 61 | + 'invite-youruserpage' => 'Your User Page', |
| 62 | + 'invite-yourprofile' => 'Your Profile', |
| 63 | + 'invite-subject' => '$1 wants you to join {{SITENAME}}!', |
| 64 | + 'invite-find-friends' => 'Find Your Friends', |
| 65 | + //'invite-donthaveemail' => 'Don\'t have webmail? No problem, upload your contacts file!', |
| 66 | + 'invite-contact-passwd' => 'Password', |
| 67 | + 'invite-uploadyourcontacts' => 'Upload Your Contacts', |
| 68 | + 'invite-csvfilelimit' => 'There is a 2MB limit for your .csv file', |
| 69 | + 'invite-selectcsvfile' => 'Select File', |
| 70 | + 'invite-selectemailclient' => 'Select Email Client', |
| 71 | + 'invite-verifyemail' => 'Verify Your Email Address', |
| 72 | + //'invite-queshavewebmail' => 'Have webmail?', |
| 73 | + 'invite-friends' => 'Invite Your Friends', |
| 74 | + 'invite-uncheckallbtn' => 'uncheck all', |
| 75 | + 'invite-friendsname' => 'Friend\'s Name', |
| 76 | + 'invite-emailaddr' => 'Email', |
| 77 | + 'invite-uploadfiletoolarge' => 'The file you uploaded is too large', |
| 78 | + 'invite-yourcontacts' => 'Your contacts', |
| 79 | + 'invite-sharefriends' => 'Share {{SITENAME}} with your friends. They will thank you. The more friends you invite, the less bored you will be.', |
| 80 | + 'invite-getcontactsmaintitle' => '{{SITENAME}} is more fun with your friends. Invite all of them. Enter your e-mail and password below to load your contacts. <br /><b>We are serious about keeping your private information private. We do not store the e-mail address or password provided to us</b>', |
| 81 | + 'invite-msg-sent' => 'Messages Sent!', |
| 82 | + 'send-new-article-to-friends-message' => 'Awesome. Now, let\'s get you some reads? Share your article with your friends. Just click below!', |
| 83 | + |
| 84 | + # Subjects |
| 85 | + 'invite-rate-subject' => '$1 wants you to rate $2 on {{SITENAME}}', |
| 86 | + 'invite-edit-subject' => '$1 wants you to edit $2 on {{SITENAME}}', |
| 87 | + 'invite-view-subject' => '$1 wants you to read *$2* on {{SITENAME}}', |
| 88 | + |
| 89 | + # Emails |
| 90 | + 'invite-edit-body' => 'Hi! |
| 91 | + |
| 92 | +Your friend, $1, wants your help in editing $4 on {{SITENAME}}. |
| 93 | + |
| 94 | +Click here to edit |
| 95 | + |
| 96 | +$5 |
| 97 | + |
| 98 | +And don\'t forget to add $2 as your {{SITENAME}} friend, at $3 |
| 99 | + |
| 100 | +The {{SITENAME}} Team', |
| 101 | + |
| 102 | + 'invite-body' => 'Hey! |
| 103 | + |
| 104 | +Your friend, $1, wants you to join {{SITENAME}}! Check it out at http://{{SERVERNAME}} |
| 105 | + |
| 106 | +To join, just click this link and sign up! |
| 107 | +$4 |
| 108 | + |
| 109 | +The {{SITENAME}} Team', |
| 110 | + |
| 111 | + 'invite-rate-body' => 'Hi! |
| 112 | + |
| 113 | +Your friend, $1, wants you to rate $4 on {{SITENAME}}. |
| 114 | + |
| 115 | +Click here to rate |
| 116 | + |
| 117 | +$5 |
| 118 | + |
| 119 | +And don\'t forget to add $2 as your {{SITENAME}} friend, at $3 |
| 120 | + |
| 121 | +The {{SITENAME}} Team', |
| 122 | + |
| 123 | + 'invite-view-body' => 'Hi! |
| 124 | + |
| 125 | +Your friend, $1, has just written a new article {{SITENAME}}, and wants you to check it out! |
| 126 | + |
| 127 | +Click here to view |
| 128 | + |
| 129 | +$5 |
| 130 | + |
| 131 | +And don\'t forget to add $2 as your {{SITENAME}} friend, at $3 |
| 132 | + |
| 133 | +The {{SITENAME}} Team', |
| 134 | +); |
| 135 | + |
| 136 | +/** Finnish (Suomi) |
| 137 | + * @author Jack Phoenix |
| 138 | + */ |
| 139 | +$messages['fi'] = array( |
| 140 | + 'invitecontacts' => 'Löydä ystäväsi', |
| 141 | + 'invite-subject' => '$1 haluaa sinun liittyvän {{GRAMMAR:illative|{{SITENAME}}}}! ', |
| 142 | + 'invite-body' => 'Hei! |
| 143 | + |
| 144 | +Ystäväsi, $1, haluaa sinun liittyvän {{GRAMMAR:illative|{{SITENAME}}}}. Käy katsomassa se osoitteessa http://{{SERVERNAME}} |
| 145 | + |
| 146 | +Liittyäksesi mukaan, napsauta vain tätä linkkiä ja luo tunnus! |
| 147 | + |
| 148 | +$4 |
| 149 | + |
| 150 | +{{GRAMMAR:genitive|{{SITENAME}}}} tiimi', |
| 151 | + 'invite-emailanontext' => 'Sinun tulee $1 lähettääksesi kutsusähköposteja.', |
| 152 | + 'invite-notloggedin' => 'Et ole sisäänkirjautunut', |
| 153 | + 'invite-sharearticle' => 'Jaa artikkelisi ystäviesi kanssa!', |
| 154 | + 'invite-sent-page-title' => 'Viestit lähetetty!', |
| 155 | + 'invite-email-list-header' => 'Sähköpostit lähetettiin seuraaviin osotteisiin', |
| 156 | + 'invite-go-to-profile' => 'Mennään profiiliisi!', |
| 157 | + 'invite-network-fans' => 'Ovatko ystäväsi $1-faneja? Kutsu heidät.', |
| 158 | + 'invite-message' => '{{SITENAME}} on hauskempi ystäviesi kanssa. Kutsu ystäväsi liittymään mukaan {{GRAMMAR:illative|{{SITENAME}}}} yksinkertaisesti antamalla sähköpostiosoitteet ja kutsukirjeen ja napsauttamalla "Lähetä sähköposti".', |
| 159 | + 'invite-privacy-message' => 'Olemme vakavissamme yksityisten tietojesi pitämisestä yksityisenä. Emme tallenna meille tarjottuja sähköpostiosoitteita tai salasanoja.', |
| 160 | + 'invite-form-email' => 'Sähköpostiosoite', |
| 161 | + 'invite-form-password' => 'Salasana', |
| 162 | + 'invite-btn-addfriends' => 'Lisää ystäviä', |
| 163 | + 'invite-no-webmail' => 'Etkö omista sähköpostia?', |
| 164 | + 'invite-click-here' => 'Napsauta tästä', |
| 165 | + 'invite-skip-step' => 'Ohita tämä vaihe', |
| 166 | + 'invite-csv-size-limit' => '.csv-tiedostollasi on 2 MB:n kokorajoitus', |
| 167 | + 'invite-csv-select-file' => 'Valitse tiedosto', |
| 168 | + 'invite-csv-btn-upload' => 'Tallenna yhteystietojasi', |
| 169 | + 'invite-csv-have-webmail' => 'Omistatko sähköpostiosoitteen?', |
| 170 | + 'invite-sent' => 'Kutsusi on lähetetty!', |
| 171 | + 'invite-back-to-userpage' => '< Takaisin käyttäjäsivullesi', |
| 172 | + 'invite-sent-thanks' => 'Kiitos, kun levitit sanaa {{GRAMMAR:elative|{{SITENAME}}}}!', |
| 173 | + 'invite-more-friends' => 'Kutsu lisää ystäviä', |
| 174 | + 'invite-myfriends' => 'Kutsu ystäviäni', |
| 175 | + 'invite-nothanks' => 'Ei kiitos', |
| 176 | + 'invite-your-friends' => 'Kutsu ystäväsi', |
| 177 | + 'invite-enter-emails' => 'Anna sähköpostiosoitteet', |
| 178 | + 'invite-comma-separated' => '(pilkuin eroteltuina usempien osoitteiden tapauksessa)', |
| 179 | + 'invite-customize-email' => 'Tuunaa sähköpostiasi', |
| 180 | + 'invite-customize-subject' => 'Otsikko', |
| 181 | + 'invite-customize-body' => 'Sähköpostin vartalo', |
| 182 | + 'invite-customize-send' => 'Lähetä sähköposti', |
| 183 | + 'invite-emailswentout' => 'Sähköpostit lähetettiin seuraaviin osotteisiin', |
| 184 | + 'invite-entervalidemail' => 'Sinun tulee antaa sähköpostiosoite', |
| 185 | + 'invite-youruserpage' => 'Käyttäjäsivusi', |
| 186 | + 'invite-yourprofile' => 'Käyttäjäprofiilisi', |
| 187 | + 'invite-subject' => '$1 haluaa sinun liittyvän {{GRAMMAR:illative|{{SITENAME}}}}!', |
| 188 | + 'invite-find-friends' => 'Löydä ystäväsi', |
| 189 | + //'invite-donthaveemail' => 'Etkö omista sähköpostiosoitetta? Ei hätää, tallenna yhteystietotiedostosi!', |
| 190 | + 'invite-contact-passwd' => 'Salasana', |
| 191 | + 'invite-uploadyourcontacts' => 'Tallenna yhteystietotiedostosi', |
| 192 | + 'invite-csvfilelimit' => '.csv-tiedostollasi on 2 MB:n kokorajoitus', |
| 193 | + 'invite-selectcsvfile' => 'Valitse tiedosto', |
| 194 | + 'invite-selectemailclient' => 'Valitse sähköpostiohjelma', |
| 195 | + 'invite-verifyemail' => 'Varmista sähköpostiosoitteesi', |
| 196 | + //'invite-queshavewebmail' => 'Omistatko sähköpostiosoitteen?', |
| 197 | + 'invite-friends' => 'Kutsu ystäviäsi', |
| 198 | + 'invite-uncheckallbtn' => 'poista valinta kaikista', |
| 199 | + 'invite-friendsname' => 'Ystävän nimi', |
| 200 | + 'invite-emailaddr' => 'Sähköposti', |
| 201 | + 'invite-uploadfiletoolarge' => 'Tallentamasi tiedosto on liian iso', |
| 202 | + 'invite-yourcontacts' => 'Yhteystietosi', |
| 203 | + 'invite-sharefriends' => 'Jaa {{SITENAME}} ystäviesi kanssa. He kiittävät sinua. Mitä enemmän ystäviä kutsut, sitä vähemmän tylsistyneempi olet.', |
| 204 | + 'invite-getcontactsmaintitle' => '{{SITENAME}} on hauskempi ystäviesi kanssa. Kutsu heidät kaikki. Anna sähköpostiosoitteesi ja salasanasi alempana ladataksesi yhteystietosi. <br /><b>Olemme vakavissamme yksityisten tietojesi pitämisestä yksityisenä. Emme tallenna meille tarjottuja sähköpostiosoitteita tai salasanoja.</b>', |
| 205 | + 'invite-msg-sent' => 'Viestit lähetetty!', |
| 206 | + 'send-new-article-to-friends-message' => 'Mahtavaa. Hankittaisiinko nyt sinulle joitakin lukijoita? Jaa artikkelisi ystäviesi kanssa. Napsauta vain alapuolella olevia painikkeita!', |
| 207 | + 'invite-rate-subject' => '$1 haluaa sinun arvostelevan artikkelin $2 {{GRAMMAR:inessive|{{SITENAME}}}}', |
| 208 | + 'invite-edit-subject' => '$1 haluaa sinun muokkaavan artikkelia $2 {{GRAMMAR:inessive|{{SITENAME}}}}', |
| 209 | + 'invite-view-subject' => '$1 haluaa sinun lukevan artikkelin *$2* {{GRAMMAR:inessive|{{SITENAME}}}}', |
| 210 | + 'invite-edit-body' => 'Hei! |
| 211 | + |
| 212 | +Ystäväsi, $1, haluaa apuasi artikkelin $4 muokkaamisessa {{GRAMMAR:inessive|{{SITENAME}}}}. |
| 213 | + |
| 214 | +Napsauta tästä muokataksesi |
| 215 | + |
| 216 | +$5 |
| 217 | + |
| 218 | +Äläkä unohda lisätä käyttäjää $2 {{GRAMMAR:genitive|{{SITENAME}}}} ystäväksesi, osoitteessa $3 |
| 219 | + |
| 220 | +{{GRAMMAR:genitive|{{SITENAME}}}} tiimi', |
| 221 | + |
| 222 | + 'invite-body' => 'Hei! |
| 223 | + |
| 224 | +Ystäväsi, $1, haluaa sinun liityvän {{GRAMMAR:illative|{{SITENAME}}}}! Löydät sen osoitteesta http://{{SERVERNAME}} |
| 225 | + |
| 226 | +Liittyäksesi napsauta vain tätä linkkiä ja rekisteröidy! |
| 227 | +$4 |
| 228 | + |
| 229 | +{{GRAMMAR:genitive|{{SITENAME}}}} tiimi', |
| 230 | + |
| 231 | + 'invite-rate-body' => 'Hei! |
| 232 | + |
| 233 | +Ystäväsi, $1, haluaa sinun arvostelevan artikkelin $4 {{GRAMMAR:inessive|{{SITENAME}}}}. |
| 234 | + |
| 235 | +Napsauta tästä arvostellaksesi |
| 236 | + |
| 237 | +$5 |
| 238 | + |
| 239 | +Äläkä unohda lisätä käyttäjää $2 {{GRAMMAR:genitive|{{SITENAME}}}} ystäväksesi, osoitteessa $3 |
| 240 | + |
| 241 | +{{GRAMMAR:genitive|{{SITENAME}}}} tiimi', |
| 242 | + |
| 243 | + 'invite-view-body' => 'Hei! |
| 244 | + |
| 245 | +Ystäväsi, $1, on juuri kirjoittanut uuden artikkelin {{GRAMMAR:illative|{{SITENAME}}}}, ja haluaa sinun katsovan sen! |
| 246 | + |
| 247 | +Napsauta tästä katsoaksesi |
| 248 | + |
| 249 | +$5 |
| 250 | + |
| 251 | +Äläkä unohda lisätä käyttäjää $2 {{GRAMMAR:genitive|{{SITENAME}}}} ystäväksesi, osoitteessa $3 |
| 252 | + |
| 253 | +{{GRAMMAR:genitive|{{SITENAME}}}} tiimi', |
| 254 | +); |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/SpecialInviteContacts.php |
— | — | @@ -0,0 +1,45 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * InviteContacts extension |
| 5 | + * Allows wiki users to invite their friends to the wiki |
| 6 | + * GetMyContacts version: 4.3 (22-04-2007) |
| 7 | + * |
| 8 | + * @file |
| 9 | + * @ingroup Extensions |
| 10 | + * @version 1.0 |
| 11 | + * @author Aaron Wright <aaron.wright@gmail.com> |
| 12 | + * @author David Pean <david.pean@gmail.com> |
| 13 | + * @author Jack Phoenix <jack@countervandalism.net> |
| 14 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 15 | + */ |
| 16 | + |
| 17 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 18 | + die( "This is not a valid entry point.\n" ); |
| 19 | +} |
| 20 | + |
| 21 | +// Extension credits that show up on Special:Version |
| 22 | +$wgExtensionCredits['specialpage'][] = array( |
| 23 | + 'name' => 'InviteContacts', |
| 24 | + 'version' => '1.0', |
| 25 | + 'author' => array( 'Aaron Wright', 'David Pean', 'Jack Phoenix' ), |
| 26 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:InviteContacts', |
| 27 | + 'description' => 'Adds new special pages to invite your friends and send email links to your friends', |
| 28 | +); |
| 29 | + |
| 30 | +// Set up the new special pages |
| 31 | +$dir = dirname( __FILE__ ) . '/'; |
| 32 | +$wgExtensionMessagesFiles['InviteContacts'] = $dir . 'SpecialInviteContacts.i18n.php'; |
| 33 | +$wgAutoloadClasses['EmailNewArticle'] = $dir . 'SpecialEmailNewArticle.php'; |
| 34 | +$wgAutoloadClasses['InviteContacts'] = $dir . 'SpecialInviteContacts.body.php'; |
| 35 | +$wgAutoloadClasses['InviteContactsCSV'] = $dir . 'SpecialInviteContactsCSV.php'; |
| 36 | +$wgAutoloadClasses['InviteEmail'] = $dir . 'SpecialInviteEmail.php'; |
| 37 | +$wgSpecialPages['EmailNewArticle'] = 'EmailNewArticle'; |
| 38 | +$wgSpecialPages['InviteContacts'] = 'InviteContacts'; |
| 39 | +$wgSpecialPages['InviteContactsCSV'] = 'InviteContactsCSV'; |
| 40 | +$wgSpecialPages['InviteEmail'] = 'InviteEmail'; |
| 41 | + |
| 42 | +// The email address where invite emails are sent out from |
| 43 | +$wgEmailFrom = $wgPasswordSender; |
| 44 | + |
| 45 | +// @todo document |
| 46 | +$wgSendNewArticleToFriends = false; |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/myindiatimes.php |
— | — | @@ -0,0 +1,245 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Indiatimes contact importing script |
| 5 | + */ |
| 6 | + |
| 7 | +$fullemail = $_POST['username']; |
| 8 | + |
| 9 | +list( $username, $domain ) = explode( '@', $fullemail ); |
| 10 | + |
| 11 | +$password = $_POST['password']; |
| 12 | + |
| 13 | +$refering_site = 'http://mail.lycos.com/lycos/Index.lycos'; // setting the site for refer |
| 14 | + |
| 15 | +$browser_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)'; // setting browser type |
| 16 | + |
| 17 | +$path_to_cookie = realpath( 'indiatimescookie.txt' ); |
| 18 | + |
| 19 | +$setcookie = fopen( $path_to_cookie, 'wb' ); //this opens the file and resets it to zero length |
| 20 | +fclose( $setcookie ); |
| 21 | + |
| 22 | +// Logging onto Lycos, step 1 |
| 23 | + |
| 24 | +$login_page = 'http://infinite.indiatimes.com/'; |
| 25 | + |
| 26 | + $ch = curl_init(); |
| 27 | + curl_setopt( $ch, CURLOPT_URL, $login_page ); |
| 28 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 29 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 30 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 0 ); |
| 31 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 32 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 33 | + curl_setopt( $ch, CURLOPT_REFERER, $login_page ); |
| 34 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 35 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 36 | + $result = curl_exec( $ch ); |
| 37 | + curl_close( $ch ); |
| 38 | + |
| 39 | +preg_match_all( '%action="http://(.*?)"%', $result, $matches ); |
| 40 | + |
| 41 | +$posturl = $matches[1][0]; |
| 42 | + |
| 43 | +// Posting data to Lycos |
| 44 | + |
| 45 | + $url = 'http://' . $posturl; |
| 46 | + $postdata1 = 'login=' . $username . '&passwd=' . $password . '&Sign+in.x=31&Sign+in.y=17'; |
| 47 | + |
| 48 | + $ch = curl_init(); |
| 49 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 50 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 51 | + curl_setopt( $ch, CURLOPT_POST, 1 ); |
| 52 | + curl_setopt( $ch, CURLOPT_POSTFIELDS, $postdata1 ); |
| 53 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 54 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); |
| 55 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 56 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 57 | + curl_setopt( $ch, CURLOPT_REFERER, $login_page ); |
| 58 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 59 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 60 | + $result = curl_exec( $ch ); |
| 61 | + curl_close( $ch ); |
| 62 | + |
| 63 | +preg_match_all( '/login=(.*?)&command=compose/', $result, $matches ); |
| 64 | + |
| 65 | +$hidden = $matches[1][0]; |
| 66 | + |
| 67 | +// Opening Download csv page |
| 68 | +$url = 'http://infinite.indiatimes.com/cgi-bin/infinitemail.cgi?login=' . $hidden . '&command=addimpexp'; |
| 69 | + |
| 70 | + |
| 71 | + $ch = curl_init(); |
| 72 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 73 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 74 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 75 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); |
| 76 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 77 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 78 | + curl_setopt( $ch, CURLOPT_REFERER, $url ); |
| 79 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 80 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 81 | + $result = curl_exec( $ch ); |
| 82 | + curl_close( $ch ); |
| 83 | + |
| 84 | +// Downloading csv file |
| 85 | + $url = 'http://infinite.indiatimes.com/cgi-bin/infinitemail.cgi/addressbook.csv?login=' . $hidden . '&command=addimpexp&button=Export+to+CSV+Format'; |
| 86 | + |
| 87 | + $ch = curl_init(); |
| 88 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 89 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 90 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 91 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); |
| 92 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 93 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 94 | + curl_setopt( $ch, CURLOPT_REFERER, $url ); |
| 95 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 96 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 97 | + $result3 = curl_exec( $ch ); |
| 98 | + curl_close( $ch ); |
| 99 | + |
| 100 | +// Writing the results to a csv file on the server |
| 101 | + $myFile = $username; |
| 102 | + $fh = fopen( $myFile, 'w' ) or die( "can't open file" ); |
| 103 | + fwrite( $fh, $result3 ); |
| 104 | + fclose( $fh ); |
| 105 | + |
| 106 | +// Checking if login was successful -- by searching the @ sign in the csv file |
| 107 | +preg_match_all( "/@/", $result3, $array_at ); |
| 108 | + |
| 109 | +$at_sign = $array_at[0]; |
| 110 | + |
| 111 | +if( empty( $at_sign ) ) { |
| 112 | + echo '<p align="center"><font face="Verdana" size="2"><b>No Details Found:</b> Please make sure you have entered correct login details and try again.</font></p><p align="center">'; |
| 113 | +} else { |
| 114 | + // If login was successful, start displaying HTML |
| 115 | + // [header section - html] |
| 116 | + |
| 117 | +$header = <<<headertext |
| 118 | + |
| 119 | +<html> |
| 120 | +<head> |
| 121 | +<title>CONTACTS</title> |
| 122 | +<script type="text/javascript" src="../js/SelectAll.js"></script> |
| 123 | +</head> |
| 124 | +<body> |
| 125 | + |
| 126 | +headertext; |
| 127 | + |
| 128 | + echo $header; |
| 129 | + |
| 130 | +// [RESULTS -TITLE HTML] |
| 131 | + |
| 132 | +$title = <<<titletext |
| 133 | + |
| 134 | +<body> |
| 135 | +<div align="center"> |
| 136 | +<center> |
| 137 | +<table border="0" width="578"> |
| 138 | +<tr> |
| 139 | +<td width="622"><img height=2 alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 140 | +</tr> |
| 141 | +<tr> |
| 142 | +<td align="middle" width="622"> |
| 143 | +<table cellspacing="0" cellpadding="0" width="640" border="0"> |
| 144 | +<tbody> |
| 145 | +<tr> |
| 146 | +<td width="5" height="5"><img height="5" alt="" src="../images/tls.gif" width="5" border="0" /></td> |
| 147 | +<td background="../images/t.gif" colspan="2" width="716"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 148 | +<td width="6" height="5"><img height="5" alt="" src="../images/trs.gif" width="5" border="0" /></td></tr> |
| 149 | +<tr> |
| 150 | +<td width="5" background="../images/l.gif" height="5"><img height="5" alt="" src="../images/spacer.gif" width="5" border="0" /></td> |
| 151 | +<td width="6"><img height="1" alt="" src="../images/spacer.gif" width="6" border="0" /></td> |
| 152 | +<td valign="top" width="704"> |
| 153 | +<table border="0" width="100%"> |
| 154 | +<tr> |
| 155 | +<td width="100%" bgcolor="#D7D8DF"> |
| 156 | +<p align="center"><font face="Arial" size="3" color="#333333">My Contacts</font> |
| 157 | +</td> |
| 158 | +</tr> |
| 159 | +</table> |
| 160 | +<p align="center"> |
| 161 | + |
| 162 | +titletext; |
| 163 | + |
| 164 | + echo $title; |
| 165 | + |
| 166 | + // [RESULTS - START OF FORM] |
| 167 | + echo '<form id="form_id" name="myform" method="post" action="postage.php">'; |
| 168 | + |
| 169 | + echo '<div align="center"><center><table border="0" cellpadding="3" cellspacing="6" width="100%">'; |
| 170 | + |
| 171 | + // Opening the stored csv file and turning it into an array |
| 172 | + $fp = fopen( $username, 'r' ); |
| 173 | + |
| 174 | + while( !feof( $fp ) ) { |
| 175 | + $data = fgetcsv( $fp, 4100, ',' ); // this uses the fgetcsv function to store the quote info in the array $data |
| 176 | + |
| 177 | + $dataname = $data[0]; |
| 178 | + |
| 179 | + if( empty( $dataname ) ) { |
| 180 | + $dataname = $data[1]; |
| 181 | + } |
| 182 | + |
| 183 | + if( empty( $dataname ) ) { |
| 184 | + $dataname = $data[3]; |
| 185 | + } |
| 186 | + |
| 187 | + if( empty( $dataname ) ) { |
| 188 | + $dataname = $data[4]; |
| 189 | + } |
| 190 | + |
| 191 | + if( empty( $dataname ) ) { |
| 192 | + $dataname = 'None'; |
| 193 | + } |
| 194 | + |
| 195 | + $email = $data[5]; |
| 196 | + |
| 197 | + if( empty( $email ) ) { |
| 198 | + // Skip table |
| 199 | + } else { |
| 200 | + $email = $data[5]; |
| 201 | + |
| 202 | + if( $dataname != 'First Name' ) { |
| 203 | + echo '<tr> |
| 204 | + <td width="22" bgcolor="#F5F5F5"><input type="checkbox" name="list[]" value="' . $email . '" checked="checked" /></td> |
| 205 | + <td width="269" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $dataname . '</font></td> |
| 206 | + <td width="296" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $email . '</font></td> |
| 207 | + <input type="hidden" name="sendersemail" size="20" value="' . $username . '" /> |
| 208 | + </tr>'; |
| 209 | + } |
| 210 | + } |
| 211 | + } |
| 212 | + echo '</table></center></div>'; |
| 213 | + |
| 214 | +$footer = <<<footertext |
| 215 | + |
| 216 | +<table border="0" width="100%"> |
| 217 | +<tr> |
| 218 | +<td width="100%"> |
| 219 | +<p align="center"> |
| 220 | +<input type="submit" value="Send Email To Contacts" name="B1" style="background-color: #808080; color: #FFFFFF; font-family: Arial; font-size: 10pt; font-weight: bold; border: 1 solid #333333"></p> |
| 221 | +</form> |
| 222 | +</td> |
| 223 | +</tr> |
| 224 | +</table> |
| 225 | +<img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 226 | +<td width="6" background="../images/r.gif" height="5"><img height=1 alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 227 | +</tr> |
| 228 | +<tr> |
| 229 | +<td width="5" height="5"><img height="5" alt="" src="../images/bls.gif" width=5 border="0" /></td> |
| 230 | +<td background="../images/b.gif" colspan=2 width="716"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0"></td> |
| 231 | +<td width="6" height="5"><img height=5 alt="" src="../images/brs.gif" width="5" border="0" /></td> |
| 232 | +</tr> |
| 233 | +</tbody> |
| 234 | +</table> |
| 235 | +</td> |
| 236 | +</tr> |
| 237 | +</table> |
| 238 | +</center></div> |
| 239 | +</body></html> |
| 240 | + |
| 241 | +footertext; |
| 242 | + |
| 243 | + echo $footer; |
| 244 | +} |
| 245 | + |
| 246 | + unlink( $username ); // deleting csv file |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/aolcookie.txt |
— | — | @@ -0,0 +1,29 @@ |
| 2 | +# Netscape HTTP Cookie File |
| 3 | +# http://www.netscape.com/newsref/std/cookie_spec.html |
| 4 | +# This file was generated by libcurl! Edit at your own risk. |
| 5 | + |
| 6 | +.my.screenname.aol.com TRUE / FALSE 0 SNS_SC diAxLjAga2lkIDEgSE5Vb0ZuT2tVMEQrVGtnWmk4RThWdGIrSzY0PQ%3D%3D-dwYGM2lmn8Kx1alyL3QpjcecQ5WV4%2Ff4cdWMfDdXd1N1iC4Mu50sTubXP1xUZ4FimPBC8lIgmC%2FlefL%2B9wVBAPXpIpC5rrqnBGw5A%2F25gFy8lgrHipgirEmemcofDa2%2B8ldeb4jcCEI9AOrIS%2Bh8hrq5YOy5fWNMhX1wZPOumjNDlseSQcQNkVNX5alET4CxQelWv9d5pJsET0CxXvgpUw%3D%3D |
| 7 | +.my.screenname.aol.com TRUE / FALSE 1181700461 SNS_LDC 1 vatlasaol-static 2 1179108460 2 1179108460 0 |
| 8 | +aol.com FALSE / FALSE 0 s_sq %5B%5BB%5D%5D |
| 9 | +aol.com FALSE / FALSE 0 s_cc true |
| 10 | +.aol.com TRUE / FALSE 1210212460 RSP_COOKIE type=21&name=VGF0aTkyMw%3D%3D&stype=100 |
| 11 | +.my.screenname.aol.com TRUE / FALSE 1181700461 SNS_TT AAd0YXRpOTIzRkfEbAAAEAABADRvBliKiVP9JlZAVCbe0AfSErFNBITfEQ3z5nsZGnfQwFoJbREP%2FzIrtln%2F0ZxBJSexidpi |
| 12 | +.aol.com TRUE / FALSE 0 MC_CMP_ESK AXxpwDsOxv/vRo1jeAV9Sg== |
| 13 | +.screenname.aol.com TRUE / FALSE 0 SNS_SKWAT diAyLjAga2lkIDEgc0IyZjAwWVhnWWl6QllzdFUvY25jd25jSzlnPQ%3D%3D-zjuQd2QcnlpRVbn6Sc2y7JtItfeEN8yFuP7v2Xvk%2FnUZbklWIzf71QNbOqzWZgGq43mDlhaB25W45jv3eQOIsOfNmD3oUPdfJz8TAwCWqbrIOyIxKMtwuKhToLuFqsSPg%2BqkVEBJuW8MiLfTQkdPJLhDGfD1A98ouRZBjm%2FjBcY%3D |
| 14 | +.screenname.aol.com TRUE / FALSE 2112228461 SNS_L0 diAxLjAga2lkIDEgeWtQNWNndUYzTFBjOCsvWnpFeXpZM3UvYVJzPQ%3D%3D-8iJx9LgFp4aLD7Eyp%2ByMgw%3D%3D |
| 15 | +.aol.com TRUE / FALSE 0 SNS_AA asrc=2&sst=1179108461 |
| 16 | +.aol.com TRUE / FALSE 2125188372 MC_CMP_ESKX haCOUjO+Cyd9fm63Iqen/g== |
| 17 | +.classic.webmail.aol.com TRUE /_cqr FALSE 1180317988 MC_CMP_SX diAxLjAga2lkIDIwMDUwMjA4MDIwMDAzMDAwMA%3D%3D-lnZEyUYTe8tHioW2UllUOeO9TZD4WMzN2OWxSk5S35tI68aboym0gryVd37l0GGbC1eouVsBYqMqwc%2BAUDibT7ClzkMf8TIi4b3dannZOHEC2zTwih5GJc64yg92VPi0bPvI%2FIs2HGd5kKlAeYHlB5LIEom5hB27YThmiCnpU7xUIt9aBp0cl4RtNlPHC5v%2B23HJ2rpiATbGnsgcaRjqJyeDecOiPTvRjNLaFrzXuOcbHPL%2FB4WmbqLA%2FF7t19o5HEEo%2BsfoZZvDy8Fc5Eph48Vn8AgdiycjNzrgoUu5asQ8%2BZuB0HE24KQJEKE8py7cIue8wD1IDpcQZAX19RlhJxviDdenGRwnkTK5UDiGvnDsm3O6JIYfBBOVwcOSWOpspj%2FSDBUl3PoCHTapfzvaUruUxobKLA1xEZg%2B9oXIk7GttgDqWQT0%2F8O%2FstEFSVbQI2bwiRLMsiVdJyrPPwROfKVofPUKYgyUodrvM41z4Layd6%2Ffvd3ILxkS7SEZXQwV5Cg0AjzftMvFwvPHaaSuEkJKm4rV1%2FQSGbLkNR7fd7DNqog7KXvnUNJqTnmsvw8sAtEf%2FfcMqTCiHwAkQb4DX1BwSrVOR%2F5BatFMk4hLQe%2BZ5yIrl47fwrwHziNioHtO0OA3JniVTOjI4uazWw7f%2FppGiWuj4tXfD%2BsqNdH2FdGVFcaTo3pS0FDTKXWKehjY%2FA4qiNoZJL5DFG1bqApqIKti33ub4IItyytA6jQpfBw%3D |
| 18 | +.classic.webmail.aol.com TRUE /_cqr FALSE 0 MC_CMP_S diAxLjAga2lkIDIwMDcwNTEzMDEwMDAyMDY4Nw%3D%3D-MmYIPpGvAbOUQL%2Bliqvmx8RtLIC1BD79A9wzJoFs56dd8tcbdCy0kw%3D%3D |
| 19 | +.classic.webmail.aol.com TRUE / FALSE 0 MC_CMP_CTX EUAMuIQTikg+v/oALVQu6ardsA== |
| 20 | +.classic.webmail.aol.com TRUE / FALSE 0 MC_SITE_ACT haCOUjO+Cyd9fm63Iqen/g==-Lg8pURhxDCv3Is3YC1K/IYm48QMBxwwN |
| 21 | +classic.webmail.aol.com FALSE / FALSE 0 lastViewedFolderID |
| 22 | +classic.webmail.aol.com FALSE / FALSE 0 COMMAND 429955 |
| 23 | +classic.webmail.aol.com FALSE / FALSE 0 LOGIN 64.12.194.4[-]5006[-]16179314779557262[-]Tati923[-]aol/us/static[-]0[-]0[-]0[-]1179108462[-]1[-]261142998[-][d]k45Q1eeHP0T10R7m6rYhPBjLElA= |
| 24 | +classic.webmail.aol.com FALSE / FALSE 0 FOLDERS 0[-]15[-]1[-] |
| 25 | +classic.webmail.aol.com FALSE / FALSE 0 PREFS MVstXVstXTBbLV1bLV0xWy1dMA== |
| 26 | +.webmail.aol.com TRUE / FALSE 4294967295 memstat 1 |
| 27 | +classic.webmail.aol.com FALSE / FALSE 0 MAM |
| 28 | +.ab.classic.webmail.aol.com TRUE / FALSE 0 vl_ctx_abow_us_en_classic EUAMlOobWUJflVkAKAk1XxR4wg== |
| 29 | +.ab.classic.webmail.aol.com TRUE / FALSE 0 MC_SITE_ACT haCOUjO+Cyd9fm63Iqen/g==-Lg8pURhxDCvm62j/xtsNJGqZKNuOQIBL |
| 30 | +ab.classic.webmail.aol.com FALSE / FALSE 0 AOL-AB 2ffbbcc2eb02ce531e30b2f3ae98ad5d9ca51834069183c66d5cd97fd19d9e43d2f094c185ecf675 |
Index: trunk/extensions/InviteContacts/getmycontacts/icqcookie.txt |
Index: trunk/extensions/InviteContacts/getmycontacts/myexpress.php |
— | — | @@ -0,0 +1,169 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * CSV - Outlook contact importing script |
| 5 | + */ |
| 6 | + |
| 7 | +$get = 'myexpress'; |
| 8 | + |
| 9 | +// START OF FILE UPLOAD AND SECURITY CHECK |
| 10 | + |
| 11 | +$limit_size = 2000000; // you can change this to a higher file size limit (this is in bytes = 2MB apprx) |
| 12 | + |
| 13 | +$random = rand( 150, 15000 ); //create random number |
| 14 | +$uniquename = $random . $HTTP_POST_FILES['ufile']['name']; // add random number to file name to create unique file |
| 15 | +$path = 'upload/' . $uniquename; |
| 16 | + |
| 17 | +if( $ufile != null ) { |
| 18 | + // Store upload file size in $file_size |
| 19 | + $file_size = $HTTP_POST_FILES['ufile']['size']; |
| 20 | + |
| 21 | + if( $file_size >= $limit_size ) { |
| 22 | + echo '<p align="center"><font face="Verdana" size="2"><b>Error!:</b> Your file exceeds the allowed size limit.</font></p><p align="center">'; |
| 23 | + exit; |
| 24 | + } else { |
| 25 | + $filetype = $HTTP_POST_FILES['ufile']['type']; |
| 26 | + |
| 27 | + if( |
| 28 | + $filetype == 'application/vnd.ms-excel' || |
| 29 | + $filetype == 'application/x-csv' || |
| 30 | + $filetype == 'text/csv' |
| 31 | + ) { |
| 32 | + // copy file to where you want to store file |
| 33 | + if( copy( $HTTP_POST_FILES['ufile']['tmp_name'], $path ) ) { |
| 34 | + } else { |
| 35 | + echo 'Copy Error'; |
| 36 | + exit; |
| 37 | + } |
| 38 | + } else { |
| 39 | + echo '<p align="center"><font face="Verdana" size="2"><b>Error!:</b> You may only upload csv files.</font></p><p align="center">'; |
| 40 | + exit; |
| 41 | + } |
| 42 | + } |
| 43 | +} |
| 44 | +// End of file upload |
| 45 | + |
| 46 | + |
| 47 | +$header = <<<headertext |
| 48 | + |
| 49 | +<html> |
| 50 | +<head> |
| 51 | +<title>CONTACTS</title> |
| 52 | +<script type="text/javascript" src="../js/SelectAll.js"></script> |
| 53 | +</head> |
| 54 | +<body> |
| 55 | + |
| 56 | +headertext; |
| 57 | + |
| 58 | + echo $header; |
| 59 | + |
| 60 | +// [RESULTS -TITLE HTML] |
| 61 | + |
| 62 | +$title = <<<titletext |
| 63 | + |
| 64 | +<body> |
| 65 | +<div align="center"> |
| 66 | +<center> |
| 67 | +<table border="0" width="578"> |
| 68 | +<tr> |
| 69 | +<td width="622"><img height="2" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 70 | +</tr> |
| 71 | +<tr> |
| 72 | +<td align="middle" width="622"><table cellspacing="0" cellpadding="0" width="640" border="0"> |
| 73 | +<tbody> |
| 74 | +<tr> |
| 75 | +<td width="5" height="5"><img height="5" alt="" src="../images/tls.gif" width="5" border="0" /></td> |
| 76 | +<td background="../images/t.gif" colspan=2 width="716"><img height=1 alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 77 | +<td width="6" height="5"><img height=5 alt="" src="../images/trs.gif" width="5" border="0"></td> |
| 78 | +</tr> |
| 79 | +<tr> |
| 80 | +<td width="5" background="../images/l.gif" height="5"><img height="5" alt="" src="../images/spacer.gif" width="5" border="0" /></td> |
| 81 | +<td width="6"><img height=1 alt="" src="../images/spacer.gif" width="6" border="0" /></td> |
| 82 | +<td valign="top" width="704"> |
| 83 | +<table border="0" width="100%"> |
| 84 | +<tr> |
| 85 | +<td width="100%" bgcolor="#D7D8DF"> |
| 86 | +<p align="center"><font face="Arial" size="3" color="#333333">My Contacts</font> |
| 87 | +</td> |
| 88 | +</tr> |
| 89 | +</table> |
| 90 | +<p align="center"> |
| 91 | + |
| 92 | +titletext; |
| 93 | + |
| 94 | + echo $title; |
| 95 | + |
| 96 | +// [RESULTS - START OF FORM] |
| 97 | + |
| 98 | + echo '<form id="form_id" name="myform" method="post" action="">'; |
| 99 | + echo '<div align="center"><center><table border="0" cellpadding="3" cellspacing="6" width="100%">'; |
| 100 | + |
| 101 | +// OPENING THE STORED CSV FILE AND TURING IT INTO AN ARRAY |
| 102 | + |
| 103 | + $fp = fopen( $path, 'r' ); |
| 104 | + |
| 105 | + while( !feof( $fp ) ) { |
| 106 | + $data = fgetcsv( $fp, 4100, ',' ); // this uses the fgetcsv function to store the quote info in the array $data |
| 107 | + $dataname = $data[0]; |
| 108 | + |
| 109 | + if( empty( $dataname ) ) { |
| 110 | + $dataname = $data[1]; |
| 111 | + } |
| 112 | + |
| 113 | + if( empty( $dataname ) ) { |
| 114 | + $dataname = $data[2]; |
| 115 | + } |
| 116 | + |
| 117 | + if( empty( $dataname ) ) { |
| 118 | + $dataname = 'None'; |
| 119 | + } |
| 120 | + |
| 121 | + $email = $data[5]; // different csv to lycos and yahoo etc |
| 122 | + |
| 123 | + if( empty( $email ) ) { |
| 124 | + // Skip table |
| 125 | + } else { |
| 126 | + $email = $data[5]; |
| 127 | + if( $dataname == 'None' ) { |
| 128 | + $dataname = $email; |
| 129 | + } |
| 130 | + |
| 131 | + if( $dataname != 'First Name' ) { |
| 132 | + echo '<tr> |
| 133 | + <td width="22" bgcolor="#F5F5F5"><input type="checkbox" name="list[]" value="' . $email . '" checked="checked" /></td> |
| 134 | + <td width="269" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $dataname . '</font></td> |
| 135 | + <td width="296" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $email . '</font></td> |
| 136 | + <input type="hidden" name="sendersemail" size="20" value="' . $fullemail . '"> |
| 137 | + </tr>'; |
| 138 | + } |
| 139 | + } |
| 140 | + } |
| 141 | + echo '</table></center></div>'; |
| 142 | + |
| 143 | +$footer = <<<footertext |
| 144 | + |
| 145 | +<table border="0" width="100%"> |
| 146 | +<tr> |
| 147 | +<td width="100%"> |
| 148 | +<p align="center"><input type="submit" value="Send Email To Contacts" name="B1" style="background-color: #808080; color: #FFFFFF; font-family: Arial; font-size: 10pt; font-weight: bold; border: 1 solid #333333"></p> |
| 149 | +</form> |
| 150 | +</td> |
| 151 | +</tr> |
| 152 | +</table><img height=1 alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 153 | +<td width="6" background="../images/r.gif" height="5"><img height=1 alt="" src="../images/spacer.gif" width="1" border="0" /></td></tr> |
| 154 | +<tr><td width="5" height="5"><img height="5" alt="" src="../images/bls.gif" width="5" border="0" /></td> |
| 155 | +<td background="../images/b.gif" colspan=2 width="716"><img height=1 alt="" src="../images/spacer.gif" width=1 border=0></td> |
| 156 | +<td width="6" height="5"><img height="5" alt="" src="../images/brs.gif" width="5" border="0" /></td> |
| 157 | +</tr> |
| 158 | +</tbody> |
| 159 | +</table> |
| 160 | +</td> |
| 161 | +</tr> |
| 162 | +</table> |
| 163 | +</center></div> |
| 164 | +</body></html> |
| 165 | + |
| 166 | +footertext; |
| 167 | + |
| 168 | + echo $footer; |
| 169 | + |
| 170 | + unlink( $path ); // deleting csv file |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/mygmail.php |
— | — | @@ -0,0 +1,235 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * GMail contact importing script |
| 5 | + */ |
| 6 | + |
| 7 | +$username = $_POST['username']; |
| 8 | + |
| 9 | +$password = $_POST['password']; |
| 10 | + |
| 11 | +$refering_site = 'http://mail.google.com/mail/'; // setting the site for refer |
| 12 | + |
| 13 | +$browser_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7'; //setting browser type |
| 14 | + |
| 15 | +$path_to_username = '/tmp/' . substr( sha1( $username ), 0, 10 ); |
| 16 | +$path_to_cookie = $path_to_username . '.cookie'; |
| 17 | + |
| 18 | +$form_language = $_REQUEST['language']; |
| 19 | + |
| 20 | +include_once( dirname( __FILE__ ) . '/getmycontactsbase.php' ); |
| 21 | + |
| 22 | +$setcookie = fopen( $path_to_cookie, 'wb' ); // this opens the file and resets it to zero length |
| 23 | +fclose( $setcookie ); |
| 24 | + |
| 25 | +echo '<body background="../images/loading.gif">'; |
| 26 | + |
| 27 | +function curl_get( $url, $follow, $debug ) { |
| 28 | + global $path_to_cookie, $browser_agent; |
| 29 | + |
| 30 | + $ch = curl_init(); |
| 31 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 32 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 33 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 34 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 35 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 36 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 37 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, $follow ); |
| 38 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 39 | + $result = curl_exec( $ch ); |
| 40 | + curl_close( $ch ); |
| 41 | + |
| 42 | + if( $debug == 1 ) { |
| 43 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 44 | + } |
| 45 | + |
| 46 | + if( $debug == 2 ) { |
| 47 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 48 | + echo $result; |
| 49 | + } |
| 50 | + |
| 51 | + return $result; |
| 52 | +} |
| 53 | + |
| 54 | +function curl_post( $url, $postal_data, $follow, $debug ) { |
| 55 | + global $path_to_cookie, $browser_agent; |
| 56 | + |
| 57 | + $ch = curl_init(); |
| 58 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 59 | + curl_setopt( $ch, CURLOPT_POST, 1 ); |
| 60 | + curl_setopt( $ch, CURLOPT_POSTFIELDS, $postal_data ); |
| 61 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 62 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 63 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 64 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 65 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 66 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, $follow ); |
| 67 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 68 | + |
| 69 | + $result = curl_exec( $ch ); |
| 70 | + curl_close( $ch ); |
| 71 | + |
| 72 | + if( $debug == 1 ) { |
| 73 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 74 | + } |
| 75 | + |
| 76 | + if( $debug == 2 ) { |
| 77 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 78 | + echo $result; |
| 79 | + } |
| 80 | + |
| 81 | + return $result; |
| 82 | +} |
| 83 | + |
| 84 | +// Step 1 |
| 85 | +$url = 'http://mail.google.com/mail/'; |
| 86 | +$page_result = curl_get( $url, 1, 0 ); |
| 87 | + |
| 88 | +// Step 2 |
| 89 | +$postal_data = 'ltmpl=yj_blanco<mplcache=2&continue=http%3A%2F%2Fmail.google.com%2Fmail%3F&service=mail&rm=false<mpl=yj_blanco&Email=' . $username . '&Passwd=' . $password . '&rmShown=1&null=Sign+in'; |
| 90 | +$url = 'https://www.google.com/accounts/ServiceLoginAuth'; |
| 91 | +$result = curl_post( $url, $postal_data, 1, 0 ); |
| 92 | +// [pick up forwarding url] |
| 93 | +preg_match_all( "/location.replace.\"(.*?)\"/", $result, $matches ); |
| 94 | +$matches = $matches[1][0]; |
| 95 | + |
| 96 | +// Step 3 |
| 97 | +$url = $matches; |
| 98 | +$result = curl_get( $url, 1, 0 ); |
| 99 | + |
| 100 | +// Step 4 -- HTML only |
| 101 | +$url = 'http://mail.google.com/mail/?ui=html&zy=n'; |
| 102 | +$result = curl_get( $url, 1, 0 ); |
| 103 | +preg_match_all( '/base href="(.*?)"/', $result, $matches ); |
| 104 | +if( !empty( $matches ) && is_array( $matches ) ) { |
| 105 | + if( is_array( $matches[1] ) ) { |
| 106 | + $matches = $matches[1][0]; |
| 107 | + } |
| 108 | +} |
| 109 | + |
| 110 | +// Step 5 -- open export contacts page |
| 111 | +$url = 'https://mail.google.com/mail/?ik=&view=sec&zx='; |
| 112 | +$result = curl_get( $url, 1, 0 ); |
| 113 | + |
| 114 | +preg_match_all( "/value=\"(.*?)\"/", $result, $matches ); |
| 115 | +$matches = $matches[1][0]; |
| 116 | + |
| 117 | +// Step 6 -- download csv |
| 118 | +$postal_data = 'at=' . $matches . '&ecf=o&ac=Export Contacts'; |
| 119 | +$url = 'https://mail.google.com/mail/?view=fec'; |
| 120 | + |
| 121 | +$result = ( curl_post( $url, $postal_data, 1, 0 ) ); |
| 122 | + |
| 123 | +if( empty( $result ) ) { |
| 124 | + echo '<p align="center"><font face="Verdana" size="2"><b>' . $messages['no_details_found'] . ':</b> ' . $messages['makesurecorrectlogin'] . '</font></p><p align="center">'; |
| 125 | +} else { |
| 126 | + // Writing output to csv file |
| 127 | + $myFile = $path_to_username; |
| 128 | + $fh = fopen( $myFile, 'w' ) or die( "{$myFile} can't open file" ); |
| 129 | + fwrite( $fh, $result ); |
| 130 | + fclose( $fh ); |
| 131 | + |
| 132 | +// Start of HTML |
| 133 | + |
| 134 | +// [header section - html] |
| 135 | + |
| 136 | +$header = <<<headertext |
| 137 | + |
| 138 | +<html> |
| 139 | +<head> |
| 140 | +<title>{$messages['my_contacts']}</title> |
| 141 | +<script type="text/javascript" src="../js/SelectAll.js"></script> |
| 142 | +</head> |
| 143 | +<body> |
| 144 | + |
| 145 | +headertext; |
| 146 | + |
| 147 | + // [RESULTS - START OF FORM] |
| 148 | + echo '<form id="form_id" name="myform" method="post" action="">'; |
| 149 | + |
| 150 | + echo '<h1>Your contacts</h1> |
| 151 | + <p class="contacts-message"> |
| 152 | + <span class="profile-on">' . $messages['sharefriends'] . '</span> |
| 153 | + </p> |
| 154 | + <p class="contacts-message"> |
| 155 | + <input type="submit" value="' . $messages['inviteyourfriends'] . '" name="B1" /> |
| 156 | + <a href="javascript:toggleChecked()">' . $messages['uncheckall'] . '</a> |
| 157 | + </p> |
| 158 | + <div class="contacts-title-row"> |
| 159 | + <p class="contacts-checkbox"></p> |
| 160 | + <p class="contacts-title">' |
| 161 | + . $messages['friendname'] . |
| 162 | + '</p> |
| 163 | + <p class="contacts-title">' |
| 164 | + . $messages['emailtitle'] . |
| 165 | + '</p> |
| 166 | + <div class="cleared"></div> |
| 167 | + </div> |
| 168 | + <div class="contacts">'; |
| 169 | + |
| 170 | + // Opening csv file for processing |
| 171 | + $fp = fopen( $path_to_username, 'r' ); |
| 172 | + while( !feof( $fp ) ) { |
| 173 | + $data = fgetcsv( $fp, 0, ',' ); // this uses the fgetcsv function to store the quote info in the array $data |
| 174 | + $email = $dataname = ''; |
| 175 | + if( !empty( $data ) && !empty( $data[0] ) ) { |
| 176 | + $dataname = $data[0]; |
| 177 | + } |
| 178 | + if( !empty( $data ) && !empty( $data[1] ) ) { |
| 179 | + $email = $data[1]; |
| 180 | + } |
| 181 | + if( !$dataname ) { |
| 182 | + $dataname = $email; |
| 183 | + } |
| 184 | + if( !empty( $email ) && $dataname != 'Name' ) { // Skip table if email is blank |
| 185 | + $addresses[] = array( |
| 186 | + 'name' => $dataname, |
| 187 | + 'email' => $email |
| 188 | + ); |
| 189 | + } |
| 190 | + } |
| 191 | + |
| 192 | + if( $addresses ) { |
| 193 | + usort( $addresses, 'sortContacts' ); |
| 194 | + |
| 195 | + foreach( $addresses as $address ) { |
| 196 | + echo '<div class="contacts-row"> |
| 197 | + <p class="contacts-checkbox"> |
| 198 | + <input type="checkbox" name="list[]" value="' . $address['email'] . '" checked="checked" /> |
| 199 | + </p> |
| 200 | + <p class="contacts-cell">' |
| 201 | + . $address['name'] . |
| 202 | + '</p> |
| 203 | + <p class="contacts-cell">' |
| 204 | + . $address['email'] . |
| 205 | + '</p> |
| 206 | + <input type="hidden" name="sendersemail" size="20" value="' . $username . '" /> |
| 207 | + <div class="cleared"></div> |
| 208 | + </div>'; |
| 209 | + } |
| 210 | + } |
| 211 | + |
| 212 | + echo '</div>'; |
| 213 | + |
| 214 | +$footer = <<<footertext |
| 215 | + |
| 216 | +<p> |
| 217 | +<input type="submit" value="{$messages['inviteyourfriends']}" name="B1" /> <a href="javascript:toggleChecked()">{$messages['uncheckall']}</a> |
| 218 | +</p> |
| 219 | +</form> |
| 220 | + |
| 221 | +footertext; |
| 222 | + |
| 223 | + echo $footer; |
| 224 | + |
| 225 | + unlink( $path_to_username ); // deleting csv file |
| 226 | +} |
| 227 | + |
| 228 | +function sortContacts( $x, $y ) { |
| 229 | + if ( strtoupper( $x['name'] ) == strtoupper( $y['name'] ) ) { |
| 230 | + return 0; |
| 231 | + } elseif ( strtoupper( $x['name'] ) < strtoupper( $y['name'] ) ) { |
| 232 | + return -1; |
| 233 | + } else { |
| 234 | + return 1; |
| 235 | + } |
| 236 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/mylycos.php |
— | — | @@ -0,0 +1,228 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Lycos contact importing script -- csv version |
| 5 | + */ |
| 6 | + |
| 7 | +$username = $_POST['username']; |
| 8 | + |
| 9 | +$password = $_POST['password']; |
| 10 | + |
| 11 | +$refering_site = 'http://mail.lycos.com/lycos/Index.lycos'; // setting the site for refer |
| 12 | + |
| 13 | +$browser_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)'; // setting browser type |
| 14 | + |
| 15 | +$path_to_cookie = realpath( 'lycoscookie.txt' ); |
| 16 | + |
| 17 | +$setcookie = fopen( $path_to_cookie, 'wb' ); // this opens the file and resets it to zero length |
| 18 | +fclose( $setcookie ); |
| 19 | + |
| 20 | +function curl_get( $url, $follow, $debug ) { |
| 21 | + global $path_to_cookie, $browser_agent; |
| 22 | + |
| 23 | + $ch = curl_init(); |
| 24 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 25 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 26 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 27 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 28 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 29 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 30 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, $follow ); |
| 31 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 32 | + $result = curl_exec( $ch ); |
| 33 | + curl_close( $ch ); |
| 34 | + |
| 35 | + if( $debug == 1 ) { |
| 36 | + echo "<textarea rows=30 cols=120>".$result."</textarea>"; |
| 37 | + } |
| 38 | + |
| 39 | + if( $debug == 2 ) { |
| 40 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 41 | + echo $result; |
| 42 | + } |
| 43 | + |
| 44 | + return $result; |
| 45 | +} |
| 46 | + |
| 47 | +function curl_post( $url, $postal_data, $follow, $debug ) { |
| 48 | + global $path_to_cookie, $browser_agent; |
| 49 | + |
| 50 | + $ch = curl_init(); |
| 51 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 52 | + curl_setopt( $ch, CURLOPT_POST, 1 ); |
| 53 | + curl_setopt( $ch, CURLOPT_POSTFIELDS, $postal_data ); |
| 54 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 55 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 56 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 57 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 58 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 59 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, $follow ); |
| 60 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 61 | + $result = curl_exec( $ch ); |
| 62 | + curl_close( $ch ); |
| 63 | + |
| 64 | + if( $debug == 1 ) { |
| 65 | + echo "<textarea rows=30 cols=120>".$result."</textarea>"; |
| 66 | + } |
| 67 | + |
| 68 | + if( $debug == 2 ) { |
| 69 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 70 | + echo $result; |
| 71 | + } |
| 72 | + |
| 73 | + return $result; |
| 74 | +} |
| 75 | + |
| 76 | +// Step 1 |
| 77 | +$url = 'http://mail.lycos.com/lycos/mail/MailLeftLogin.lycos'; |
| 78 | +$page_result = curl_get( $url, 1, 0 ); |
| 79 | + |
| 80 | +// Step 2 |
| 81 | +$postal_data = 'm_PR=27&m_CBURL=http://mail.lycos.com:80/lycos/Index.lycos&m_U=' . $username . '&m_P=' . $password . '&m_AS=1&x=23&y=8'; |
| 82 | +$url = 'http://ldbreg.lycos.com/cgi-bin/mayaLogin?m_PR=27'; |
| 83 | +$result = curl_post( $url, $postal_data, 1, 0 ); |
| 84 | + |
| 85 | +// Step 3 |
| 86 | +$url = 'http://mail.lycos.com/lycos/addrbook/ExportAddr.lycos?ptype=act&fileType=OUTLOOK'; |
| 87 | +$page_result = curl_get( $url, 1, 0 ); |
| 88 | + |
| 89 | +// Writing the results to a csv file on the server |
| 90 | +$myFile = $username; |
| 91 | +$fh = fopen( $myFile, 'w' ) or die( "can't open file" ); |
| 92 | +fwrite( $fh, $page_result ); |
| 93 | +fclose( $fh ); |
| 94 | + |
| 95 | +// Checking if login was successful -- by searching for the @ sign in the csv |
| 96 | +preg_match_all( "/@/", $page_result, $array_at ); |
| 97 | + |
| 98 | +$at_sign = $array_at[0]; |
| 99 | + |
| 100 | +if( empty( $at_sign ) ) { |
| 101 | + echo '<p align="center"><font face="Verdana" size="2"><b>No Details Found:</b> Please make sure you have entered correct login details and try again.</font></p><p align="center">'; |
| 102 | +} else { |
| 103 | + // Start of HTML |
| 104 | + // [header section - html] |
| 105 | + |
| 106 | +$header = <<<headertext |
| 107 | + |
| 108 | +<html> |
| 109 | +<head> |
| 110 | +<title>CONTACTS</title> |
| 111 | +<script type="text/javascript" src="../js/SelectAll.js"></script> |
| 112 | +</head> |
| 113 | +<body> |
| 114 | + |
| 115 | +headertext; |
| 116 | + |
| 117 | + echo $header; |
| 118 | + |
| 119 | +// [RESULTS -TITLE HTML] |
| 120 | + |
| 121 | +$title = <<<titletext |
| 122 | + |
| 123 | +<body> |
| 124 | +<div align="center"> |
| 125 | +<center> |
| 126 | +<table border="0" width="578"> |
| 127 | +<tr> |
| 128 | +<td width="622"><img height="2" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 129 | +</tr> |
| 130 | +<tr> |
| 131 | +<td align="middle" width="622"><table cellspacing="0" cellpadding="0" width="640" border="0"> |
| 132 | +<tbody> |
| 133 | +<tr> |
| 134 | +<td width="5" height="5"><img height="5" alt="" src="../images/tls.gif" width="5" border="0" /></td> |
| 135 | +<td background="../images/t.gif" colspan="2" width="716"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 136 | +<td width="6" height="5"><img height="5" alt="" src="../images/trs.gif" width="5" border="0" /></td> |
| 137 | +</tr> |
| 138 | +<tr> |
| 139 | +<td width="5" background="../images/l.gif" height="5"><img height="5" alt="" src="../images/spacer.gif" width="5" border="0" /></td> |
| 140 | +<td width="6"><img height="1" alt="" src="../images/spacer.gif" width="6" border="0" /></td> |
| 141 | +<td valign="top" width="704"> |
| 142 | +<table border="0" width="100%"> |
| 143 | +<tr> |
| 144 | +<td width="100%" bgcolor="#D7D8DF"> |
| 145 | +<p align="center"><font face="Arial" size="3" color="#333333">My Contacts</font> |
| 146 | +</td> |
| 147 | +</tr> |
| 148 | +</table> |
| 149 | +<p align="center"> |
| 150 | + |
| 151 | +titletext; |
| 152 | + |
| 153 | + echo $title; |
| 154 | + |
| 155 | + // [RESULTS - START OF FORM] |
| 156 | + echo '<form id="form_id" name="myform" method="post" action="">'; |
| 157 | + echo '<div align="center"><center><table border="0" cellpadding="3" cellspacing="6" width="100%">'; |
| 158 | + |
| 159 | + // Opening the stored csv file and turning it into an array |
| 160 | + $fp = fopen( $username, 'r' ); |
| 161 | + |
| 162 | + while( !feof( $fp ) ) { |
| 163 | + $data = fgetcsv( $fp, 4100, ',' ); // this uses the fgetcsv function to store the quote info in the array $data |
| 164 | + |
| 165 | + $dataname = $data[0]; |
| 166 | + |
| 167 | + if( empty( $dataname ) ) { |
| 168 | + $dataname = $data[2]; |
| 169 | + } |
| 170 | + |
| 171 | + if( empty( $dataname ) ) { |
| 172 | + $dataname = $data[3]; |
| 173 | + } |
| 174 | + |
| 175 | + if( empty( $dataname ) ) { |
| 176 | + $dataname = 'None'; |
| 177 | + } |
| 178 | + |
| 179 | + $email = $data[4]; |
| 180 | + |
| 181 | + if( empty( $email ) ) { |
| 182 | + // Skip table |
| 183 | + } else { |
| 184 | + $email = $data[4]; |
| 185 | + |
| 186 | + if( $dataname != 'First Name' ) { |
| 187 | + echo '<tr> |
| 188 | + <td width="22" bgcolor="#F5F5F5"><input type="checkbox" name="list[]" value="' . $email . '" checked="checked" /></td> |
| 189 | + <td width="269" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $dataname . '</font></td> |
| 190 | + <td width="296" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $email . '</font></td> |
| 191 | + <input type="hidden" name="sendersemail" size="20" value="' . $username . '" /> |
| 192 | + </tr>'; |
| 193 | + } |
| 194 | + } |
| 195 | + } |
| 196 | + echo '</table></center></div>'; |
| 197 | + |
| 198 | +$footer = <<<footertext |
| 199 | + |
| 200 | +<table border="0" width="100%"> |
| 201 | +<tr> |
| 202 | +<td width="100%"> |
| 203 | +<p align="center"><input type="submit" value="Send Email To Contacts" name="B1" style="background-color: #808080; color: #FFFFFF; font-family: Arial; font-size: 10pt; font-weight: bold; border: 1 solid #333333"></p> |
| 204 | +</form> |
| 205 | +</td> |
| 206 | +</tr> |
| 207 | +</table> |
| 208 | +<img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 209 | +<td width="6" background="../images/r.gif" height="5"><img height=1 alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 210 | +</tr> |
| 211 | +<tr> |
| 212 | +<td width="5" height="5"><img height="5" alt="" src="../images/bls.gif" width="5" border="0" /></td> |
| 213 | +<td background="../images/b.gif" colspan="2" width="716"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 214 | +<td width="6" height="5"><img height="5" alt="" src="../images/brs.gif" width="5" border="0" /></td> |
| 215 | +</tr> |
| 216 | +</tbody> |
| 217 | +</table> |
| 218 | +</td> |
| 219 | +</tr> |
| 220 | +</table> |
| 221 | +</center></div> |
| 222 | +</body></html> |
| 223 | + |
| 224 | +footertext; |
| 225 | + |
| 226 | + echo $footer; |
| 227 | +} |
| 228 | + |
| 229 | + unlink( $username ); //deleting csv file |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/postage.php |
— | — | @@ -0,0 +1,51 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$html_format = 'no'; //IMPORTANT: change this to "yes" ONLY if you are sending html format email |
| 5 | + |
| 6 | +//---------------------------------------------------------------------------------------------------------------------- |
| 7 | +// INSTRUCTION 1 |
| 8 | +// |
| 9 | +// IMPORTANT -- DO NOT DELETE <<<EOF and EOF; only edit the message in the middle. You can use HTML or plain text |
| 10 | +// If you use html remember to change the $html_format = "yes" above |
| 11 | +//---------------------------------------------------------------------------------------------------------------------- |
| 12 | + |
| 13 | +$message = <<<EOF |
| 14 | + |
| 15 | + |
| 16 | +Hello |
| 17 | + |
| 18 | +Your friend $sendersemail has invited you to join them at greatsite.com |
| 19 | + |
| 20 | +I hope to see you there soon!! |
| 21 | + |
| 22 | +GREATSITE.COM |
| 23 | + |
| 24 | +EOF; |
| 25 | + |
| 26 | +//-------------------------------------------------------------------------------------------------------------------------------- |
| 27 | +// INSTRUCTION 2 |
| 28 | +// |
| 29 | +// CHANGE THE SUBJECT LINE BELOW TO YOUR OWN SUBJECT FOR THE EMAIL and ALSO THE FROM EMAIL ADDRESS |
| 30 | +//-------------------------------------------------------------------------------------------------------------------------------- |
| 31 | +$subject = "You've got mail!"; |
| 32 | + |
| 33 | +$from = 'staff@shoutwiki.com'; |
| 34 | + |
| 35 | +$sendersemail = $_POST['sendersemail']; |
| 36 | + |
| 37 | +foreach( $_POST['list'] as $to ) { |
| 38 | + if( $html_format == 'yes' ) { |
| 39 | + $headers = "From: $from\n"; |
| 40 | + $headers .= "Reply-To: $from\n"; |
| 41 | + $headers .= "Return-Path: $from\n"; |
| 42 | + $headers .= "MIME-Version: 1.0\n"; |
| 43 | + $headers .= "Content-Type: text/html; charset=ISO-8859-1\n"; |
| 44 | + |
| 45 | + mail( $to, $subject, $message, $headers ); |
| 46 | + } else { |
| 47 | + mail( $to, $subject, $message, "From: $from" ); |
| 48 | + } |
| 49 | +} |
| 50 | +// [end of email sending] |
| 51 | + |
| 52 | +echo 'Messages have been sent'; |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/myoutlook.php |
— | — | @@ -0,0 +1,166 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * CSV - Outlook contact importing script |
| 5 | + */ |
| 6 | + |
| 7 | +// Start of file upload and security check |
| 8 | + |
| 9 | +$limit_size = 2000000; // you can change this to a higher file size limit (this is in bytes = 2MB apprx) |
| 10 | + |
| 11 | +$random = rand( 150, 15000 ); // create random number |
| 12 | +$uniquename = $random . $HTTP_POST_FILES['ufile']['name']; //add random number to file name to create unique file |
| 13 | +$path = 'upload/' . $uniquename; |
| 14 | +echo 'name:' . $HTTP_POST_FILES['ufile']['name']; |
| 15 | +if( $ufile != null ) { |
| 16 | + // Store upload file size in $file_size |
| 17 | + $file_size = $HTTP_POST_FILES['ufile']['size']; |
| 18 | + |
| 19 | + if( $file_size >= $limit_size ) { |
| 20 | + echo '<p align="center"><font face="Verdana" size="2"><b>Error!:</b> Your file exceeds the allowed size limit.</font></p><p align="center">'; |
| 21 | + exit; |
| 22 | + } else { |
| 23 | + $filetype = $HTTP_POST_FILES['ufile']['type']; |
| 24 | + echo 'type:' . $filetype; |
| 25 | + if( |
| 26 | + $filetype == 'application/vnd.ms-excel' || |
| 27 | + $filetype == 'application/x-csv' || |
| 28 | + $filetype == 'text/csv' |
| 29 | + ) { |
| 30 | + // Copy file to where you want to store file |
| 31 | + if( copy( $HTTP_POST_FILES['ufile']['tmp_name'], $path ) ) { |
| 32 | + } else { |
| 33 | + echo 'Copy Error'; |
| 34 | + exit; |
| 35 | + } |
| 36 | + } else { |
| 37 | + echo '<p align="center"><font face="Verdana" size="2"><b>Error!:</b> You may only upload csv files.</font></p><p align="center">'; |
| 38 | + exit; |
| 39 | + } |
| 40 | + } |
| 41 | +} |
| 42 | +// End of file upload |
| 43 | + |
| 44 | +$header = <<<headertext |
| 45 | + |
| 46 | +<html> |
| 47 | +<head> |
| 48 | +<title>CONTACTS</title> |
| 49 | +<script type="text/javascript" src="../js/SelectAll.js"></script> |
| 50 | +</head> |
| 51 | +<body> |
| 52 | + |
| 53 | +headertext; |
| 54 | + |
| 55 | + echo $header; |
| 56 | + |
| 57 | +// [RESULTS -TITLE HTML] |
| 58 | + |
| 59 | +$title = <<<titletext |
| 60 | + |
| 61 | +<body> |
| 62 | +<div align="center"> |
| 63 | +<center> |
| 64 | +<table border="0" width="578"> |
| 65 | +<tr> |
| 66 | +<td width="622"><img height="2" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 67 | +</tr> |
| 68 | +<tr> |
| 69 | +<td align="middle" width="622"> |
| 70 | +<table cellspacing="0" cellpadding="0" width="640" border="0"> |
| 71 | +<tbody> |
| 72 | +<tr> |
| 73 | +<td width="5" height="5"><img height="5" alt="" src="../images/tls.gif" width="5" border="0" /></td> |
| 74 | +<td background="../images/t.gif" colspan="2" width="716"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 75 | +<td width="6" height="5"><img height=5 alt="" src="../images/trs.gif" width=5 border=0></TD> |
| 76 | +</tr> |
| 77 | +<tr> |
| 78 | +<td width="5" background="../images/l.gif" height="5"><img height="5" alt="" src="../images/spacer.gif" width="5" border="0" /></td> |
| 79 | +<td width="6"><img height="1" alt="" src="../images/spacer.gif" width="6" border="0" /></td> |
| 80 | +<td valign="top" width="704"> |
| 81 | +<table border="0" width="100%"> |
| 82 | +<tr> |
| 83 | +<td width="100%" bgcolor="#D7D8DF"> |
| 84 | +<p align="center"><font face="Arial" size="3" color="#333333">My Contacts</font> |
| 85 | +</td> |
| 86 | +</tr> |
| 87 | +</table> |
| 88 | +<p align="center"> |
| 89 | + |
| 90 | +titletext; |
| 91 | + |
| 92 | + echo $title; |
| 93 | + |
| 94 | + // [RESULTS - START OF FORM] |
| 95 | + echo '<form id="form_id" name="myform" method="post" action="">'; |
| 96 | + echo '<div align="center"><center><table border="0" cellpadding="3" cellspacing="6" width="100%">'; |
| 97 | + |
| 98 | + // Opening the stored csv file and turning it into an array |
| 99 | + $fp = fopen( $path, 'r' ); |
| 100 | + |
| 101 | + while( !feof( $fp ) ) { |
| 102 | + $data = fgetcsv( $fp, 4100, ',' ); // this uses the fgetcsv function to store the quote info in the array $data |
| 103 | + |
| 104 | + $dataname = $data[1]; |
| 105 | + |
| 106 | + if( empty( $dataname ) ) { |
| 107 | + $dataname = $data[2]; |
| 108 | + } |
| 109 | + |
| 110 | + if( empty( $dataname ) ) { |
| 111 | + $dataname = $data[3]; |
| 112 | + } |
| 113 | + |
| 114 | + if( empty( $dataname ) ) { |
| 115 | + $dataname = 'None'; |
| 116 | + } |
| 117 | + |
| 118 | + $email = $data[1]; // different csv to lycos and yahoo etc |
| 119 | + |
| 120 | + if( empty( $email ) ) { |
| 121 | + // Skip table |
| 122 | + } else { |
| 123 | + $email = $data[57]; |
| 124 | + |
| 125 | + if( $dataname != 'First Name' ) { |
| 126 | + echo '<tr> |
| 127 | + <td width="22" bgcolor="#F5F5F5"><input type="checkbox" name="list[]" value="' . $email . '" checked="checked" /></td> |
| 128 | + <td width="269" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $dataname . '</font></td> |
| 129 | + <td width="296" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $email . '</font></td> |
| 130 | + <input type="hidden" name="sendersemail" size="20" value="' . $fullemail . '" /> |
| 131 | + </tr>'; |
| 132 | + } |
| 133 | + } |
| 134 | + } |
| 135 | + echo '</table></center></div>'; |
| 136 | + |
| 137 | +$footer = <<<footertext |
| 138 | + |
| 139 | +<table border="0" width="100%"> |
| 140 | +<tr> |
| 141 | +<td width="100%"> |
| 142 | +<p align="center"><input type="submit" value="Send Email To Contacts" name="B1" style="background-color: #808080; color: #FFFFFF; font-family: Arial; font-size: 10pt; font-weight: bold; border: 1 solid #333333"></p> |
| 143 | +</form> |
| 144 | +</td> |
| 145 | +</tr> |
| 146 | +</table> |
| 147 | +<img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 148 | +<td width="6" background="../images/r.gif" height="5"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 149 | +</tr> |
| 150 | +<tr> |
| 151 | +<td width="5" height="5"><img height="5" alt="" src="../images/bls.gif" width="5" border="0" /></td> |
| 152 | +<td background="../images/b.gif" colspan="2" width="716"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 153 | +<td width="6" height="5"><img height="5" alt="" src="../images/brs.gif" width="5" border="0"></td> |
| 154 | +</tr> |
| 155 | +</tbody> |
| 156 | +</table> |
| 157 | +</td> |
| 158 | +</tr> |
| 159 | +</table> |
| 160 | +</center></div> |
| 161 | +</body></html> |
| 162 | + |
| 163 | +footertext; |
| 164 | + |
| 165 | + echo $footer; |
| 166 | + |
| 167 | + unlink( $path ); // deleting csv file |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/getmycontacts.i18n.php |
— | — | @@ -0,0 +1,37 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalisation file for the GetMyContacts extension. |
| 5 | + * |
| 6 | + * @ingroup Extensions |
| 7 | + */ |
| 8 | + |
| 9 | +function efGetMyContacts() { |
| 10 | + return array( |
| 11 | +/** English |
| 12 | + */ |
| 13 | +'en' => array( |
| 14 | +'no_details_found' => 'No Details Found', |
| 15 | +'makesurecorrectlogin' => 'Please make sure you have entered correct login details and try again.', |
| 16 | +'my_contacts' => 'My Contacts', |
| 17 | +'sharefriends' => 'Share ShoutWiki with your friends. They will thank you. The more friends you invite, the less bored you will be.', |
| 18 | +'inviteyourfriends' => 'Invite Your Friends', |
| 19 | +'uncheckall' => 'uncheck all', |
| 20 | +'friendname' => 'Friend\'s Name', |
| 21 | +'emailtitle' => 'Email', |
| 22 | +), |
| 23 | + |
| 24 | +/** Finnish (Suomi) |
| 25 | + * @author Jack Phoenix |
| 26 | + */ |
| 27 | +'fi' => array( |
| 28 | +'no_details_found' => 'Yhteystietoja ei löytynyt', //TODO: context, anyone? |
| 29 | +'makesurecorrectlogin' => 'Ole hyvä ja varmista, että olet antanut oikeat käyttäjätiedot ja yritä uudelleen.', |
| 30 | +'my_contacts' => 'Yhteystietoni', |
| 31 | +'sharefriends' => 'Jaa ShoutWiki ystäviesi kanssa. He kiittävät sinua. Mitä enemmän ystäviä kutsut, sitä vähemmän tylsistyneempi tulet olemaan.', |
| 32 | +'inviteyourfriends' => 'Kutsu ystäväsi', |
| 33 | +'uncheckall' => 'poista valinta kaikista', |
| 34 | +'friendname' => 'Ystävän nimi', |
| 35 | +'emailtitle' => 'Sähköpostiosoite', |
| 36 | +), |
| 37 | + ); |
| 38 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/myhotmail.php |
— | — | @@ -0,0 +1,213 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Hotmail contact importing script |
| 5 | + */ |
| 6 | + |
| 7 | +$username = $_POST['username']; |
| 8 | + |
| 9 | +$password = $_POST['password']; |
| 10 | + |
| 11 | +$refering_site = 'http://mail.hotmail.com/'; //setting the site for refer |
| 12 | + |
| 13 | +$browser_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)'; //setting browser type |
| 14 | + |
| 15 | +$path_to_cookie = realpath( 'hotmailcookie.txt' ); |
| 16 | + |
| 17 | +$setcookie = fopen( $path_to_cookie, 'wb' ); // this opens the file and resets it to zero length |
| 18 | +fclose( $setcookie ); |
| 19 | + |
| 20 | +$form_language = $_REQUEST['language']; |
| 21 | + |
| 22 | +include_once( dirname( __FILE__ ) . '/getmycontactsbase.php' ); |
| 23 | + |
| 24 | +function curl_get( $url, $follow, $debug ) { |
| 25 | + global $path_to_cookie, $browser_agent; |
| 26 | + |
| 27 | + $ch = curl_init(); |
| 28 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 29 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 30 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 31 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 32 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 33 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 34 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, $follow ); |
| 35 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 36 | + $result = curl_exec( $ch ); |
| 37 | + curl_close( $ch ); |
| 38 | + |
| 39 | + if( $debug == 1 ) { |
| 40 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 41 | + } |
| 42 | + |
| 43 | + if( $debug == 2 ) { |
| 44 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 45 | + echo $result; |
| 46 | + } |
| 47 | + |
| 48 | + return $result; |
| 49 | +} |
| 50 | + |
| 51 | +function curl_post( $url, $postal_data, $follow, $debug ) { |
| 52 | + global $path_to_cookie, $browser_agent; |
| 53 | + |
| 54 | + $ch = curl_init(); |
| 55 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 56 | + curl_setopt( $ch, CURLOPT_POST, 1 ); |
| 57 | + curl_setopt( $ch, CURLOPT_POSTFIELDS, $postal_data ); |
| 58 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 59 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 60 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 61 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 62 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 63 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, $follow ); |
| 64 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 65 | + $result = curl_exec( $ch ); |
| 66 | + curl_close( $ch ); |
| 67 | + |
| 68 | + if( $debug == 1 ) { |
| 69 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 70 | + } |
| 71 | + |
| 72 | + if( $debug == 2 ) { |
| 73 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 74 | + echo $result; |
| 75 | + } |
| 76 | + |
| 77 | + return $result; |
| 78 | +} |
| 79 | + |
| 80 | +// Step 1 |
| 81 | +$url = 'http://login.live.com/login.srf?id=2&vv=400&lc=1033'; |
| 82 | +$page_result = curl_get( $url, 1, 0 ); |
| 83 | +preg_match_all( "/name=\"PPFT\" id=\"i0327\" value=\"(.*?)\"/", $page_result, $matches1 ); |
| 84 | +$found1 = $matches1[1][0]; |
| 85 | +preg_match_all( "/name=\"PPSX\" value=\"(.*?)\"/", $page_result, $matches2 ); |
| 86 | +$found2 = $matches2[1][0]; |
| 87 | +preg_match_all( "/name=\"PwdPad\" id=\"i0340\" value=\"(.*?)\"/", $page_result, $matches3 ); |
| 88 | +$found3 = $matches3[1][0]; |
| 89 | +preg_match_all( "/method=\"POST\" target=\"_top\" action=\"(.*?)\"/", $page_result, $matches4 ); |
| 90 | +$found4 = $matches4[1][0]; |
| 91 | +preg_match_all( "/name=\"LoginOptions\" id=\"i0136\" value=\"(.*?)\"/", $page_result, $matches5 ); |
| 92 | +$found5 = $matches5[1][0]; |
| 93 | + |
| 94 | +// Step 2 |
| 95 | +$postal_data = 'PPSX=' . $found2 . '&' . 'PwdPad=' . $found3 . '&' . 'login=' . $username . '&' . 'passwd=' . $password . '&' . 'LoginOptions=' . $found5 . '&' . 'PPFT=' . $found1; |
| 96 | +$url = $found4; |
| 97 | +$result = curl_post( $url, $postal_data, 1, 0 ); |
| 98 | + |
| 99 | +preg_match_all( "/replace\(\"(.*?)\"/", $result, $matches ); |
| 100 | +$matches = $matches[1][0]; |
| 101 | + |
| 102 | +// Step 3 |
| 103 | +$url = $matches; |
| 104 | +$result = curl_get( $url, 1, 0 ); |
| 105 | + |
| 106 | +// Step 4 -- open adress picker |
| 107 | +$url = 'http://by101fd.bay101.hotmail.msn.com/cgi-bin/AddressPicker?Context=InsertAddress&_HMaction=Edit&qF=to'; |
| 108 | +$result = curl_get( $url, 1, 0 ); |
| 109 | +preg_match_all( |
| 110 | + '%<option[^>]*value="([^"]*)"[^>]*>([^<]*)<[^>]*></option>%', |
| 111 | + $result, |
| 112 | + $matches, |
| 113 | + PREG_SET_ORDER |
| 114 | +); |
| 115 | +$arraycount = count( $matches ); |
| 116 | +$checkarray = $matches[1][1]; |
| 117 | + |
| 118 | +// If no results, try livemail |
| 119 | +if( empty( $checkarray ) ) { |
| 120 | + require 'mylive.php'; // This gets mylive.php file and runs it instead. |
| 121 | +} else { |
| 122 | + |
| 123 | +// Start of HTML |
| 124 | +// [header section - html] |
| 125 | + |
| 126 | +$header = <<<headertext |
| 127 | + |
| 128 | +<html> |
| 129 | +<head> |
| 130 | +<title>{$messages['my_contacts']}</title> |
| 131 | +<script type="text/javascript" src="../js/SelectAll.js"></script> |
| 132 | +</head> |
| 133 | +<body> |
| 134 | + |
| 135 | +headertext; |
| 136 | + |
| 137 | +// [RESULTS - START OF FORM] |
| 138 | +echo '<form id="form_id" name="myform" method="post" action="">'; |
| 139 | + |
| 140 | + echo '<h1>Your contacts</h1> |
| 141 | + <p class="contacts-message"> |
| 142 | + <span class="profile-on">' . $messages['sharefriends'] . '.</span> |
| 143 | + </p> |
| 144 | + <p class="contacts-message"> |
| 145 | + <input type="submit" class="invite-form-button" value="' . $messages['inviteyourfriends'] . '" name="B1" /> |
| 146 | + <a href="javascript:toggleChecked()">' . $messages['uncheckall'] . '</a> |
| 147 | + </p> |
| 148 | + <div class="contacts-title-row"> |
| 149 | + <p class="contacts-checkbox"></p> |
| 150 | + <p class="contacts-title">' |
| 151 | + . $messages['friendname'] . |
| 152 | + '</p> |
| 153 | + <p class="contacts-title">' |
| 154 | + . $messages['emailtitle'] . |
| 155 | + '</p> |
| 156 | + <div class="cleared"></div> |
| 157 | + </div> |
| 158 | + <div class="contacts">'; |
| 159 | + |
| 160 | + $i = 0; |
| 161 | + while( isset( $matches[$i] ) ): |
| 162 | + // [RESULTS - START OF CONTACTS LIST] |
| 163 | + |
| 164 | + echo '<div class="contacts-row"> |
| 165 | + <p class="contacts-checkbox"> |
| 166 | + <input type="checkbox" name="list[]" value="' . $matches[$i][1] . '" checked="checked" /> |
| 167 | + </p> |
| 168 | + <p class="contacts-cell">' |
| 169 | + . $matches[$i][2] . |
| 170 | + '</p> |
| 171 | + <p class="contacts-cell">' |
| 172 | + . $matches[$i][1] . |
| 173 | + '</p> |
| 174 | + <input type="hidden" name="sendersemail" size="20" value="' . $username . '" /> |
| 175 | + <div class="cleared"></div> |
| 176 | + </div>'; |
| 177 | + |
| 178 | + $i++; |
| 179 | + endwhile; |
| 180 | + |
| 181 | +// [RESULTS - START OF FOOTER] |
| 182 | + |
| 183 | +echo '</div>'; |
| 184 | + |
| 185 | +$footer = <<<footertext |
| 186 | + |
| 187 | +<table border="0" width="100%"> |
| 188 | +<tr> |
| 189 | +<td width="100%"> |
| 190 | +<p align="center"><font face="Arial" size="2"><br /></font><br /> |
| 191 | +<p></p> |
| 192 | +<p align="center"><input type="submit" value="{$messages['inviteyourfriends']}" name="B1" style="background-color: #808080; color: #FFFFFF; font-family: Arial; font-size: 10pt; font-weight: bold; border: 1 solid #333333"></p> |
| 193 | +</form> |
| 194 | +</td> |
| 195 | +</tr> |
| 196 | +</table> |
| 197 | +<img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /> |
| 198 | +</td> |
| 199 | +<td width="6" background="../images/r.gif" height="5"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 200 | +</tr> |
| 201 | +<tr> |
| 202 | +<td width="5" height="5"><img height="5" alt="" src="../images/bls.gif" width="5" border="0" /></td> |
| 203 | +<td background="../images/b.gif" colspan="2" width="716"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 204 | +<td width="6" height="5"><img height=5 alt="" src="../images/brs.gif" width="5" border="0" /></td> |
| 205 | +</tr> |
| 206 | +</tbody></table> |
| 207 | +</td> |
| 208 | +</tr> |
| 209 | +</table></center></div> |
| 210 | + |
| 211 | +footertext; |
| 212 | + |
| 213 | +echo $footer; |
| 214 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/mailcookie.txt |
Index: trunk/extensions/InviteContacts/getmycontacts/mylive.php |
— | — | @@ -0,0 +1,197 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Hotmail Live contact importing script |
| 5 | + */ |
| 6 | + |
| 7 | +$username = $_POST['username']; |
| 8 | + |
| 9 | +$password = $_POST['password']; |
| 10 | + |
| 11 | +$refering_site = 'http://mail.live.com/'; // setting the site for refer |
| 12 | + |
| 13 | +$browser_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)'; // setting browser type |
| 14 | + |
| 15 | +$path_to_cookie = realpath( 'livecookie.txt' ); |
| 16 | + |
| 17 | +$setcookie = fopen( $path_to_cookie, 'wb' ); //this opens the file and resets it to zero length |
| 18 | +fclose( $setcookie ); |
| 19 | + |
| 20 | +// Step 1 |
| 21 | +$url = 'http://login.live.com/login.srf?id=64855'; |
| 22 | +$page_result = curl_get( $url, 1, 0 ); |
| 23 | +preg_match_all( "/name=\"PPFT\" id=\"i0327\" value=\"(.*?)\"/", $page_result, $matches1 ); |
| 24 | +$found1 = $matches1[1][0]; |
| 25 | +preg_match_all( "/srf_uPost='(.*?)';var/", $page_result, $matches2 ); |
| 26 | +$found2 = $matches2[1][0]; |
| 27 | + |
| 28 | + |
| 29 | +// Step 2 |
| 30 | +$postal_data = 'idsbho=1&PwdPad=IfYouAreReadingThisYouHaveTooMuc&LoginOptions=3&login=' . $username . '&passwd=' . $password . '&NewUser=1&PPFT=' . $found1; |
| 31 | +$url = $found2; |
| 32 | +$result = curl_post( $url, $postal_data, 1, 0 ); |
| 33 | +// [pick up forwarding url] |
| 34 | +preg_match_all( "/replace\(\"(.*?)\"/", $result, $matches ); |
| 35 | +$found3 = $matches[1][0]; |
| 36 | + |
| 37 | +// Step 3 |
| 38 | + $ch = curl_init(); |
| 39 | + curl_setopt( $ch, CURLOPT_URL, $found3 ); |
| 40 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 41 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 42 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 43 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 44 | + curl_setopt( $ch, CURLOPT_REFERER, $login_page2 ); |
| 45 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 46 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 47 | + $page_result = curl_exec( $ch ); |
| 48 | + curl_close( $ch ); |
| 49 | + |
| 50 | +preg_match_all( "/href=\"(.*?)\"/", $page_result, $matches ); |
| 51 | +$found4 = $matches[1][0]; |
| 52 | +$found100 = preg_replace( "/\/mail.*/", '', $found4 ); |
| 53 | +$found101 = $found100 . '/mail/mail.aspx'; |
| 54 | + |
| 55 | +// Step 4 |
| 56 | +$url = $found101; |
| 57 | +$page_result = curl_get( $url, 1, 0 ); |
| 58 | +preg_match_all( "/\"\/(.*?)\"/", $page_result, $matches ); |
| 59 | +$found = $matches[1][0]; |
| 60 | +$found101 = $found100 . '/' . $found; |
| 61 | + |
| 62 | +// Step 5 |
| 63 | +$url = $found101; |
| 64 | +$page_result = curl_get( $url, 1, 0 ); |
| 65 | +preg_match_all( "/InboxLight.aspx.n=(.*?)\"/", $page_result, $matches ); |
| 66 | +$found = $matches[1][0]; |
| 67 | +$found101 = $found100 . '/mail/InboxLight.aspx?n=' . $found; |
| 68 | + |
| 69 | +// Step 6 |
| 70 | +$url = $found101; |
| 71 | +$page_result = curl_get( $url, 1, 0 ); |
| 72 | + |
| 73 | +// Step 7 |
| 74 | +$url = $found101; |
| 75 | +$page_result = curl_get( $url, 1, 0 ); |
| 76 | +preg_match_all( "/EditMessageLight.aspx._ec=1&n.(.*?)\"/", $page_result, $matches ); |
| 77 | +$found = $matches[1][0]; |
| 78 | +$found101 = $found100 . '/mail/EditMessageLight.aspx?_ec=1&n=' . $found; |
| 79 | + |
| 80 | +// Step 8 |
| 81 | +$url = $found101; |
| 82 | +$page_result = curl_get( $url, 1, 0 ); |
| 83 | +preg_match_all( "/href=\"javascript:pickContact.'(.*?)', '(.*?)'/", $page_result, $matches, PREG_SET_ORDER ); |
| 84 | + |
| 85 | +// Checking if any contacts exist |
| 86 | +$checkarray = $matches[1][1]; |
| 87 | +if( empty( $checkarray ) ) { |
| 88 | + echo '<p align="center"><font face="Verdana" size="2"><b>No Details Found:</b> Please make sure you have entered correct login details and try again.</font></p><p align="center">'; |
| 89 | +} else { |
| 90 | + //*********************** | START OF HTML | ***********************************\\ |
| 91 | + // [header section - html] |
| 92 | +$header = <<<headertext |
| 93 | + |
| 94 | +<html> |
| 95 | +<head> |
| 96 | +<title>CONTACTS</title> |
| 97 | +<script type="text/javascript" src="../js/SelectAll.js"></script> |
| 98 | +</head> |
| 99 | +<body> |
| 100 | + |
| 101 | +headertext; |
| 102 | + |
| 103 | +echo $header; |
| 104 | + |
| 105 | +// [RESULTS -TITLE HTML] |
| 106 | + |
| 107 | +$title = <<<titletext |
| 108 | + |
| 109 | +<body> |
| 110 | +<div align="center"> |
| 111 | +<center> |
| 112 | +<table border="0" width="578" bgcolor="#FFFFFF"> |
| 113 | +<tr> |
| 114 | +<td width="622"><img height="2" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 115 | +</tr> |
| 116 | +<tr> |
| 117 | +<td align="middle" width="622"><table cellspacing="0" cellpadding="0" width="640" border="0"> |
| 118 | +<tbody> |
| 119 | +<tr> |
| 120 | +<td width="5" height="5"><img height="5" alt="" src="../images/tls.gif" width="5" border="0" /></td> |
| 121 | +<td background="../images/t.gif" colspan="2" width="716"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 122 | +<td width="6" height="5"><img height="5" alt="" src="../images/trs.gif" width="5" border="0"></td> |
| 123 | +</tr> |
| 124 | +<tr> |
| 125 | +<td width="5" background="../images/l.gif" height="5"><img height=5 alt="" src="../images/spacer.gif" width="5" border="0" /></td> |
| 126 | +<td width="6"><img height="1" alt="" src="../images/spacer.gif" width=6 border=0></td><td valign="top" width="704"> |
| 127 | +<table border="0" width="100%"> |
| 128 | +<tr> |
| 129 | +<td width="100%" bgcolor="#D7D8DF"> |
| 130 | +<p align="center"><font face="Arial" size="3" color="#333333">My Contacts</font> |
| 131 | +</td> |
| 132 | +</tr> |
| 133 | +</table> |
| 134 | +<p align="center"> |
| 135 | + |
| 136 | +titletext; |
| 137 | + |
| 138 | +echo $title; |
| 139 | + |
| 140 | +// [RESULTS - START OF FORM] |
| 141 | + |
| 142 | +echo '<form id="form_id" name="myform" method="post" action="postage.php">'; |
| 143 | + |
| 144 | +echo '<div align="center"><center><table border="0" cellpadding="3" cellspacing="6" width="100%">'; |
| 145 | + |
| 146 | + $i = 0; |
| 147 | + while( isset( $matches[$i] ) ): |
| 148 | + // [RESULTS - START OF CONTACTS LIST] |
| 149 | + |
| 150 | + $name = $matches[$i][2]; |
| 151 | + if( empty( $name ) ) { |
| 152 | + $longname = str_replace( '%40', '@', ( $matches[$i][1] ) ); |
| 153 | + list( $name, $domains ) = explode( '@', $longname ); |
| 154 | + } |
| 155 | + |
| 156 | + echo '<tr> |
| 157 | + <td width="22" bgcolor="#F5F5F5"><input type="checkbox" name="list[]" value="' . str_replace( '%40', '@', ( $matches[$i][1] ) ) . '" checked="checked" /></td> |
| 158 | + <td width="269" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $name . '</font></td> |
| 159 | + <td width="296" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . str_replace( '%40', '@', ( $matches[$i][1] ) ) . '</font></td> |
| 160 | + <input type="hidden" name="sendersemail" size="20" value="' . $username . '"> |
| 161 | + </tr>'; |
| 162 | + |
| 163 | + $i++; |
| 164 | + endwhile; |
| 165 | + |
| 166 | +// [RESULTS - START OF FOOTER] |
| 167 | + |
| 168 | +echo '</table></center></div>'; |
| 169 | + |
| 170 | +$footer = <<<footertext |
| 171 | + |
| 172 | +<table border="0" width="100%"> |
| 173 | +<tr> |
| 174 | +<td width="100%"> |
| 175 | +<p align="center"><font face="Arial" size="2"><br /></font><br /> |
| 176 | +<p></p><p align="center"><input type="submit" value="Send Email To Contacts" name="B1" style="background-color: #808080; color: #FFFFFF; font-family: Arial; font-size: 10pt; font-weight: bold; border: 1 solid #333333"></p> |
| 177 | +</form> |
| 178 | +</td> |
| 179 | +</tr> |
| 180 | +</table><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 181 | +<td width="6" background="../images/r.gif" height="5"><img height=1 alt="" src="../images/spacer.gif" width="1" border="0" /></td></tr> |
| 182 | +<tr> |
| 183 | +<td width="5" height="5"><img height=5 alt="" src="../images/bls.gif" width="5" border="0" /></td> |
| 184 | +<td background="../images/b.gif" colspan="2" width="716"><img height="1" alt="" src="../images/spacer.gif" width=1 border="0" /></td> |
| 185 | +<td width="6" height="5"><img height="5" alt="" src="../images/brs.gif" width="5" border="0" /></td> |
| 186 | +</tr> |
| 187 | +</tbody> |
| 188 | +</table> |
| 189 | +</td> |
| 190 | +</tr> |
| 191 | +</table></center></div> |
| 192 | +</body></html> |
| 193 | + |
| 194 | +footertext; |
| 195 | + |
| 196 | +echo $footer; |
| 197 | + |
| 198 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/myrediffmail.php |
— | — | @@ -0,0 +1,258 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Rediffmail.com contact importing script |
| 5 | + */ |
| 6 | + |
| 7 | +$fullemail = $_POST['username']; |
| 8 | + |
| 9 | +list( $username, $domain ) = explode( '@', $fullemail ); |
| 10 | + |
| 11 | +$refering_site = 'http://yahoo.com/'; // setting the site for refer |
| 12 | + |
| 13 | +$browser_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)'; // setting browser type |
| 14 | + |
| 15 | +$path_to_cookie = realpath( 'rediffmailcookie.txt' ); |
| 16 | + |
| 17 | +$setcookie = fopen( $path_to_cookie, 'wb' ); //this opens the file and resets it to zero length |
| 18 | +fclose( $setcookie ); |
| 19 | + |
| 20 | +function curl_get( $url, $follow, $debug ) { |
| 21 | + global $path_to_cookie, $browser_agent; |
| 22 | + |
| 23 | + $ch = curl_init(); |
| 24 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 25 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 26 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 27 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 28 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 29 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 30 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, $follow ); |
| 31 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 32 | + $result = curl_exec( $ch ); |
| 33 | + curl_close( $ch ); |
| 34 | + |
| 35 | + if( $debug == 1 ) { |
| 36 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 37 | + } |
| 38 | + |
| 39 | + if( $debug == 2 ) { |
| 40 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 41 | + echo $result; |
| 42 | + } |
| 43 | + |
| 44 | + return $result; |
| 45 | +} |
| 46 | + |
| 47 | +function curl_post( $url, $postal_data, $follow, $debug ) { |
| 48 | + global $path_to_cookie, $browser_agent; |
| 49 | + |
| 50 | + $ch = curl_init(); |
| 51 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 52 | + curl_setopt( $ch, CURLOPT_POST, 1 ); |
| 53 | + curl_setopt( $ch, CURLOPT_POSTFIELDS, $postal_data ); |
| 54 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 55 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 56 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 57 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 58 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 59 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, $follow ); |
| 60 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 61 | + $result = curl_exec( $ch ); |
| 62 | + curl_close( $ch ); |
| 63 | + |
| 64 | + if( $debug == 1 ) { |
| 65 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 66 | + } |
| 67 | + |
| 68 | + if( $debug == 2 ) { |
| 69 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 70 | + echo $result; |
| 71 | + } |
| 72 | + |
| 73 | + return $result; |
| 74 | +} |
| 75 | + |
| 76 | +// Step 1 |
| 77 | +$url = 'http://www.rediff.com'; |
| 78 | +$page_result = curl_get( $url, 1, 0 ); |
| 79 | + |
| 80 | +// Step 2 |
| 81 | +$loginurl = 'http://mail.rediff.com/cgi-bin/login.cgi'; |
| 82 | +$postdata = 'login=' . $username . '&passwd=' . $password . '&FormName=existing&x=14&y=9'; |
| 83 | + |
| 84 | +$ch = curl_init(); |
| 85 | +curl_setopt( $ch, CURLOPT_URL,$loginurl ); |
| 86 | +curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 87 | +curl_setopt( $ch, CURLOPT_POST, 1 ); |
| 88 | +curl_setopt( $ch, CURLOPT_HEADER, 1 ); |
| 89 | +curl_setopt( $ch, CURLOPT_POSTFIELDS,$postdata ); |
| 90 | +curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 91 | +curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); |
| 92 | +curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 93 | +curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 94 | +curl_setopt( $ch, CURLOPT_REFERER, $url ); |
| 95 | +curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 96 | +curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 97 | +$result = curl_exec( $ch ); |
| 98 | +curl_close( $ch ); |
| 99 | +preg_match_all( "/session_id=(.*?)&farm/", $result, $matches ); |
| 100 | +$session_id = $matches[1][0]; |
| 101 | +preg_match_all( "/http:\/\/(.*?).com/", $result, $matches ); |
| 102 | +$contacts_url = $matches[1][0]; |
| 103 | + |
| 104 | +// Step 3 |
| 105 | +$url = 'http://' . $contacts_url . '.com/bn/address.cgi?login=' . $username . '&FormName=export&session_id=' . $session_id . '&FormName=group_book'; |
| 106 | + |
| 107 | +$ch = curl_init(); |
| 108 | +curl_setopt( $ch, CURLOPT_URL, $url ); |
| 109 | +curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 110 | +curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 111 | +curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 112 | +curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 113 | +curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 114 | +curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 115 | +$result = curl_exec( $ch ); |
| 116 | +curl_close( $ch ); |
| 117 | + |
| 118 | +// Writing the results to a csv file on the server |
| 119 | +$myFile = $username; |
| 120 | +$fh = fopen( $myFile, 'w' ) or die( "can't open file" ); |
| 121 | +fwrite( $fh, $result ); |
| 122 | +fclose( $fh ); |
| 123 | + |
| 124 | +// Checking if login was succesful -- by searching for the @ sign in the csv |
| 125 | +preg_match_all( "/@/", $result, $array_at ); |
| 126 | + |
| 127 | +$at_sign = $array_at[0]; |
| 128 | + |
| 129 | +if( empty( $at_sign ) ) { |
| 130 | + echo '<p align="center"><font face="Verdana" size="2"><b>No Details Found:</b> Please make sure you have entered correct login details and try again.</font></p><p align="center">'; |
| 131 | +} else { |
| 132 | + // Start of HTML |
| 133 | + // [header section - html] |
| 134 | + |
| 135 | +$header = <<<headertext |
| 136 | + |
| 137 | +<html> |
| 138 | +<head> |
| 139 | +<title>CONTACTS</title> |
| 140 | +<script type="text/javascript" src="../js/SelectAll.js"></script> |
| 141 | +</head> |
| 142 | +<body> |
| 143 | + |
| 144 | +headertext; |
| 145 | + |
| 146 | + echo $header; |
| 147 | + |
| 148 | +// [RESULTS -TITLE HTML] |
| 149 | + |
| 150 | +$title = <<<titletext |
| 151 | + |
| 152 | +<body> |
| 153 | +<div align="center"> |
| 154 | +<center> |
| 155 | +<table border="0" width="578"> |
| 156 | +<tr> |
| 157 | +<td width="622"><img height="2" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 158 | +</tr> |
| 159 | +<tr> |
| 160 | +<td align="middle" width="622"> |
| 161 | +<table cellspacing="0" cellpadding="0" width="640" border="0"> |
| 162 | +<tbody> |
| 163 | +<tr> |
| 164 | +<td width="5" height="5"><img height="5" alt="" src="../images/tls.gif" width="5" border="0" /></td> |
| 165 | +<td background="../images/t.gif" colspan="2" width="716"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 166 | +<td width="6" height="5"><img height="5" alt="" src="../images/trs.gif" width="5" border="0" /></td> |
| 167 | +</tr> |
| 168 | +<tr> |
| 169 | +<td width="5" background="../images/l.gif" height="5"><img height="5" alt="" src="../images/spacer.gif" width="5" border="0" /></td> |
| 170 | +<td width="6"><img height="1" alt="" src="../images/spacer.gif" width="6" border="0" /></td> |
| 171 | +<td valign="top" width="704"> |
| 172 | +<table border="0" width="100%"> |
| 173 | +<tr> |
| 174 | +<td width="100%" bgcolor="#D7D8DF"> |
| 175 | +<p align="center"><font face="Arial" size="3" color="#333333">My Contacts</font> |
| 176 | +</td> |
| 177 | +</tr> |
| 178 | +</table> |
| 179 | +<p align="center"> |
| 180 | + |
| 181 | +titletext; |
| 182 | + |
| 183 | + echo $title; |
| 184 | + |
| 185 | + // [RESULTS - START OF FORM] |
| 186 | + echo '<form id="form_id" name="myform" method="post" action="postage.php">'; |
| 187 | + echo '<div align="center"><center><table border="0" cellpadding="3" cellspacing="6" width="100%">'; |
| 188 | + |
| 189 | + // Opening the stored csv file and turning it into an array |
| 190 | + $fp = fopen( $username, 'r' ); |
| 191 | + |
| 192 | + while( !feof( $fp ) ) { |
| 193 | + $data = fgetcsv( $fp, 4100, ',' ); // this uses the fgetcsv function to store the quote info in the array $data |
| 194 | + |
| 195 | + $dataname = $data[0]; |
| 196 | + |
| 197 | + if( empty( $dataname ) ) { |
| 198 | + $dataname = $data[2]; |
| 199 | + } |
| 200 | + |
| 201 | + if( empty( $dataname ) ) { |
| 202 | + $dataname = $data[3]; |
| 203 | + } |
| 204 | + |
| 205 | + if( empty( $dataname ) ) { |
| 206 | + $dataname = 'None'; |
| 207 | + } |
| 208 | + |
| 209 | + $email = $data[1]; // different csv to lycos and yahoo etc |
| 210 | + |
| 211 | + if( empty( $email ) ) { |
| 212 | + // Skip table |
| 213 | + } else { |
| 214 | + $email = $data[1]; |
| 215 | + |
| 216 | + if( $dataname != 'First Name' ) { |
| 217 | + echo '<tr> |
| 218 | + <td width="22" bgcolor="#F5F5F5"><input type="checkbox" name="list[]" value="' . $email . '" checked="checked" /></td> |
| 219 | + <td width="269" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $dataname . '</font></td> |
| 220 | + <td width="296" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $email . '</font></td> |
| 221 | + <input type="hidden" name="sendersemail" size="20" value="' . $fullemail . '" /> |
| 222 | + </tr>'; |
| 223 | + } |
| 224 | + } |
| 225 | + } |
| 226 | + echo '</table></center></div>'; |
| 227 | + |
| 228 | +$footer = <<<footertext |
| 229 | + |
| 230 | +<table border="0" width="100%"> |
| 231 | +<tr> |
| 232 | +<td width="100%"> |
| 233 | +<p align="center"><input type="submit" value="Send Email To Contacts" name="B1" style="background-color: #808080; color: #FFFFFF; font-family: Arial; font-size: 10pt; font-weight: bold; border: 1 solid #333333"></p> |
| 234 | +</form> |
| 235 | +</td> |
| 236 | +</tr> |
| 237 | +</table> |
| 238 | +<img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 239 | +<td width="6" background="../images/r.gif" height="5"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 240 | +</tr> |
| 241 | +<tr> |
| 242 | +<td width="5" height="5"><img height="5" alt="" src="../images/bls.gif" width="5" border="0" /></td> |
| 243 | +<td background="../images/b.gif" colspan="2" width="716"><img height=1 alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 244 | +<td width="6" height="5"><img height="5" alt="" src="../images/brs.gif" width="5" border="0" /> |
| 245 | +</td> |
| 246 | +</tr> |
| 247 | +</tbody> |
| 248 | +</table> |
| 249 | +</td> |
| 250 | +</tr> |
| 251 | +</table> |
| 252 | +</center></div> |
| 253 | +</body></html> |
| 254 | + |
| 255 | +footertext; |
| 256 | + |
| 257 | + echo $footer; |
| 258 | +} |
| 259 | + unlink( $username ); // deleting csv file |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/indiatimescookie.txt |
— | — | @@ -0,0 +1,13 @@ |
| 2 | +# Netscape HTTP Cookie File |
| 3 | +# http://www.netscape.com/newsref/std/cookie_spec.html |
| 4 | +# This file was generated by libcurl! Edit at your own risk. |
| 5 | + |
| 6 | +integra.indiatimes.com FALSE / FALSE 0 MSCSFirstRequestedURL http%3A%2F%2Fintegra%2Eindiatimes%2Ecom%2FTimes%2FLogon%2Easpx%3Fru%3Dhttp%3A%2F%2Finfinite%2Eindiatimes%2Ecom%2Fcgi%2Dbin%2Fgateway%26IS%3D058f3c27%2D6793%2D41c7%2Da676%2D81e3f3594a5c%26NS%3Demail%26HS%3DkSVLJ96CWWzEmTwPZa1LD6YR7NM%3D |
| 7 | +integra.indiatimes.com FALSE / FALSE 1167845994 Commerce2002_TestPersistentCookie TestCookie |
| 8 | +integra.indiatimes.com FALSE / FALSE 0 Commerce2002_TestSessionCookie TestCookie |
| 9 | +integra.indiatimes.com FALSE / FALSE 0 ASP.NET_SessionId x3i20h454wajk555eekaga55 |
| 10 | +integra.indiatimes.com FALSE / FALSE 1199295594 CookieSupport Testing browser capablities |
| 11 | +.indiatimes.com TRUE / FALSE 0 MSCSAuth 3C79F0C7EA3162B275E73B07A66925F4C9FED9E68ED310C7A415D211326E2772D58911773E79255BA3817C3C746275E477B58C12414D0DDAC45344DB7FC222CCADCD5ECD622632CC344F701DB3C63659 |
| 12 | +.indiatimes.com TRUE / FALSE 0 MSCSAuthDetails UserName=brianshawa |
| 13 | +.indiatimes.com TRUE / FALSE 0 MSCSAuthDetail DOB=0001-01-01~Gender=~Country= |
| 14 | +.indiatimes.com TRUE / FALSE 0 VisitedSites 058f3c27-6793-41c7-a676-81e3f3594a5c |
Index: trunk/extensions/InviteContacts/getmycontacts/lycoscookie.txt |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +# Netscape HTTP Cookie File |
| 3 | +# http://www.netscape.com/newsref/std/cookie_spec.html |
| 4 | +# This file was generated by libcurl! Edit at your own risk. |
| 5 | + |
| 6 | +.lycos.com TRUE / FALSE -1 MAYA_SSO_27 ATExtS4eG2WNF8ExU-6kxBbzf1yFiQ2_t3beypOyPTLa7wClk7I9MtrvAKWn8qOnV9ov2gRH0oKCMOhcUEeUWEOPhiUcSONj2VLDma5FF2J8WiXJk7I9MtrvAKWTsj0y2u8ApZOyPTLa7wCl2meTCsio9LxWnZKS623gRZwRbCF8Wmie1YLUEU9FzGTBjSgMgPBkjrkpih9bhokg |
| 7 | +.lycos.com TRUE / FALSE -1 m_DDT ABIJMQAACy-LGOYByrfT5Rs1B07Ji7QTtcwrskXRJlsLfzhXurhi46t46LqpfYHG |
| 8 | +.lycos.com TRUE / FALSE -1 MAYA_SSO ATFWC0l4kfq9eRN1hFQkvREE1cgmgbzsC_QfTZrCI37QYTicmsIjftBhOJw8GemTj8aFWV3CHCXtqfVrgZua6TeCqLEbDEc03n0lBthbF8ff31MOmsIjftBhOJyawiN_0GE4nJrCI37QYTic1C8WlR_MJDSFHxrBdFTIIj0mlS2LC8CNDf7HXIYcUHlHhzopJSgaqClYkI96LEAg |
| 9 | +mail.lycos.com FALSE / FALSE 1172663474 LYCOSMAIL hQMdLEnOdm3qjDsskzLf_xcnzvBNxv_uDqPZyva._.7gnWGvUKks3bhoIHFkDXpy4phVF-fQvrMlcaf.O_78cjgxMOq9kZ_1NF9PHDBRlnJupm_dZcS84lTe8mSnPk6OKgUkWiASZ8qJXKZxTe8._mFiXi2iLp1x |
Index: trunk/extensions/InviteContacts/getmycontacts/getmycontactsbase.php |
— | — | @@ -0,0 +1,17 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +function initContactsLang() { |
| 5 | + global $form_language; |
| 6 | + |
| 7 | + require_once ( dirname( __FILE__ ) . '/getmycontacts.i18n.php' ); |
| 8 | + |
| 9 | + $m = efGetMyContacts(); |
| 10 | + |
| 11 | + $contactLang = $m[$form_language]; |
| 12 | + if (empty($contactLang)) { |
| 13 | + $contactLang = 'en'; |
| 14 | + } |
| 15 | + return $contactLang; |
| 16 | +} |
| 17 | + |
| 18 | +$messages = initContactsLang(); |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/mythunderbird.php |
— | — | @@ -0,0 +1,170 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Thunderbird contact importing script |
| 5 | + */ |
| 6 | + |
| 7 | +$get = 'mythunderbird'; |
| 8 | + |
| 9 | +// Start of file upload and security check |
| 10 | + |
| 11 | +$limit_size = 2000000; // you can change this to a higher file size limit (this is in bytes = 2MB apprx) |
| 12 | + |
| 13 | +$random = rand( 150, 15000 ); // create random number |
| 14 | +$uniquename = $random . $HTTP_POST_FILES['ufile']['name']; // add random number to file name to create unique file |
| 15 | +$path = 'upload/' . $uniquename; |
| 16 | + |
| 17 | +if( $ufile != null ) { |
| 18 | + // Store upload file size in $file_size |
| 19 | + $file_size = $HTTP_POST_FILES['ufile']['size']; |
| 20 | + |
| 21 | + if( $file_size >= $limit_size ) { |
| 22 | + echo '<p align="center"><font face="Verdana" size="2"><b>Error!:</b> Your file exceeds the allowed size limit.</font></p><p align="center">'; |
| 23 | + exit; |
| 24 | + } else { |
| 25 | + $filetype = $HTTP_POST_FILES['ufile']['type']; |
| 26 | + if( |
| 27 | + $filetype == 'application/vnd.ms-excel' || |
| 28 | + $filetype == 'application/x-csv' || |
| 29 | + $filetype == 'text/csv' |
| 30 | + ) { |
| 31 | + // copy file to where you want to store file |
| 32 | + if( copy( $HTTP_POST_FILES['ufile']['tmp_name'], $path ) ) { |
| 33 | + } else { |
| 34 | + echo 'Copy Error'; |
| 35 | + exit; |
| 36 | + } |
| 37 | + } else { |
| 38 | + echo '<p align="center"><font face="Verdana" size="2"><b>Error!:</b> You may only upload csv files.</font></p><p align="center">'; |
| 39 | + exit; |
| 40 | + } |
| 41 | + } |
| 42 | +} |
| 43 | +// End of file upload |
| 44 | + |
| 45 | +$header = <<<headertext |
| 46 | + |
| 47 | +<html> |
| 48 | +<head> |
| 49 | +<title>CONTACTS</title> |
| 50 | +<script type="text/javascript" src="../js/SelectAll.js"></script> |
| 51 | +</head> |
| 52 | +<body> |
| 53 | + |
| 54 | +headertext; |
| 55 | + |
| 56 | + echo $header; |
| 57 | + |
| 58 | + // [RESULTS -TITLE HTML] |
| 59 | + |
| 60 | +$title = <<<titletext |
| 61 | + |
| 62 | +<body> |
| 63 | +<div align="center"> |
| 64 | +<center> |
| 65 | +<table border="0" width="578"> |
| 66 | +<tr> |
| 67 | +<td width="622"><img height="2" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 68 | +</tr> |
| 69 | +<tr> |
| 70 | +<td align="middle" width="622"><table cellspacing="0" cellpadding="0" width="640" border="0"> |
| 71 | +<tbody> |
| 72 | +<tr> |
| 73 | +<td width="5" height="5"><img height="5" alt="" src="../images/tls.gif" width="5" border="0" /></td> |
| 74 | +<td background="../images/t.gif" colspan="2" width="716"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 75 | +<td width="6" height="5"><img height="5" alt="" src="../images/trs.gif" width="5" border="0" /></td> |
| 76 | +</tr> |
| 77 | +<tr> |
| 78 | +<td width="5" background="../images/l.gif" height="5"><img height="5" alt="" src="../images/spacer.gif" width="5" border="0" /></td> |
| 79 | +<td width="6"><img height="1" alt="" src="../images/spacer.gif" width="6" border="0" /></td> |
| 80 | +<td valign="top" width="704"> |
| 81 | +<table border="0" width="100%"> |
| 82 | +<tr> |
| 83 | +<td width="100%" bgcolor="#D7D8DF"> |
| 84 | +<p align="center"><font face="Arial" size="3" color="#333333">My Contacts</font> |
| 85 | +</td> |
| 86 | +</tr> |
| 87 | +</table> |
| 88 | +<p align="center"> |
| 89 | + |
| 90 | +titletext; |
| 91 | + |
| 92 | + echo $title; |
| 93 | + |
| 94 | + // [RESULTS - START OF FORM] |
| 95 | + echo '<form id="form_id" name="myform" method="post" action="">'; |
| 96 | + echo '<div align="center"><center><table border="0" cellpadding="3" cellspacing="6" width="100%">'; |
| 97 | + |
| 98 | + // Opening the stored csv file and turning it into an array |
| 99 | + $fp = fopen( $path, 'r' ); |
| 100 | + |
| 101 | + while( !feof( $fp ) ) { |
| 102 | + $data = fgetcsv( $fp, 4100, ',' ); // this uses the fgetcsv function to store the quote info in the array $data |
| 103 | + |
| 104 | + $dataname = $data[0]; |
| 105 | + |
| 106 | + if( empty( $dataname ) ) { |
| 107 | + $dataname = $data[1]; |
| 108 | + } |
| 109 | + |
| 110 | + if( empty( $dataname ) ) { |
| 111 | + $dataname = $data[2]; |
| 112 | + } |
| 113 | + |
| 114 | + if( empty( $dataname ) ) { |
| 115 | + $dataname = 'None'; |
| 116 | + } |
| 117 | + |
| 118 | + $email = $data[4]; // different csv to lycos and yahoo etc |
| 119 | + |
| 120 | + if( empty( $email ) ) { |
| 121 | + // Skip table |
| 122 | + } else { |
| 123 | + $email = $data[4]; |
| 124 | + |
| 125 | + if( $dataname == 'None' ) { |
| 126 | + $dataname = $email; |
| 127 | + } |
| 128 | + |
| 129 | + if( $dataname != 'First Name' || $dataname != 'Last Name' ) { |
| 130 | + echo '<tr> |
| 131 | + <td width="22" bgcolor="#F5F5F5"><input type="checkbox" name="list[]" value="' . $email . '" checked="checked" /></td> |
| 132 | + <td width="269" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $dataname . '</font></td> |
| 133 | + <td width="296" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $email . '</font></td> |
| 134 | + <input type="hidden" name="sendersemail" size="20" value="' . $fullemail . '" /> |
| 135 | + </tr>'; |
| 136 | + } |
| 137 | + } |
| 138 | + } |
| 139 | + echo '</table></center></div>'; |
| 140 | + |
| 141 | +$footer = <<<footertext |
| 142 | + |
| 143 | +<table border="0" width="100%"> |
| 144 | +<tr> |
| 145 | +<td width="100%"> |
| 146 | +<p align="center"><input type="submit" value="Send Email To Contacts" name="B1" style="background-color: #808080; color: #FFFFFF; font-family: Arial; font-size: 10pt; font-weight: bold; border: 1 solid #333333"></p> |
| 147 | +</form> |
| 148 | +</td> |
| 149 | +</tr> |
| 150 | +</table> |
| 151 | +<img height=1 alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 152 | +<td width=6 background="../images/r.gif" height="5"><img height=1 alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 153 | +</tr> |
| 154 | +<tr> |
| 155 | +<td width="5" height="5"><img height="5" alt="" src="../images/bls.gif" width="5" border="0" /></td> |
| 156 | +<td background="../images/b.gif" colspan="2" width="716"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 157 | +<td width="6" height="5"><img height="5" alt="" src="../images/brs.gif" width="5" border="0" /></td> |
| 158 | +</tr> |
| 159 | +</tbody> |
| 160 | +</table> |
| 161 | +</td> |
| 162 | +</tr> |
| 163 | +</table> |
| 164 | +</center></div> |
| 165 | +</body></html> |
| 166 | + |
| 167 | +footertext; |
| 168 | + |
| 169 | + echo $footer; |
| 170 | + |
| 171 | +unlink( $path ); // deleting csv file |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/myaol.php |
— | — | @@ -0,0 +1,363 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * AOL contact importing script |
| 5 | + */ |
| 6 | + |
| 7 | +$username = $_POST['username']; |
| 8 | + |
| 9 | +$password = $_POST['password']; |
| 10 | + |
| 11 | +list( $username, $domain ) = explode( '@', $username ); |
| 12 | +$refering_site ='http://classic.webmail.aol.com'; // setting the site for refer |
| 13 | + |
| 14 | +$browser_agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)'; // setting browser type |
| 15 | + |
| 16 | +$path_to_cookie = realpath( 'aolcookie.txt' ); |
| 17 | + |
| 18 | +$setcookie = fopen( $path_to_cookie, 'wb' ); // this opens the file and resets it to zero length |
| 19 | +fclose( $setcookie ); |
| 20 | + |
| 21 | +$form_language = $_REQUEST['language']; |
| 22 | + |
| 23 | +include_once( dirname( __FILE__ ) . '/getmycontactsbase.php' ); |
| 24 | + |
| 25 | +// Opening login page |
| 26 | + |
| 27 | +$login_page = 'https://my.screenname.aol.com/_cqr/login/login.psp?mcState=initialized&seamless=novl&siteId=vatlasaol-static&siteState=OrigUrl%3dhttp%253a%252f%252fclassic.webmail.aol.com%252f_cqr%252fvllogin.adp&authLev=2'; |
| 28 | +#$login_page = 'https://my.screenname.aol.com/_cqr/login/login.psp?mcState=initialized&seamless=novl&siteId=vatlasaol-static&siteState=OrigUrl%3dhttp%253a%252f%252fclassic.webmail.aol.com%252f_cqr%252fvllogin.adp&authLev=2'; |
| 29 | + |
| 30 | +$ch = curl_init(); |
| 31 | +curl_setopt( $ch, CURLOPT_URL, $login_page ); |
| 32 | +curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 33 | +curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 34 | +curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 35 | +curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 36 | +curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 1 ); |
| 37 | +curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 38 | +curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 39 | +$page_result = curl_exec( $ch ); |
| 40 | +curl_close( $ch ); |
| 41 | +$cookie_data1 = ".aol.com FALSE / FALSE 0 s_sq %5B%5BB%5D%5D \n"; |
| 42 | +$fp2 = fopen( $path_to_cookie, 'a' ); // "a" is to append |
| 43 | +fwrite( $fp2, $cookie_data1 ); |
| 44 | +fclose( $fp2 ); |
| 45 | + |
| 46 | +$cookie_data2 = '.aol.com FALSE / FALSE 0 s_cc true'; |
| 47 | +$fp3 = fopen( $path_to_cookie, 'a' ); // "a" is to append |
| 48 | +fwrite( $fp3, $cookie_data2); |
| 49 | +fclose( $fp3 ); |
| 50 | + |
| 51 | +// (1) get usrd fieled |
| 52 | + |
| 53 | +preg_match_all( "/name=\"usrd\" value=\"(.*?)\"/", $page_result, $usrd ); |
| 54 | +$usrd_found = $usrd[1][0]; // stores the hidden text in a ariable to use later in POST |
| 55 | + |
| 56 | + |
| 57 | +// Submitting login info as aquired above |
| 58 | + |
| 59 | +$postal_data ='sitedomain=vatlasaol-static&siteId=vatlasaol-static&lang=en&locale=us&authLev=2&siteState=OrigUrl%253Dhttp%25253a%25252f%25252fclassic.webmail.aol.com%25252f_cqr%25252fvllogin.adp&isSiteStateEncoded=true&mcState=initialized&usrd='.$usrd_found.'&loginId='.$username.'&password='.$password.'&rememberMe=off'; |
| 60 | + |
| 61 | +$login_page2 = 'https://my.screenname.aol.com/_cqr/login/login.psp'; |
| 62 | + |
| 63 | +$referer2 = 'https://my.screenname.aol.com/_cqr/login/login.psp?mcState=initialized&seamless=novl&siteId=vatlasaol-static&siteState=OrigUrl%3dhttp%253a%252f%252fclassic.webmail.aol.com%252f_cqr%252fvllogin.adp&authLev=2'; |
| 64 | + |
| 65 | +$ch = curl_init(); |
| 66 | + curl_setopt( $ch, CURLOPT_URL, $login_page2 ); |
| 67 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 68 | + curl_setopt( $ch, CURLOPT_POST, 1 ); |
| 69 | + curl_setopt( $ch, CURLOPT_POSTFIELDS, $postal_data ); |
| 70 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 71 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 72 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 73 | + curl_setopt( $ch, CURLOPT_REFERER, $referer2 ); |
| 74 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 75 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 76 | +#curl_setopt( $ch, CURLOPT_HEADER, 1 ); |
| 77 | +curl_setopt( $ch, CURLOPT_AUTOREFERER, 1 ); |
| 78 | + |
| 79 | + $result3 = curl_exec( $ch ); |
| 80 | + curl_close( $ch ); |
| 81 | + |
| 82 | +preg_match_all( "/'loginForm', 'false', '(.*?)'/", $result3, $redirected ); |
| 83 | +$myaol = $redirected[1][0]; |
| 84 | + |
| 85 | +// Start of cookie checks |
| 86 | + |
| 87 | +$cookiechecker1 = $myaol; //'http://my.screenname.aol.com/_cqr/login/login.psp?mcState=copyCookies&siteId=vatlasaol-static&authLev=2&siteState=OrigUrl%3Dhttp%253a%252f%252fclassic.webmail.aol.com%252f_cqr%252fvllogin.adp&lang=en&locale=us'; |
| 88 | + |
| 89 | + $ch = curl_init(); |
| 90 | + curl_setopt( $ch, CURLOPT_URL, $cookiechecker1 ); |
| 91 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 92 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 93 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 94 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 95 | + curl_setopt( $ch, CURLOPT_REFERER, $login_page2 ); |
| 96 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 97 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 98 | + $result5 = curl_exec( $ch ); |
| 99 | + curl_close( $ch ); |
| 100 | + |
| 101 | +preg_match_all( "/MC_CMP_SX=(.*?)\" TYPE/", $result5, $cookieurl1 ); |
| 102 | + |
| 103 | +preg_match_all( "/MC_CMP_S=(.*?)\" TYPE/", $result5, $cookieurl2 ); |
| 104 | + |
| 105 | +$redirect_CMP_SX = $cookieurl1[1][0]; |
| 106 | +$redirect_CMP_S = $cookieurl2[1][0]; |
| 107 | + |
| 108 | +// Cookie step 2 |
| 109 | + |
| 110 | +$cookiechecker2 = 'http://sns.cqr.classic.webmail.aol.com/_cqr/xdomain/final.psp?siteId=vatlasaol-static&MC_CMP_SX='.$redirect_CMP_SX; |
| 111 | +$referer3 = 'http://my.screenname.aol.com/_cqr/login/login.psp?mcState=copyCookies&siteId=vatlasaol-static&authLev=2&siteState=OrigUrl%3Dhttp%253a%252f%252fclassic.webmail.aol.com%252f_cqr%252fvllogin.adp&lang=en&locale=us'; |
| 112 | + |
| 113 | + $ch = curl_init(); |
| 114 | + curl_setopt( $ch, CURLOPT_URL, $cookiechecker2 ); |
| 115 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 116 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 117 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 118 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 119 | + curl_setopt( $ch, CURLOPT_REFERER, $referer3 ); |
| 120 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 121 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 122 | + $result6 = curl_exec( $ch ); |
| 123 | + curl_close( $ch ); |
| 124 | + |
| 125 | +// Cookie step 3 |
| 126 | +$cookiechecker3 = 'http://sns.cqr.classic.webmail.aol.com/_cqr/xdomain/final.psp?siteId=vatlasaol-static&MC_CMP_S=' . $redirect_CMP_S; |
| 127 | + |
| 128 | +$referer4 = 'http://my.screenname.aol.com/_cqr/login/login.psp?mcState=copyCookies&siteId=vatlasaol-static&authLev=2&siteState=OrigUrl%3Dhttp%253a%252f%252fclassic.webmail.aol.com%252f_cqr%252fvllogin.adp&lang=en&locale=us'; |
| 129 | + |
| 130 | + $ch = curl_init(); |
| 131 | + curl_setopt( $ch, CURLOPT_URL, $cookiechecker3 ); |
| 132 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 133 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 134 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 135 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 136 | + curl_setopt( $ch, CURLOPT_REFERER, $referer4 ); |
| 137 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 138 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 139 | + $result7 = curl_exec( $ch ); |
| 140 | + curl_close( $ch ); |
| 141 | + |
| 142 | +// Logging into AOL Classic |
| 143 | +$login_page3 = 'https://my.screenname.aol.com/_cqr/login/login.psp'; |
| 144 | + |
| 145 | +$postal_data2 ='siteId=vatlasaol-static&sitedomain=vatlasaol-static&authLev=2&lang=en&locale=us&siteState=OrigUrl%3Dhttp%253a%252f%252fclassic.webmail.aol.com%252f_cqr%252fvllogin.adp'; |
| 146 | + |
| 147 | +$referer2 = 'https://my.screenname.aol.com/_cqr/login/login.psp?mcState=copyCookies&siteId=vatlasaol-static&authLev=2&siteState=OrigUrl%3Dhttp%253a%252f%252fclassic.webmail.aol.com%252f_cqr%252fvllogin.adp&lang=en&locale=us'; |
| 148 | + |
| 149 | + $ch = curl_init(); |
| 150 | + curl_setopt( $ch, CURLOPT_URL, $login_page3 ); |
| 151 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 152 | + curl_setopt( $ch, CURLOPT_POST, 1 ); |
| 153 | + curl_setopt( $ch, CURLOPT_POSTFIELDS, $postal_data2 ); |
| 154 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 155 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 156 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 157 | + curl_setopt( $ch, CURLOPT_REFERER, $referer2 ); |
| 158 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 159 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 160 | + $result8 = curl_exec( $ch ); |
| 161 | + curl_close( $ch ); |
| 162 | + |
| 163 | +// Opening inbox, part 1 |
| 164 | +$inboxurl = 'http://classic.webmail.aol.com/_cqr/vllogin.adp'; |
| 165 | + |
| 166 | +$referer3 = 'http://my.screenname.aol.com/_cqr/login/login.psp?mcState=copyCookies&siteId=vatlasaol-static&authLev=2&siteState=OrigUrl%3Dhttp%253a%252f%252fclassic.webmail.aol.com%252f_cqr%252fvllogin.adp&lang=en&locale=us'; |
| 167 | + |
| 168 | + $ch = curl_init(); |
| 169 | + curl_setopt( $ch, CURLOPT_URL, $inboxurl ); |
| 170 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 171 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 172 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 173 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 174 | + curl_setopt( $ch, CURLOPT_REFERER, $referer3 ); |
| 175 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 176 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 177 | + $result9 = curl_exec( $ch ); |
| 178 | + curl_close( $ch ); |
| 179 | + |
| 180 | +// Opening inbox, part 2 |
| 181 | +$inboxurl2 = 'http://classic.webmail.aol.com/msglist.adp'; |
| 182 | + |
| 183 | +$referer4 = 'http://my.screenname.aol.com/_cqr/login/login.psp?mcState=copyCookies&siteId=vatlasaol-static&authLev=2&siteState=OrigUrl%3Dhttp%253a%252f%252fclassic.webmail.aol.com%252f_cqr%252fvllogin.adp&lang=en&locale=us'; |
| 184 | + |
| 185 | + $ch = curl_init(); |
| 186 | + curl_setopt( $ch, CURLOPT_URL, $inboxurl2 ); |
| 187 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 188 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 189 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 190 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 191 | + curl_setopt( $ch, CURLOPT_REFERER, $referer4 ); |
| 192 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 193 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 194 | + $result10 = curl_exec( $ch ); |
| 195 | + curl_close( $ch ); |
| 196 | + |
| 197 | +// Opening address book 1 |
| 198 | + |
| 199 | +$addressbook1 = 'http://classic.webmail.aol.com/rab.adp?launch=main'; |
| 200 | + |
| 201 | + $ch = curl_init(); |
| 202 | + curl_setopt( $ch, CURLOPT_URL, $addressbook1 ); |
| 203 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 204 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 205 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 206 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 207 | + curl_setopt( $ch, CURLOPT_REFERER, $inboxurl2 ); |
| 208 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 209 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 210 | + $result11 = curl_exec( $ch ); |
| 211 | + curl_close( $ch ); |
| 212 | + |
| 213 | +preg_match_all( "/main.adp\?(.*?)\"/", $result11, $addresses ); |
| 214 | + |
| 215 | +$addressredirect = $addresses[1][0]; |
| 216 | + |
| 217 | +// Final post to get into the address book |
| 218 | + |
| 219 | +$postal_final = $addressredirect; |
| 220 | + |
| 221 | +$posted = ''; |
| 222 | + |
| 223 | +$login_final = 'http://ab.classic.webmail.aol.com/main.adp?' . $postal_final; |
| 224 | + |
| 225 | + $ch = curl_init(); |
| 226 | + curl_setopt( $ch, CURLOPT_URL, $login_final ); |
| 227 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 228 | + curl_setopt( $ch, CURLOPT_POST, 1 ); |
| 229 | + curl_setopt( $ch, CURLOPT_POSTFIELDS, $posted ); |
| 230 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 231 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 232 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 233 | + curl_setopt( $ch, CURLOPT_REFERER, $addressbook1 ); |
| 234 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 235 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 236 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true ); |
| 237 | + //curl_setopt( $ch, CURLOPT_HEADER, 1 ); |
| 238 | + $result22 = curl_exec( $ch ); |
| 239 | + curl_close( $ch ); |
| 240 | + |
| 241 | +// OPENING ADDRESS PRINT ALL |
| 242 | + |
| 243 | +$addressbook2 = 'http://ab.classic.webmail.aol.com/print_all_information.adp?langid=0&ContactKey=100,99,98,97,96,95,94,93,92,91,90,89,88,87,86,85,84,83,82,81,80,79,78,77,76,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,&mheader=0'; |
| 244 | + |
| 245 | +// put as many numbers in link abov to pull as many contacts as possible |
| 246 | + |
| 247 | + $ch = curl_init(); |
| 248 | + curl_setopt( $ch, CURLOPT_URL, $addressbook2 ); |
| 249 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 250 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 251 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 252 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 253 | + curl_setopt( $ch, CURLOPT_REFERER, $login_final ); |
| 254 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 255 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 256 | + $result23 = curl_exec( $ch ); |
| 257 | + curl_close( $ch ); |
| 258 | + |
| 259 | +// this array pulls out the names and email using regular expressions |
| 260 | + |
| 261 | +// Full name and email in one array search |
| 262 | + |
| 263 | +preg_match_all( |
| 264 | + "/size=2 color=\"#000000\"><b>(.*?)<\/b>.*E-mail: (.*?)<br>/", |
| 265 | + $result23, |
| 266 | + $array_fulldetails |
| 267 | +); |
| 268 | + |
| 269 | +$details = $array_fulldetails; |
| 270 | + |
| 271 | +// [checking if array empty] |
| 272 | + |
| 273 | +if( empty( $details ) ) { |
| 274 | + echo '<p align="center"><font face="Verdana" size="2"><b>' . $messages['no_details_found'] . ':</b> ' . $messages['makesurecorrectlogin'] . '</font></p><p align="center">'; |
| 275 | +} else { |
| 276 | + |
| 277 | +// [header section - html] |
| 278 | + |
| 279 | +$header = <<<headertext |
| 280 | + |
| 281 | +<html> |
| 282 | +<head> |
| 283 | +<title>{$messages['my_contacts']}</title> |
| 284 | +<script type="text/javascript" src="../js/SelectAll.js"></script> |
| 285 | +</head> |
| 286 | +<body> |
| 287 | + |
| 288 | +headertext; |
| 289 | + |
| 290 | +echo $header; |
| 291 | + |
| 292 | +// [RESULTS -TITLE HTML] |
| 293 | + |
| 294 | +$title = <<<titletext |
| 295 | + |
| 296 | +titletext; |
| 297 | + |
| 298 | +echo $title; |
| 299 | + |
| 300 | +// [RESULTS - START OF FORM] |
| 301 | + |
| 302 | +echo '<form id="form_id" name="myform" method="post" action="">'; |
| 303 | + |
| 304 | + echo '<h1>Your contacts</h1> |
| 305 | + <p class="contacts-message"> |
| 306 | + <span class="profile-on">' . $messages['sharefriends'] . '</span> |
| 307 | + </p> |
| 308 | + <p class="contacts-message"> |
| 309 | + <input type="submit" class="invite-form-button" value="' . $messages['inviteyourfriends'] . '" name="B1" /> |
| 310 | + <a href="javascript:toggleChecked()">' . $messages['uncheckall'] . '</a> |
| 311 | + </p> |
| 312 | + <div class="contacts-title-row"> |
| 313 | + <p class="contacts-checkbox"></p> |
| 314 | + <p class="contacts-title">' |
| 315 | + . $messages['friendname'] . |
| 316 | + '</p> |
| 317 | + <p class="contacts-title">' |
| 318 | + . $messages['emailtitle'] . |
| 319 | + '</p> |
| 320 | + <div class="cleared"></div> |
| 321 | + </div> |
| 322 | + <div class="contacts">'; |
| 323 | + |
| 324 | + $i = 0; |
| 325 | + while( isset( $details[1][$i] ) ): |
| 326 | + |
| 327 | +// [RESULTS - START OF CONTACTS LIST] |
| 328 | + |
| 329 | +//echo '<tr><td width="22" bgcolor="#F5F5F5"><input type="checkbox" name="list[]" value="'.$details[2][$i].'" checked></td><td width="269" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">'.$details[1][$i].'</font></td><td width="296" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">'.$details[2][$i].'</font></td><input type="hidden" name="sendersemail" size="20" value="'.$fullemail.'"></tr>'; |
| 330 | + |
| 331 | + echo '<div class="contacts-row"> |
| 332 | + <p class="contacts-checkbox"> |
| 333 | + <input type="checkbox" name="list[]" value="' . $details[2][$i] . '" checked="checked" /> |
| 334 | + </p> |
| 335 | + <p class="contacts-cell">' |
| 336 | + . $details[1][$i] . |
| 337 | + '</p> |
| 338 | + <p class="contacts-cell">' |
| 339 | + . $details[2][$i] . |
| 340 | + '</p> |
| 341 | + <input type="hidden" name="sendersemail" size="20" value="' . $username . '" /> |
| 342 | + <div class="cleared"></div> |
| 343 | + </div>'; |
| 344 | + |
| 345 | + $i++; |
| 346 | + endwhile; |
| 347 | + |
| 348 | +// [RESULTS - START OF FOOTER] |
| 349 | + |
| 350 | +echo '</div>'; |
| 351 | + |
| 352 | +$footer = <<<footertext |
| 353 | + |
| 354 | +<p> |
| 355 | +<input type="submit" class="invite-form-button" value="{$messages['inviteyourfriends']}" name="B1" /> |
| 356 | +<a href="javascript:toggleChecked()">{$messages['uncheckall']}</a> |
| 357 | +</p> |
| 358 | +</form> |
| 359 | + |
| 360 | +footertext; |
| 361 | + |
| 362 | +echo $footer; |
| 363 | + |
| 364 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/livecookie.txt |
— | — | @@ -0,0 +1,6 @@ |
| 2 | +# Netscape HTTP Cookie File |
| 3 | +# http://www.netscape.com/newsref/std/cookie_spec.html |
| 4 | +# This file was generated by libcurl! Edit at your own risk. |
| 5 | + |
| 6 | +login.live.com FALSE / FALSE 0 MSPRequ lt=1178747004&co=1&id=64855 |
| 7 | +.login.live.com TRUE / FALSE 0 MSPOK uuid-af51b6f1-055f-4418-a266-9ba2d60e84b7 |
Index: trunk/extensions/InviteContacts/getmycontacts/myicq.php |
— | — | @@ -0,0 +1,230 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$username = $_POST['username']; |
| 5 | + |
| 6 | +$password = $_POST['password']; |
| 7 | + |
| 8 | +list( $username, $domain ) = explode( '@', $username ); |
| 9 | + |
| 10 | +$refering_site = 'http://icqmail.com'; // setting the site for refer |
| 11 | + |
| 12 | +$browser_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7'; // setting browser type |
| 13 | + |
| 14 | +$path_to_cookie = realpath( 'icqcookie.txt' ); |
| 15 | + |
| 16 | +$setcookie = fopen( $path_to_cookie, 'wb' ); //this opens the file and resets it to zero length |
| 17 | +fclose( $setcookie ); |
| 18 | + |
| 19 | +echo '<body background="loading.gif">'; |
| 20 | + |
| 21 | +function curl_get( $url, $follow, $debug ) { |
| 22 | + global $path_to_cookie, $browser_agent; |
| 23 | + |
| 24 | + $ch = curl_init(); |
| 25 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 26 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 27 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 28 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 29 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 30 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 31 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, $follow ); |
| 32 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 33 | + $result = curl_exec( $ch ); |
| 34 | + curl_close( $ch ); |
| 35 | + |
| 36 | + if( $debug == 1 ) { |
| 37 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 38 | + } |
| 39 | + |
| 40 | + if( $debug == 2 ) { |
| 41 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 42 | + echo $result; |
| 43 | + } |
| 44 | + |
| 45 | + return $result; |
| 46 | +} |
| 47 | + |
| 48 | +function curl_post( $url, $postal_data, $follow, $debug ) { |
| 49 | + global $path_to_cookie, $browser_agent; |
| 50 | + |
| 51 | + $ch = curl_init(); |
| 52 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 53 | + curl_setopt( $ch, CURLOPT_POST, 1 ); |
| 54 | + curl_setopt( $ch, CURLOPT_POSTFIELDS, $postal_data ); |
| 55 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 56 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 57 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 58 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 59 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 60 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, $follow ); |
| 61 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 62 | + $result = curl_exec( $ch ); |
| 63 | + curl_close( $ch ); |
| 64 | + |
| 65 | + if( $debug == 1 ) { |
| 66 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 67 | + } |
| 68 | + |
| 69 | + if( $debug == 2 ) { |
| 70 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 71 | + echo $result; |
| 72 | + } |
| 73 | + |
| 74 | + return $result; |
| 75 | +} |
| 76 | + |
| 77 | +// Step 1 |
| 78 | +$url = 'http://www.icqmail.com/'; |
| 79 | +$page_result = curl_get( $url, 1, 0 ); |
| 80 | + |
| 81 | +// Step 2 |
| 82 | +$postal_data = 'faction=login&domain=icqmail.com&username=' . $username . '&password=' . $password; |
| 83 | +$url = 'http://www.icqmail.com/default.asp'; |
| 84 | +$result = curl_post( $url, $postal_data, 1, 0 ); |
| 85 | + |
| 86 | +// [pick up forwarding url] |
| 87 | +preg_match_all( "/url=\/(.*?)\"/", $result, $matches ); |
| 88 | +$matches = $matches[1][0]; |
| 89 | + |
| 90 | +// Step 3 |
| 91 | +$url = 'http://www.icqmail.com/' . $matches; |
| 92 | +$result = curl_get( $url, 1, 0 ); |
| 93 | + |
| 94 | +// Step 4 -- HTML only |
| 95 | +$url = 'http://www.icqmail.com/js/nojs.asp?skipjs=1'; |
| 96 | +$result = curl_get( $url, 1, 0 ); |
| 97 | + |
| 98 | +// Step 4 -- open contacts |
| 99 | +$url = 'http://www.icqmail.com/contacts/contacts_import_export.asp?action=export&app=Microsoft%20Outlook'; |
| 100 | +$result = curl_get( $url, 1, 0 ); |
| 101 | + |
| 102 | +// Writing output to csv file |
| 103 | +$myFile = $username; |
| 104 | +$fh = fopen( $myFile, 'w' ) or die( "can't open file" ); |
| 105 | +fwrite( $fh, $result ); |
| 106 | +fclose( $fh ); |
| 107 | + |
| 108 | +// Start of HTML |
| 109 | + |
| 110 | +// [header section - html] |
| 111 | + |
| 112 | +$header = <<<headertext |
| 113 | + |
| 114 | +<html> |
| 115 | +<head> |
| 116 | +<title>MY CONTACTS</title> |
| 117 | +<script type="text/javascript" src="../js/SelectAll.js"></script> |
| 118 | +</head> |
| 119 | +<body> |
| 120 | + |
| 121 | +headertext; |
| 122 | + |
| 123 | +// [RESULTS -TITLE HTML] |
| 124 | + |
| 125 | +$title = <<<titletext |
| 126 | + |
| 127 | +<div align="center"> |
| 128 | +<center> |
| 129 | +<table border="0" width="578"> |
| 130 | +<tr> |
| 131 | +<td width="622"><img height="2" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 132 | +</tr> |
| 133 | +<tr> |
| 134 | +<td align="middle" width="622"> |
| 135 | +<table cellspacing="0" cellpadding="0" width="640" border="0"> |
| 136 | +<tbody> |
| 137 | +<tr> |
| 138 | +<td width="5" height="5"><img height="5" alt="" src="../images/tls.gif" width="5" border="0" /></td> |
| 139 | +<td background="../images/t.gif" colspan="2" width="716"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 140 | +<td width="6" height="5"><img height="5" alt="" src="../images/trs.gif" width="5" border="0" /></td> |
| 141 | +</tr> |
| 142 | +<tr> |
| 143 | +<td width="5" background="../images/l.gif" height="5"><img height="5" alt="" src="../images/spacer.gif" width="5" border="0" /></td> |
| 144 | +<td width="6"><img height="1" alt="" src="../images/spacer.gif" width=6 border="0" /></td> |
| 145 | +<td valign="top" width="704"> |
| 146 | +<table border="0" width="100%"> |
| 147 | +<tr> |
| 148 | +<td width="100%" bgcolor="#D7D8DF"> |
| 149 | +<p align="center"><font face="Arial" size="3" color="#333333">My Contacts</font> |
| 150 | +</td> |
| 151 | +</tr> |
| 152 | +</table> |
| 153 | +<p align="center"> |
| 154 | + |
| 155 | +titletext; |
| 156 | + |
| 157 | + echo $title; |
| 158 | + |
| 159 | + // [RESULTS - START OF FORM] |
| 160 | + |
| 161 | + echo '<form id="form_id" name="myform" method="post" action="postage.php">'; |
| 162 | + |
| 163 | + echo '<div align="center"><center><table border="0" cellpadding="3" cellspacing="6" width="100%">'; |
| 164 | + |
| 165 | + // Opening csv file for processing |
| 166 | + $fp = fopen( $username, 'r' ); |
| 167 | + |
| 168 | + while( !feof( $fp ) ) { |
| 169 | + $data = fgetcsv( $fp, 4100, ',' ); // this uses the fgetcsv function to store the quote info in the array $data |
| 170 | + |
| 171 | + $dataname = $data[0]; |
| 172 | + |
| 173 | + if( empty( $dataname ) ) { |
| 174 | + $dataname = $data[1]; |
| 175 | + } |
| 176 | + |
| 177 | + if( empty( $dataname ) ) { |
| 178 | + $dataname = $data[2]; |
| 179 | + } |
| 180 | + |
| 181 | + if( empty( $dataname ) ) { |
| 182 | + $dataname = 'None'; |
| 183 | + } |
| 184 | + |
| 185 | + $email = $data[3]; // different csv to lycos and yahoo etc |
| 186 | + |
| 187 | + if( empty( $email ) ) { |
| 188 | + // Skip table |
| 189 | + } else { |
| 190 | + $email = $data[3]; |
| 191 | + |
| 192 | + if( $dataname != 'First Name' ) { |
| 193 | + echo '<tr> |
| 194 | + <td width="22" bgcolor="#F5F5F5"><input type="checkbox" name="list[]" value="' . $email . '" checked="checked" /></td> |
| 195 | + <td width="269" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $dataname . '</font></td> |
| 196 | + <td width="296" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $email . '</font></td> |
| 197 | + <input type="hidden" name="sendersemail" size="20" value="' . $fullemail . '" /> |
| 198 | + </tr>'; |
| 199 | + } |
| 200 | + } |
| 201 | + } |
| 202 | + echo '</table></center></div>'; |
| 203 | + |
| 204 | +$footer = <<<footertext |
| 205 | + |
| 206 | +<table border="0" width="100%"> |
| 207 | +<tr> |
| 208 | +<td width="100%"> |
| 209 | +<p align="center"><input type="submit" value="Send Email To Contacts" name="B1" style="background-color: #808080; color: #FFFFFF; font-family: Arial; font-size: 10pt; font-weight: bold; border: 1 solid #333333"></p> |
| 210 | +</form> |
| 211 | +</td> |
| 212 | +</tr> |
| 213 | +</table> |
| 214 | +<img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 215 | +<td width="6" background="../images/r.gif" height="5"><img height=1 alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 216 | +</tr> |
| 217 | +<tr> |
| 218 | +<td width="5" height="5"><img height="5" alt="" src="../images/bls.gif" width="5" border="0" /></td> |
| 219 | +<td background="../images/b.gif" colspan="2" width="716"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 220 | +<td width="6" height="5"><img height="5" alt="" src="../images/brs.gif" width="5" border="0" /></td> |
| 221 | +</tr> |
| 222 | +</tbody></table></td> |
| 223 | +</tr> |
| 224 | +</table> |
| 225 | +</center></div> |
| 226 | + |
| 227 | +footertext; |
| 228 | + |
| 229 | + echo $footer; |
| 230 | + |
| 231 | + unlink( $username ); // deleting csv file |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/rediffmailcookie.txt |
— | — | @@ -0,0 +1,10 @@ |
| 2 | +# Netscape HTTP Cookie File |
| 3 | +# http://www.netscape.com/newsref/std/cookie_spec.html |
| 4 | +# This file was generated by libcurl! Edit at your own risk. |
| 5 | + |
| 6 | +.rediff.com TRUE / FALSE 0 Rm 379816a3ab8769181bcd6f30c503449c%3D%3DgMyQTO1czN2ETM |
| 7 | +.rediff.com TRUE / FALSE 0 Rl brianshawa |
| 8 | +.rediff.com TRUE / FALSE 0 Rsc 4L21PK1KLKqUJR9ClEzrHTzOEhQCqr90 |
| 9 | +.rediff.com TRUE / FALSE -1 Rp g%3D2%26a%3D30%26c%3D75%26s%3D30%26cn%3D221%26z%3D000000%26p%3D100%26e%3D16%26d%3D%5F9%5F%26i%3D%5F35%5F |
| 10 | +.rediff.com TRUE / FALSE 0 Rlo Brian+ngana |
| 11 | +.rediff.com TRUE / FALSE 0 accounttype 80 |
Index: trunk/extensions/InviteContacts/getmycontacts/myyahoo.php |
— | — | @@ -0,0 +1,241 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Yahoo! contact importing script |
| 5 | + */ |
| 6 | + |
| 7 | +$username = $_POST['username']; |
| 8 | + |
| 9 | +$password = $_POST['password']; |
| 10 | + |
| 11 | +$refering_site = 'http://yahoo.com/'; // setting the site for refer |
| 12 | + |
| 13 | +$browser_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)'; // setting browser type |
| 14 | + |
| 15 | +$path_to_cookie = realpath( 'yahoocookie.txt' ); |
| 16 | + |
| 17 | +$setcookie = fopen( $path_to_cookie, 'wb' ); // this opens the file and resets it to zero length |
| 18 | +fclose( $setcookie ); |
| 19 | + |
| 20 | +$form_language = $_REQUEST['language']; |
| 21 | + |
| 22 | +include_once( dirname( __FILE__ ) . '/getmycontactsbase.php' ); |
| 23 | + |
| 24 | +function curl_get( $url, $follow, $debug ) { |
| 25 | + global $path_to_cookie, $browser_agent; |
| 26 | + |
| 27 | + $ch = curl_init(); |
| 28 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 29 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 30 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 31 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 32 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 33 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 34 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, $follow ); |
| 35 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 36 | + $result = curl_exec( $ch ); |
| 37 | + curl_close( $ch ); |
| 38 | + |
| 39 | + if( $debug == 1 ) { |
| 40 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 41 | + } |
| 42 | + |
| 43 | + if( $debug == 2 ) { |
| 44 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 45 | + echo $result; |
| 46 | + } |
| 47 | + |
| 48 | + return $result; |
| 49 | +} |
| 50 | + |
| 51 | +function curl_post( $url, $postal_data, $follow, $debug ) { |
| 52 | + global $path_to_cookie, $browser_agent; |
| 53 | + |
| 54 | + $ch = curl_init(); |
| 55 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 56 | + curl_setopt( $ch, CURLOPT_POST, 1 ); |
| 57 | + curl_setopt( $ch, CURLOPT_POSTFIELDS, $postal_data ); |
| 58 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 59 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 60 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 61 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 62 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 63 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, $follow ); |
| 64 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 65 | + $result = curl_exec( $ch ); |
| 66 | + curl_close( $ch ); |
| 67 | + |
| 68 | + if( $debug == 1 ) { |
| 69 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 70 | + } |
| 71 | + |
| 72 | + if( $debug == 2 ) { |
| 73 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 74 | + echo $result; |
| 75 | + } |
| 76 | + |
| 77 | + return $result; |
| 78 | +} |
| 79 | + |
| 80 | +// Step 1 |
| 81 | +$url = 'https://login.yahoo.com/config/mail?.intl=us'; |
| 82 | +$page_result = curl_get( $url, 1, 0 ); |
| 83 | +preg_match_all( "/name=\".tries\" value=\"(.*?)\"/", $page_result, $tries ); |
| 84 | +$tries_found = $tries[1][0]; |
| 85 | +preg_match_all( "/name=\".src\" value=\"(.*?)\"/", $page_result, $src ); |
| 86 | +$src_found = $src[1][0]; |
| 87 | +preg_match_all( "/name=\".u\" value=\"(.*?)\"/", $page_result, $u ); |
| 88 | +$u_found = $u[1][0]; |
| 89 | +preg_match_all( "/name=\".v\" value=\"(.*?)\"/", $page_result, $v ); |
| 90 | +$v_found = $v[1][0]; |
| 91 | +preg_match_all( "/name=\".challenge\" value=\"(.*?)\"/", $page_result, $challenge ); |
| 92 | +$challenge_found = $challenge[1][0]; |
| 93 | + |
| 94 | +// Step 2 -- submit login info |
| 95 | +$postal_data = '.tries=' . $tries_found . '&.src=' . $src_found . '&.md5=&.hash=&.js=&.last=&promo=&.intl=us&.bypass=&.partner=&.u=6bu841h2d7p4o&.v=0&.challenge=' . $challenge_found . '&.yplus=&.emailCode=&pkg=&stepid=&.ev=&hasMsgr=1&.chkP=Y&.done=http://mail.yahoo.com&.pd=ym_ver%253d0&login=' . $username . '&passwd=' . $password; |
| 96 | +$url = 'https://login.yahoo.com/config/login?'; |
| 97 | +$result = curl_post( $url, $postal_data, 1, 0 ); |
| 98 | +preg_match_all( "/replace\(\"(.*?)\"/", $result, $matches ); |
| 99 | +$matches = $matches[1][0]; |
| 100 | + |
| 101 | +// Step 3 -- redirect |
| 102 | +$url = $matches; |
| 103 | +$result = curl_get( $url, 1, 0 ); |
| 104 | + |
| 105 | +// Step 4 -- redirect |
| 106 | +$url = 'http://us.rd.yahoo.com/mail_us/pimnav/ab/*http://address.mail.yahoo.com'; |
| 107 | +$result = curl_get( $url, 1, 0 ); |
| 108 | + |
| 109 | +// Step 5 -- open address book |
| 110 | +$url = 'http://address.mail.yahoo.com'; |
| 111 | +$result = curl_get( $url, 1, 0 ); |
| 112 | +preg_match_all( "/rand=(.*?)\"/", $result, $array_names ); |
| 113 | +$rand_value = str_replace( '"', '', $array_names[0][0] ); |
| 114 | + |
| 115 | +// Step 6 -- export address book |
| 116 | +$url = 'http://address.mail.yahoo.com/?1&VPC=import_export&A=B&.rand=' . $randURL; |
| 117 | +$result = curl_get( $url, 1, 0 ); |
| 118 | +preg_match_all( "/id=\"crumb1\" value=\"(.*?)\"/", $result, $array_names ); |
| 119 | +$crumb = $array_names[1][0]; |
| 120 | + |
| 121 | +// Step 7 -- checking if address book is empty |
| 122 | +if( empty( $crumb ) ) { |
| 123 | + echo '<p align="center"><font face="Verdana" size="2"><b>' . $messages['no_details_found'] . ':</b> ' . $messages['makesurecorrectlogin'] . '.</font></p><p align="center">'; |
| 124 | +} else { |
| 125 | + // Step 8 -- submit login info |
| 126 | + $postal_data = '.crumb=' . $crumb . '&VPC=import_export&A=B&submit%5Baction_export_yahoo%5D=Export+Now'; |
| 127 | + $url = 'http://address.mail.yahoo.com/index.php'; |
| 128 | + $result = curl_post( $url, $postal_data, 1, 0 ); |
| 129 | + |
| 130 | + // Step 9 -- start of results |
| 131 | + // Writing output to csv file |
| 132 | + $myFile = $username; |
| 133 | + $fh = fopen( $myFile, 'w' ) or die( "can't open file" ); |
| 134 | + fwrite( $fh, $result ); |
| 135 | + fclose( $fh ); |
| 136 | + |
| 137 | +// [header section - html] |
| 138 | + |
| 139 | +$header = <<<headertext |
| 140 | + |
| 141 | +<html> |
| 142 | +<head> |
| 143 | +<title>{$messages['my_contacts']}</title> |
| 144 | +<script type="text/javascript" src="../js/SelectAll.js"></script> |
| 145 | +</head> |
| 146 | +<body> |
| 147 | + |
| 148 | +headertext; |
| 149 | + |
| 150 | + echo '<form id="form_id" name="myform" method="post" action="">'; |
| 151 | + echo '<h1>Your contacts</h1> |
| 152 | + <p class="contacts-message"> |
| 153 | + <span class="profile-on">' . $messages['sharefriends'] . '.</span> |
| 154 | + </p> |
| 155 | + <p class="contacts-message"> |
| 156 | + <input type="submit" class="invite-form-button" value="' . $messages['inviteyourfriends'] . '" name="B1" /> <a href="javascript:toggleChecked()">' . $messages['uncheckall'] . '</a> |
| 157 | + </p> |
| 158 | + <div class="contacts-title-row"> |
| 159 | + <p class="contacts-checkbox"></p> |
| 160 | + <p class="contacts-title">' |
| 161 | + . $messages['friendname'] . |
| 162 | + '</p> |
| 163 | + <p class="contacts-title">' |
| 164 | + . $messages['emailtitle'] . |
| 165 | + '</p> |
| 166 | + <div class="cleared"></div> |
| 167 | + </div> |
| 168 | + <div class="contacts">'; |
| 169 | + |
| 170 | + // [RESULTS - START OF FORM] |
| 171 | + |
| 172 | + // Opening csv file for processing |
| 173 | + $fp = fopen( $username, 'r' ); |
| 174 | + while( !feof( $fp ) ) { |
| 175 | + $data = fgetcsv( $fp, 4100, ',' ); // this uses the fgetcsv function to store the quote info in the array $data |
| 176 | + $dataname = $data[0]; |
| 177 | + |
| 178 | + if( empty( $dataname ) ) { |
| 179 | + $dataname = $data[2]; |
| 180 | + } |
| 181 | + if( empty( $dataname ) ) { |
| 182 | + $dataname = $data[3]; |
| 183 | + } |
| 184 | + |
| 185 | + $email = $data[4]; |
| 186 | + if( !$dataname ) { |
| 187 | + $dataname = $email; |
| 188 | + } |
| 189 | + |
| 190 | + if( !empty( $email ) && $dataname != 'First' ) { // Skip table if email is blank |
| 191 | + $addresses[] = array( |
| 192 | + 'name' => $dataname, |
| 193 | + 'email' => $email |
| 194 | + ); |
| 195 | + } |
| 196 | + } |
| 197 | + |
| 198 | + if( $addresses ) { |
| 199 | + usort( $addresses, 'sortContacts' ); |
| 200 | + foreach( $addresses as $address ) { |
| 201 | + echo '<div class="contacts-row"> |
| 202 | + <p class="contacts-checkbox"> |
| 203 | + <input type="checkbox" name="list[]" value="' . $address['email'] . '" checked="checked" /> |
| 204 | + </p> |
| 205 | + <p class="contacts-cell">' |
| 206 | + . $address['name'] . |
| 207 | + '</p> |
| 208 | + <p class="contacts-cell">' |
| 209 | + . $address['email'] . |
| 210 | + '</p> |
| 211 | + <input type="hidden" name="sendersemail" size="20" value="' . $username . '" /> |
| 212 | + <div class="cleared"></div> |
| 213 | + </div>'; |
| 214 | + } |
| 215 | + } |
| 216 | + |
| 217 | + echo '</table></center></div>'; |
| 218 | + |
| 219 | +$footer = <<<footertext |
| 220 | + |
| 221 | +<p> |
| 222 | +<input type="submit" class="invite-form-button" value="{$messages['inviteyourfriends']}" name="B1" /> |
| 223 | +<a href="javascript:toggleChecked()">{$messages['uncheckall']}</a> |
| 224 | +</p> |
| 225 | +</form> |
| 226 | + |
| 227 | +footertext; |
| 228 | + |
| 229 | + echo $footer; |
| 230 | + |
| 231 | + unlink( $username ); // deleting csv file |
| 232 | +} |
| 233 | + |
| 234 | +function sortContacts( $x, $y ) { |
| 235 | + if ( strtoupper( $x['name'] ) == strtoupper( $y['name'] ) ) { |
| 236 | + return 0; |
| 237 | + } elseif ( strtoupper( $x['name'] ) < strtoupper( $y['name'] ) ) { |
| 238 | + return -1; |
| 239 | + } else { |
| 240 | + return 1; |
| 241 | + } |
| 242 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/getmycontacts/mymail.php |
— | — | @@ -0,0 +1,246 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Mail.com contact importing script -- csv version |
| 5 | + */ |
| 6 | + |
| 7 | +$username = $_POST['username']; |
| 8 | + |
| 9 | +$password = $_POST['password']; |
| 10 | + |
| 11 | +$refering_site = 'http://yahoo.com/'; // setting the site for refer |
| 12 | + |
| 13 | +$browser_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)'; // setting browser type |
| 14 | + |
| 15 | +$path_to_cookie = realpath( 'mailcookie.txt' ); |
| 16 | + |
| 17 | +$setcookie = fopen( $path_to_cookie, 'wb' ); // this opens the file and resets it to zero length |
| 18 | +fclose( $setcookie ); |
| 19 | + |
| 20 | +function curl_get( $url, $follow, $debug ) { |
| 21 | + global $path_to_cookie, $browser_agent; |
| 22 | + |
| 23 | + $ch = curl_init(); |
| 24 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 25 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 26 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 27 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 28 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 29 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 30 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, $follow ); |
| 31 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 32 | + $result = curl_exec( $ch ); |
| 33 | + curl_close( $ch ); |
| 34 | + |
| 35 | + if( $debug == 1 ) { |
| 36 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 37 | + } |
| 38 | + |
| 39 | + if( $debug == 2 ) { |
| 40 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 41 | + echo $result; |
| 42 | + } |
| 43 | + |
| 44 | + return $result; |
| 45 | +} |
| 46 | + |
| 47 | +function curl_post( $url, $postal_data, $follow, $debug ) { |
| 48 | + global $path_to_cookie, $browser_agent; |
| 49 | + |
| 50 | + $ch = curl_init(); |
| 51 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 52 | + curl_setopt( $ch, CURLOPT_POST, 1 ); |
| 53 | + curl_setopt( $ch, CURLOPT_POSTFIELDS, $postal_data ); |
| 54 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 55 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); |
| 56 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
| 57 | + curl_setopt( $ch, CURLOPT_COOKIEJAR, $path_to_cookie ); |
| 58 | + curl_setopt( $ch, CURLOPT_COOKIEFILE, $path_to_cookie ); |
| 59 | + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, $follow ); |
| 60 | + curl_setopt( $ch, CURLOPT_USERAGENT, $browser_agent ); |
| 61 | + $result = curl_exec( $ch ); |
| 62 | + curl_close( $ch ); |
| 63 | + |
| 64 | + if( $debug == 1 ) { |
| 65 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 66 | + } |
| 67 | + |
| 68 | + if( $debug == 2 ) { |
| 69 | + echo '<textarea rows="30" cols="120">' . $result . '</textarea>'; |
| 70 | + echo $result; |
| 71 | + } |
| 72 | + |
| 73 | + return $result; |
| 74 | +} |
| 75 | + |
| 76 | +// Step 1 |
| 77 | +$url = 'http://www.mail.com/scripts/common/index.main?signin=1&lang=us'; |
| 78 | +$page_result = curl_get( $url, 1, 0 ); |
| 79 | +preg_match_all( "/name=\"u\" value=\"(.*?)\"/", $page_result, $matches ); |
| 80 | +$u = $matches[1][0]; |
| 81 | +preg_match_all( "/name=\"v\" value=\"(.*?)\"/", $page_result, $matches ); |
| 82 | +$v = $matches[1][0]; |
| 83 | + |
| 84 | +// Step 2 |
| 85 | +$postal_data = 'show_frame=Enter&action=login&mail_language=us&u=' . $u . 'v=' . $v . '&longlogin=1&domain=mail.com&login=' . $username . '&password=' . $password . '&siteselected=normal'; |
| 86 | +$url = 'http://www.mail.com/scripts/common/proxy.main'; |
| 87 | +$result = curl_post( $url, $postal_data, 1, 0 ); |
| 88 | +preg_match_all( "/url=(.*?)\/templates/", $result, $matches ); |
| 89 | +$base = $matches[1][0]; |
| 90 | + |
| 91 | +// Step 1 |
| 92 | +$url = $base . '/scripts/addr/addressbook.cgi?showaddressbook=1'; |
| 93 | +$page_result = curl_get( $url, 1, 0 ); |
| 94 | +preg_match_all( "/ob=(.*?)&gab=1/", $page_result, $matches ); |
| 95 | +$ob = $matches[1][0]; |
| 96 | + |
| 97 | +// Step 1 |
| 98 | +$url = $base . '/scripts/addr/external.cgi?.ob=' . $ob . '&gab=1'; |
| 99 | +$page_result = curl_get( $url, 1, 0 ); |
| 100 | + |
| 101 | +// Step 2 |
| 102 | +$postal_data ='showexport=showexport&action=export&format=csv'; |
| 103 | +$url = $base.'/scripts/addr/external.cgi?.ob=' . $ob . '&gab=1'; |
| 104 | +$result = curl_post( $url, $postal_data, 1, 0 ); |
| 105 | + |
| 106 | +// Writing the results to a csv file on the server |
| 107 | +$myFile = $username; |
| 108 | +$fh = fopen( $myFile, 'w' ) or die( "can't open file" ); |
| 109 | +fwrite( $fh, $result ); |
| 110 | +fclose( $fh ); |
| 111 | + |
| 112 | +// Checking if login was successful -- by searching for the @ sign in the csv |
| 113 | +preg_match_all( "/@/", $result, $array_at ); |
| 114 | + |
| 115 | +$at_sign = $array_at[0]; |
| 116 | + |
| 117 | +if( empty( $at_sign ) ) { |
| 118 | + echo '<p align="center"><font face="Verdana" size="2"><b>No Details Found:</b> Please make sure you have entered correct login details and try again.</font></p><p align="center">'; |
| 119 | +} else { |
| 120 | + // Start of HTML |
| 121 | + // [header section - html] |
| 122 | + |
| 123 | +$header = <<<headertext |
| 124 | + |
| 125 | +<html> |
| 126 | +<head> |
| 127 | +<title>CONTACTS</title> |
| 128 | +<script type="text/javascript" src="../js/SelectAll.js"></script> |
| 129 | +</head> |
| 130 | +<body> |
| 131 | + |
| 132 | +headertext; |
| 133 | + |
| 134 | + echo $header; |
| 135 | + |
| 136 | +// [RESULTS -TITLE HTML] |
| 137 | + |
| 138 | +$title = <<<titletext |
| 139 | + |
| 140 | +<body> |
| 141 | +<div align="center"> |
| 142 | +<center> |
| 143 | +<table border="0" width="578"> |
| 144 | +<tr> |
| 145 | +<td width="622"><img height="2" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 146 | +</tr> |
| 147 | +<tr> |
| 148 | +<td align="middle" width="622"> |
| 149 | +<table cellspacing="0" cellpadding="0" width="640" border="0"> |
| 150 | +<tbody> |
| 151 | +<tr> |
| 152 | +<td width="5" height="5"><img height="5" alt="" src="../images/tls.gif" width="5" border="0" /></td> |
| 153 | +<td background="../images/t.gif" colspan="2" width="716"><img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 154 | +<td width="6" height="5"><img height="5" alt="" src="../images/trs.gif" width="5" border="0" /></td> |
| 155 | +</tr> |
| 156 | +<tr> |
| 157 | +<td width="5" background="../images/l.gif" height="5"><img height=5 alt="" src="../images/spacer.gif" width="5" border="0"></td> |
| 158 | +<td width="6"><img height="1" alt="" src="../images/spacer.gif" width="6" border="0" /></td> |
| 159 | +<td valign="top" width="704"> |
| 160 | +<table border="0" width="100%"> |
| 161 | +<tr> |
| 162 | +<td width="100%" bgcolor="#D7D8DF"> |
| 163 | +<p align="center"><font face="Arial" size="3" color="#333333">My Contacts</font> |
| 164 | +</td> |
| 165 | +</tr> |
| 166 | +</table> |
| 167 | +<p align="center"> |
| 168 | + |
| 169 | +titletext; |
| 170 | + |
| 171 | + echo $title; |
| 172 | + |
| 173 | + // [RESULTS - START OF FORM] |
| 174 | + echo '<form id="form_id" name="myform" method="post" action="">'; |
| 175 | + echo '<div align="center"><center><table border="0" cellpadding="3" cellspacing="6" width="100%">'; |
| 176 | + |
| 177 | + // Opening the stored csv file and turning it into an array |
| 178 | + $fp = fopen( $username, 'r' ); |
| 179 | + |
| 180 | + while( !feof( $fp ) ) { |
| 181 | + $data = fgetcsv( $fp, 4100, ',' ); // this uses the fgetcsv function to store the quote info in the array $data |
| 182 | + |
| 183 | + $dataname = $data[0]; |
| 184 | + |
| 185 | + if( empty( $dataname ) ) { |
| 186 | + $dataname = $data[2]; |
| 187 | + } |
| 188 | + |
| 189 | + if( empty( $dataname ) ) { |
| 190 | + $dataname = $data[3]; |
| 191 | + } |
| 192 | + |
| 193 | + if( empty( $dataname ) ) { |
| 194 | + $dataname = 'None'; |
| 195 | + } |
| 196 | + |
| 197 | + $email = $data[4]; |
| 198 | + |
| 199 | + if( empty( $email ) ) { |
| 200 | + // Skip table |
| 201 | + } else { |
| 202 | + $email = $data[4]; |
| 203 | + |
| 204 | + if( $dataname != 'First Name' ) { |
| 205 | + echo '<tr> |
| 206 | + <td width="22" bgcolor="#F5F5F5"><input type="checkbox" name="list[]" value="' . $data[4] . '" checked="checked" /></td> |
| 207 | + <td width="269" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $dataname . '</font></td> |
| 208 | + <td width="296" bgcolor="#F5F5F5"><p align="center"><font face="Verdana" size="2">' . $data[4] . '</font></td> |
| 209 | + <input type="hidden" name="sendersemail" size="20" value="' . $username . '" /> |
| 210 | + </tr>'; |
| 211 | + } |
| 212 | + } |
| 213 | + } |
| 214 | + echo '</table></center></div>'; |
| 215 | + |
| 216 | +$footer = <<<footertext |
| 217 | + |
| 218 | +<table border="0" width="100%"> |
| 219 | +<tr> |
| 220 | +<td width="100%"> |
| 221 | +<p align="center"><input type="submit" value="Send Email To Contacts" name="B1" style="background-color: #808080; color: #FFFFFF; font-family: Arial; font-size: 10pt; font-weight: bold; border: 1 solid #333333"></p> |
| 222 | +</form> |
| 223 | +</td> |
| 224 | +</tr> |
| 225 | +</table> |
| 226 | +<img height="1" alt="" src="../images/spacer.gif" width="1" border="0" /> |
| 227 | +</td> |
| 228 | +<td width="6" background="../images/r.gif" height="5"><img height=1 alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 229 | +</tr> |
| 230 | +<tr> |
| 231 | +<td width="5" height="5"><img height="5" alt="" src="images/bls.gif" width="5" border="0" /></td> |
| 232 | +<td background="../images/b.gif" colspan="2" width="716"><img height=1 alt="" src="../images/spacer.gif" width="1" border="0" /></td> |
| 233 | +<td width="6" height="5"><img height="5" alt="" src="../images/brs.gif" width="5" border="0" /></td> |
| 234 | +</tr> |
| 235 | +</tbody> |
| 236 | +</table> |
| 237 | +</td> |
| 238 | +</tr> |
| 239 | +</table> |
| 240 | +</center></div> |
| 241 | +</body></html> |
| 242 | + |
| 243 | +footertext; |
| 244 | + |
| 245 | + echo $footer; |
| 246 | +} |
| 247 | +unlink( $username ); // deleting csv file |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/ImportContactsClass.php |
— | — | @@ -0,0 +1,30 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * ImportContacts class |
| 5 | + */ |
| 6 | +class ImportContacts { |
| 7 | + |
| 8 | + /** |
| 9 | + * All member variables should be considered private |
| 10 | + * Please use the accessor functions |
| 11 | + */ |
| 12 | + |
| 13 | + /**#@+ |
| 14 | + * @private |
| 15 | + */ |
| 16 | + var $email; # Text form (spaces not underscores) of the main part |
| 17 | + var $password; # Text form (spaces not underscores) of the main part |
| 18 | + |
| 19 | + /** |
| 20 | + * Constructor |
| 21 | + * @private |
| 22 | + */ |
| 23 | + /* private */ function __construct( $email, $password ) { |
| 24 | + $this->email = $email; |
| 25 | + $this->password = $password; |
| 26 | + } |
| 27 | + |
| 28 | + public function getContacts() { |
| 29 | + return $this->contacts; |
| 30 | + } |
| 31 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/images/spacer.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/spacer.gif |
___________________________________________________________________ |
Added: svn:mime-type |
1 | 32 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/loading.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/loading.gif |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 33 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/userTabOff.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/userTabOff.png |
___________________________________________________________________ |
Added: svn:mime-type |
3 | 34 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/bls.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/bls.gif |
___________________________________________________________________ |
Added: svn:mime-type |
4 | 35 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/mythunderbird.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/mythunderbird.gif |
___________________________________________________________________ |
Added: svn:mime-type |
5 | 36 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/userTabOn.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/userTabOn.png |
___________________________________________________________________ |
Added: svn:mime-type |
6 | 37 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/b.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/b.gif |
___________________________________________________________________ |
Added: svn:mime-type |
7 | 38 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/myaol.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/myaol.gif |
___________________________________________________________________ |
Added: svn:mime-type |
8 | 39 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/myicq.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/myicq.gif |
___________________________________________________________________ |
Added: svn:mime-type |
9 | 40 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/myyahoo.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/myyahoo.gif |
___________________________________________________________________ |
Added: svn:mime-type |
10 | 41 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/brs.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/brs.gif |
___________________________________________________________________ |
Added: svn:mime-type |
11 | 42 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/mymail.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/mymail.gif |
___________________________________________________________________ |
Added: svn:mime-type |
12 | 43 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/l.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/l.gif |
___________________________________________________________________ |
Added: svn:mime-type |
13 | 44 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/myindiatimes.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/myindiatimes.gif |
___________________________________________________________________ |
Added: svn:mime-type |
14 | 45 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/mygmail.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/mygmail.gif |
___________________________________________________________________ |
Added: svn:mime-type |
15 | 46 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/mylycos.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/mylycos.gif |
___________________________________________________________________ |
Added: svn:mime-type |
16 | 47 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/myexpress.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/myexpress.gif |
___________________________________________________________________ |
Added: svn:mime-type |
17 | 48 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/r.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/r.gif |
___________________________________________________________________ |
Added: svn:mime-type |
18 | 49 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/myoutlook.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/myoutlook.gif |
___________________________________________________________________ |
Added: svn:mime-type |
19 | 50 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/tls.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/tls.gif |
___________________________________________________________________ |
Added: svn:mime-type |
20 | 51 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/myhotmail.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/myhotmail.gif |
___________________________________________________________________ |
Added: svn:mime-type |
21 | 52 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/t.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/t.gif |
___________________________________________________________________ |
Added: svn:mime-type |
22 | 53 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/myrediffmail.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/myrediffmail.gif |
___________________________________________________________________ |
Added: svn:mime-type |
23 | 54 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/images/trs.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/InviteContacts/images/trs.gif |
___________________________________________________________________ |
Added: svn:mime-type |
24 | 55 | + application/octet-stream |
Index: trunk/extensions/InviteContacts/css/invite.css |
— | — | @@ -0,0 +1,246 @@ |
| 2 | +/** Invite Box **/ |
| 3 | +.invite-email-sent { |
| 4 | + color: #285C98; |
| 5 | + font-size: 11px; |
| 6 | + width: 200px; |
| 7 | + float: left; |
| 8 | + padding: 4px 4px 10px 4px; |
| 9 | + margin: 0px 10px 10px 0px; |
| 10 | +} |
| 11 | + |
| 12 | +.invite-message { |
| 13 | + color: #666666; |
| 14 | + font-size: 1.1em; |
| 15 | + margin: 5px 0px 5px 0px; |
| 16 | +} |
| 17 | + |
| 18 | +.invite-left { |
| 19 | + float: left; |
| 20 | + border: 1px solid #DCDCDC; |
| 21 | + width: 500px; |
| 22 | + padding: 10px; |
| 23 | + margin: 0px 10px 0px 0px; |
| 24 | +} |
| 25 | + |
| 26 | +.invite-right { |
| 27 | + float: left; |
| 28 | + border: 1px solid #DCDCDC; |
| 29 | + width: 250px; |
| 30 | + padding: 5px 5px 10px 5px; |
| 31 | + text-align: center; |
| 32 | + height: 149px; |
| 33 | +} |
| 34 | + |
| 35 | +.invite-right h1 { |
| 36 | + font-size: 1.1em; |
| 37 | + font-weight: bold; |
| 38 | + color: #666666; |
| 39 | +} |
| 40 | + |
| 41 | +.invite-right-image { |
| 42 | + float: left; |
| 43 | + text-align: center; |
| 44 | + margin: 0px 0px 0px 48px !important; |
| 45 | +} |
| 46 | + |
| 47 | +.invite-links { |
| 48 | + margin: 0px 0px 10px 0px; |
| 49 | + font-weight: bold; |
| 50 | +} |
| 51 | + |
| 52 | +.invite-links a { |
| 53 | + text-decoration: none; |
| 54 | +} |
| 55 | + |
| 56 | +.invite-icons { |
| 57 | + margin: 10px 0px 10px 0px; |
| 58 | + width: 500px; |
| 59 | +} |
| 60 | + |
| 61 | +.invite-form { |
| 62 | + width: 500px; |
| 63 | +} |
| 64 | + |
| 65 | +.invite-form-title { |
| 66 | + float: left; |
| 67 | + width: 200px; |
| 68 | + margin: 0px 0px 11px 0px; |
| 69 | + color: #285C98; |
| 70 | + font-weight: 800; |
| 71 | + font-size: 12px; |
| 72 | +} |
| 73 | + |
| 74 | +.invite-form-input { |
| 75 | + float: left; |
| 76 | + margin: 0px 0px 11px 0px; |
| 77 | + width: 300px; |
| 78 | +} |
| 79 | + |
| 80 | +.invite-form-button { |
| 81 | + background-color: #78BA5D; |
| 82 | + border: 1px solid #285C98; |
| 83 | + margin: 10px 0px 0px 0px; |
| 84 | + color: #FFFFFF; |
| 85 | + font-size: 1.0em; |
| 86 | + font-weight: bold; |
| 87 | +} |
| 88 | + |
| 89 | +/** Invite Email **/ |
| 90 | +.invite-email-title { |
| 91 | + color: #FFD242; |
| 92 | + font-size: 1.2em; |
| 93 | + font-weight: bold; |
| 94 | +} |
| 95 | + |
| 96 | +.invite-form-enter-email { |
| 97 | + float: left; |
| 98 | + margin: 0px 30px 0px 0px; |
| 99 | +} |
| 100 | + |
| 101 | +.invite-email-submessage { |
| 102 | + color: #666666; |
| 103 | + font-size: 1.05em; |
| 104 | +} |
| 105 | + |
| 106 | +.email-to { |
| 107 | + float: left; |
| 108 | +} |
| 109 | + |
| 110 | +.invite-email-content { |
| 111 | + float: left; |
| 112 | +} |
| 113 | + |
| 114 | +.email-field { |
| 115 | + font-weight: 800; |
| 116 | + font-size: 13px; |
| 117 | + color: #666666; |
| 118 | + padding-bottom: 0px; |
| 119 | +} |
| 120 | + |
| 121 | +.email-field textarea { |
| 122 | + overflow-x: hidden; |
| 123 | + overflow-y: auto; |
| 124 | +} |
| 125 | + |
| 126 | +.email-field input { |
| 127 | + width: 350px; |
| 128 | +} |
| 129 | + |
| 130 | +.invite-title { |
| 131 | + font-size: 15px; |
| 132 | + padding-bottom: 5px; |
| 133 | +} |
| 134 | + |
| 135 | +.profile-on { |
| 136 | + background-color: #FFFB9B; |
| 137 | + font-weight: bold; |
| 138 | + padding: 0px 5px 0px 5px; |
| 139 | +} |
| 140 | + |
| 141 | +.cleared { |
| 142 | + clear: both; |
| 143 | +} |
| 144 | + |
| 145 | +/** Contact List **/ |
| 146 | +.contacts { |
| 147 | + max-height: 300px; |
| 148 | + overflow-x: hidden; |
| 149 | + overflow-y: auto; |
| 150 | + border: 1px solid #DCDCDC; |
| 151 | +} |
| 152 | + |
| 153 | +.contacts-title-row { |
| 154 | + background-color: #DCDCDC; |
| 155 | +} |
| 156 | + |
| 157 | +.contacts-title { |
| 158 | + float: left; |
| 159 | + font-size: 13px; |
| 160 | + font-weight: bold; |
| 161 | + width: 300px; |
| 162 | +} |
| 163 | + |
| 164 | +.contacts-message { |
| 165 | + padding: 0px 0px 10px 0px; |
| 166 | +} |
| 167 | + |
| 168 | +.contacts-row { |
| 169 | + margin: 10px 0px 0px 0px; |
| 170 | + padding: 0px 0px 10px 0px; |
| 171 | + border-bottom: 1px solid #DCDCDC; |
| 172 | +} |
| 173 | + |
| 174 | +.contacts-checkbox { |
| 175 | + float: left; |
| 176 | + width: 75px; |
| 177 | +} |
| 178 | + |
| 179 | +.contacts-cell { |
| 180 | + float: left; |
| 181 | + width: 300px; |
| 182 | +} |
| 183 | + |
| 184 | +.contacts-loading { |
| 185 | + padding: 5px; |
| 186 | + font-size: 1.2em; |
| 187 | + font-weight: bold; |
| 188 | + color: #285C98; |
| 189 | + text-align: center; |
| 190 | +} |
| 191 | + |
| 192 | +.user-page-tabs { |
| 193 | + margin: 0px 0px 20px 0px; |
| 194 | +} |
| 195 | + |
| 196 | +.user-tab-end { |
| 197 | + float: left; |
| 198 | + padding: 23px 0px 0px 0px !important; |
| 199 | + border-bottom: 1px solid #dcdcdc; |
| 200 | + width: 100px; |
| 201 | +} |
| 202 | + |
| 203 | +#user-tab-on { |
| 204 | + float: left; |
| 205 | + background-image: url("../images/userTabOn.png"); |
| 206 | + background-repeat: no-repeat; |
| 207 | + width: 86px; |
| 208 | + height: 24px; |
| 209 | + padding: 5px 0px 3px 0px; |
| 210 | + text-align: center; |
| 211 | +} |
| 212 | + |
| 213 | +#user-tab-off { |
| 214 | + float: left; |
| 215 | + background-image: url("../images/userTabOff.png"); |
| 216 | + background-repeat: no-repeat; |
| 217 | + width: 86px; |
| 218 | + height: 24px; |
| 219 | + padding: 5px 0px 3px 0px; |
| 220 | + text-align: center; |
| 221 | +} |
| 222 | + |
| 223 | +#user-tab-on a, #user-tab-off a { |
| 224 | + text-decoration: none; |
| 225 | +} |
| 226 | + |
| 227 | +.relationship-request-buttons { |
| 228 | + margin: 10px 0px 10px 0px; |
| 229 | +} |
| 230 | + |
| 231 | +.relationship-request-button { |
| 232 | + background-color: #78BA5D; |
| 233 | + border: 1px solid #285C98; |
| 234 | + color: #FFFFFF; |
| 235 | + font-size: 1.0em; |
| 236 | +} |
| 237 | + |
| 238 | +.user-message { |
| 239 | + color: #797979; |
| 240 | + font-size: 12pt; |
| 241 | + margin: 0px 0px 10px 0px; |
| 242 | +} |
| 243 | + |
| 244 | +.invite-email-text { |
| 245 | + border: 1px solid #DCDCDC; |
| 246 | + background-color: #F2F2F2; |
| 247 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/css/EmailNewArticle.css |
— | — | @@ -0,0 +1,24 @@ |
| 2 | +/* Styles for Special:EmailNewArticle */ |
| 3 | +.email-new-article-box { |
| 4 | + background-color: #78BA5D; |
| 5 | + border: 1px solid #285C98; |
| 6 | + color: #ffffff; |
| 7 | + float: left; |
| 8 | + padding: 5px; |
| 9 | + font-size: 1.1em; |
| 10 | + margin: 0px 10px 0px 0px; |
| 11 | + width: 150px; |
| 12 | + text-align: center; |
| 13 | +} |
| 14 | + |
| 15 | +.email-new-article-box a { |
| 16 | + text-decoration: none; |
| 17 | + color: #ffffff; |
| 18 | +} |
| 19 | + |
| 20 | +.email-new-article-message { |
| 21 | + font-size: 1.1em; |
| 22 | + color: #666666; |
| 23 | + margin: 0px 0px 15px 0px; |
| 24 | + width: 500px; |
| 25 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/SpecialEmailNewArticle.php |
— | — | @@ -0,0 +1,41 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class EmailNewArticle extends UnlistedSpecialPage { |
| 5 | + |
| 6 | + /** |
| 7 | + * Constructor |
| 8 | + */ |
| 9 | + public function __construct() { |
| 10 | + parent::__construct( 'EmailNewArticle' ); |
| 11 | + } |
| 12 | + |
| 13 | + /** |
| 14 | + * Show the special page |
| 15 | + * |
| 16 | + * @param $par Mixed: parameter passed to the page or null |
| 17 | + */ |
| 18 | + public function execute( $par ) { |
| 19 | + global $wgOut, $wgRequest, $wgScriptPath; |
| 20 | + wfLoadExtensionMessages( 'InviteContacts' ); |
| 21 | + $wgOut->setPageTitle( wfMsg( 'invite-sharearticle' ) ); |
| 22 | + |
| 23 | + $pageFromRequest = $wgRequest->getVal( 'page' ); |
| 24 | + if ( isset( $pageFromRequest ) ) { |
| 25 | + $page = $pageFromRequest; |
| 26 | + } elseif ( isset( $par ) ) { |
| 27 | + $page = $par; |
| 28 | + } |
| 29 | + $new_page = Title::makeTitle( NS_MAIN, $page ); |
| 30 | + $invite = SpecialPage::getTitleFor( 'InviteEmail' ); |
| 31 | + |
| 32 | + $wgOut->addExtensionStyle( $wgScriptPath . '/extensions/InviteContacts/css/EmailNewArticle.css' ); |
| 33 | + |
| 34 | + $wgOut->addHTML( |
| 35 | + '<div class="email-new-article-message">' |
| 36 | + . wfMsg( 'send-new-article-to-friends-message' ) . |
| 37 | + '</div> |
| 38 | + <input type="button" class="site-button" onclick="window.location=\'' . $invite->getFullURL( "email_type=view&page={$page}" ) . '\'" value="' .wfMsg( 'invite-myfriends' ) . '" /> |
| 39 | + <input type="button" class="site-button" onclick="window.location=\'' . $new_page->getFullURL() . '\'" value="' . wfMsg( 'invite-nothanks' ) . '" />' . "\n" |
| 40 | + ); |
| 41 | + } |
| 42 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/js/SelectAll.js |
— | — | @@ -0,0 +1,29 @@ |
| 2 | +var formblock; |
| 3 | +var forminputs; |
| 4 | + |
| 5 | +function prepare() { |
| 6 | + formblock = document.getElementById( 'form_id' ); |
| 7 | + forminputs = formblock.getElementsByTagName( 'input' ); |
| 8 | +} |
| 9 | + |
| 10 | +function select_all( name, value ) { |
| 11 | + for( i = 0; i < forminputs.length; i++ ) { |
| 12 | + // regex here to check name attribute |
| 13 | + var regex = new RegExp( name, "i" ); |
| 14 | + if( regex.test( forminputs[i].getAttribute( 'name' ) ) ) { |
| 15 | + if( value == '1' ) { |
| 16 | + forminputs[i].checked = true; |
| 17 | + } else { |
| 18 | + forminputs[i].checked = false; |
| 19 | + } |
| 20 | + } |
| 21 | + } |
| 22 | +} |
| 23 | + |
| 24 | +if( window.addEventListener ) { |
| 25 | + window.addEventListener( 'load', prepare, false ); |
| 26 | +} else if( window.attachEvent ) { |
| 27 | + window.attachEvent( 'onload', prepare ); |
| 28 | +} else if( document.getElementById ) { |
| 29 | + window.onload = prepare; |
| 30 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/js/GetContacts.js |
— | — | @@ -0,0 +1,37 @@ |
| 2 | +function getMailAccount( lhost, email, lang ) { |
| 3 | + email = email.toUpperCase(); |
| 4 | + page = ''; |
| 5 | + if( email.indexOf( '@GMAIL.COM' ) > -1 ) { |
| 6 | + page = 'mygmail'; |
| 7 | + } |
| 8 | + if( email.indexOf( '@YAHOO.COM' ) > -1 ) { |
| 9 | + page = 'myyahoo'; |
| 10 | + } |
| 11 | + if( email.indexOf( '@HOTMAIL.COM' ) > -1 ) { |
| 12 | + page = 'myhotmail'; |
| 13 | + } |
| 14 | + if( email.indexOf( '@AOL.COM' ) > -1 ) { |
| 15 | + page = 'myaol'; |
| 16 | + } |
| 17 | + |
| 18 | + if( email ) { |
| 19 | + setMailAction( lhost, page, lang ); |
| 20 | + } |
| 21 | +} |
| 22 | + |
| 23 | +function setMailAction( lhost, page, lang ) { |
| 24 | + document.emailform.action = "javascript:submit('" + lhost + "/extensions/InviteContacts/getmycontacts/" + page + ".php?language=" +lang +"', 'POST')"; |
| 25 | +} |
| 26 | + |
| 27 | +function toggleChecked() { |
| 28 | + var the_form = window.document.myform; |
| 29 | + for( var i = 0; i < the_form.length; i++ ) { |
| 30 | + if( the_form.elements[i].name == 'list[]' ) { |
| 31 | + the_form.elements[i].checked = ( ( all_checked == 1 ) ? false : true ); |
| 32 | + } |
| 33 | + } |
| 34 | + |
| 35 | + all_checked = ( ( all_checked == 1 ) ? 0 : 1 ); |
| 36 | +} |
| 37 | + |
| 38 | +all_checked = 1; |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/js/ahah.js |
— | — | @@ -0,0 +1,134 @@ |
| 2 | +function submit( FILE, METHOD ) { |
| 3 | + var num = document.emailform.elements.length; |
| 4 | + var url = ''; |
| 5 | + |
| 6 | + // radio button |
| 7 | + var j = 0; |
| 8 | + var a = 0; |
| 9 | + var radio_buttons = new Array(); |
| 10 | + var nome_buttons = new Array(); |
| 11 | + var the_form = window.document.emailform; |
| 12 | + for( var i = 0; i < the_form.length; i++ ) { |
| 13 | + var temp = the_form.elements[i].type; |
| 14 | + if ( ( temp == 'radio' ) && ( the_form.elements[i].checked ) ) { |
| 15 | + nome_buttons[a] = the_form.elements[i].name; |
| 16 | + radio_buttons[j] = the_form.elements[i].value; |
| 17 | + j++; |
| 18 | + a++; |
| 19 | + } |
| 20 | + } |
| 21 | + for( var k = 0; k < radio_buttons.length; k++ ) { |
| 22 | + url += nome_buttons[k] + '=' + radio_buttons[k] + '&'; |
| 23 | + } |
| 24 | + |
| 25 | + // checkbox |
| 26 | + var j = 0; |
| 27 | + var a = 0; |
| 28 | + var check_buttons = new Array(); |
| 29 | + var nome_buttons = new Array(); |
| 30 | + var the_form = window.document.emailform; |
| 31 | + for( var i = 0; i < the_form.length; i++ ) { |
| 32 | + var temp = the_form.elements[i].type; |
| 33 | + if ( ( temp == 'checkbox' ) && ( the_form.elements[i].checked ) ) { |
| 34 | + nome_buttons[a] = the_form.elements[i].name; |
| 35 | + check_buttons[j] = the_form.elements[i].value; |
| 36 | + j++; |
| 37 | + a++; |
| 38 | + } |
| 39 | + } |
| 40 | + for( var k = 0; k < check_buttons.length; k++ ) { |
| 41 | + url += nome_buttons[k] + '=' + check_buttons[k] + '&'; |
| 42 | + } |
| 43 | + |
| 44 | + for( var i = 0; i < num; i++ ) { |
| 45 | + var key = document.emailform.elements[i].name; |
| 46 | + var value = document.emailform.elements[i].value; |
| 47 | + var type = document.emailform.elements[i].type; |
| 48 | + |
| 49 | + if ( ( type == 'submit' ) || ( type == 'radio' ) || ( type == 'checkbox' ) ) { |
| 50 | + } else { |
| 51 | + url += key + '=' + value + '&'; |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + var parameters = url; |
| 56 | + url = FILE + '?' + url; |
| 57 | + if( METHOD == undefined ) { |
| 58 | + METHOD = 'GET'; |
| 59 | + } |
| 60 | + if( METHOD == 'GET' ) { |
| 61 | + ahah( url, 'target', '', METHOD ); |
| 62 | + } else { |
| 63 | + ahah( FILE, 'target', '', METHOD, parameters ); |
| 64 | + } |
| 65 | +} |
| 66 | + |
| 67 | +function ahah( url, target, delay, method, parameters ) { |
| 68 | + if( method == undefined ) { |
| 69 | + document.getElementById(target).innerHTML = '<p class="contacts-loading"><img src="' + wgScriptPath + '/skins/common/images/spinner.gif" width="16" height="16" alt="wait" border="0" /></p>'; |
| 70 | + if ( document.emailform ) { |
| 71 | + document.emailform.reset(); |
| 72 | + } |
| 73 | + if( window.XMLHttpRequest ) { |
| 74 | + req = new XMLHttpRequest(); |
| 75 | + } else if( window.ActiveXObject ) { |
| 76 | + req = new ActiveXObject("Microsoft.XMLHTTP"); |
| 77 | + } |
| 78 | + if( req ) { |
| 79 | + req.onreadystatechange = function() { |
| 80 | + ahahDone( url, target, delay, method, parameters ); |
| 81 | + }; |
| 82 | + req.open( 'GET', url, true ); |
| 83 | + req.send( '' ); |
| 84 | + } |
| 85 | + } |
| 86 | + |
| 87 | + if ( ( method == 'GET' ) || ( method == 'get' ) ) { |
| 88 | + document.getElementById(target).innerHTML = '<p class="contacts-loading"><img src="' + wgScriptPath + '/skins/common/images/spinner.gif" width="16" height="16" alt="wait" border="0" /></p>'; |
| 89 | + if ( document.emailform ) { |
| 90 | + document.emailform.reset(); |
| 91 | + } |
| 92 | + if ( window.XMLHttpRequest ) { |
| 93 | + req = new XMLHttpRequest(); |
| 94 | + } else if ( window.ActiveXObject ) { |
| 95 | + req = new ActiveXObject("Microsoft.XMLHTTP"); |
| 96 | + } |
| 97 | + if ( req ) { |
| 98 | + req.onreadystatechange = function() { |
| 99 | + ahahDone( url, target, delay, method, parameters ); |
| 100 | + }; |
| 101 | + req.open( method, url, true ); |
| 102 | + req.send( '' ); |
| 103 | + } |
| 104 | + } |
| 105 | + |
| 106 | + if ( ( method == 'POST' ) || ( method == 'post' ) ) { |
| 107 | + document.getElementById(target).innerHTML = '<p class="contacts-loading"><img src="' + wgScriptPath + '/skins/common/images/spinner.gif" width="16" height="16" alt="wait" border="0" /></p>'; |
| 108 | + if ( document.emailform ) { |
| 109 | + document.emailform.reset(); |
| 110 | + } |
| 111 | + if ( window.XMLHttpRequest ) { |
| 112 | + req = new XMLHttpRequest(); |
| 113 | + } else if ( window.ActiveXObject ) { |
| 114 | + req = new ActiveXObject("Microsoft.XMLHTTP"); |
| 115 | + } |
| 116 | + if ( req ) { |
| 117 | + req.onreadystatechange = function() { |
| 118 | + ahahDone( url, target, delay, method, parameters ); |
| 119 | + }; |
| 120 | + req.open( method, url, true ); |
| 121 | + req.setRequestHeader( 'Content-type', 'application/x-www-form-urlencoded' ); |
| 122 | + req.send( parameters ); |
| 123 | + } |
| 124 | + } |
| 125 | +} |
| 126 | + |
| 127 | +function ahahDone( url, target, delay, method, parameters ) { |
| 128 | + if( req.readyState == 4 ) { |
| 129 | + if( req.status == 200 ) { |
| 130 | + document.getElementById(target).innerHTML = req.responseText; |
| 131 | + } else { |
| 132 | + document.getElementById(target).innerHTML = "ahah error:\n" + req.statusText; |
| 133 | + } |
| 134 | + } |
| 135 | +} |
\ No newline at end of file |
Index: trunk/extensions/InviteContacts/SpecialInviteEmail.php |
— | — | @@ -0,0 +1,232 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class InviteEmail extends UnlistedSpecialPage { |
| 5 | + |
| 6 | + /** |
| 7 | + * Constructor |
| 8 | + */ |
| 9 | + public function __construct() { |
| 10 | + parent::__construct( 'InviteEmail' ); |
| 11 | + } |
| 12 | + |
| 13 | + /** |
| 14 | + * Show the special page |
| 15 | + * |
| 16 | + * @param $par Mixed: parameter passed to the page or null |
| 17 | + */ |
| 18 | + public function execute( $par ) { |
| 19 | + global $wgUser, $wgOut, $wgRequest, $wgScriptPath, $wgPasswordSender, $wgEmailFrom; |
| 20 | + wfLoadExtensionMessages( 'InviteContacts' ); |
| 21 | + |
| 22 | + # Check blocks |
| 23 | + if( $wgUser->isBlocked() ) { |
| 24 | + $wgOut->blockedPage(); |
| 25 | + return; |
| 26 | + } |
| 27 | + |
| 28 | + if ( $wgUser->isAnon() ) { |
| 29 | + $skin = $wgUser->getSkin(); |
| 30 | + $wgOut->setPageTitle( wfMsg( 'invite-notloggedin' ) ); |
| 31 | + $llink = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogin' ), wfMsgHtml( 'loginreqlink' ) ); |
| 32 | + $wgOut->addHTML( wfMsgWikiHtml( 'invite-emailanontext', $llink ) ); |
| 33 | + return; |
| 34 | + } |
| 35 | + |
| 36 | + // Add CSS |
| 37 | + $wgOut->addExtensionStyle( $wgScriptPath . '/extensions/InviteContacts/css/invite.css' ); |
| 38 | + |
| 39 | + if( $wgEmailFrom ) { |
| 40 | + $this->from = $wgEmailFrom; |
| 41 | + } else { |
| 42 | + $this->from = $wgPasswordSender; |
| 43 | + } |
| 44 | + |
| 45 | + if( $wgRequest->wasPosted() && $_SESSION['alreadysubmitted'] == false ) { |
| 46 | + $_SESSION['alreadysubmitted'] = true; |
| 47 | + $message = $wgRequest->getVal( 'body' ); |
| 48 | + $subject = $wgRequest->getVal( 'subject' ); |
| 49 | + $addresses = explode( ',', $wgRequest->getVal( 'email_to' ) ); |
| 50 | + $mailResult = ''; |
| 51 | + foreach( $addresses as $address ) { |
| 52 | + $to = trim( $address ); |
| 53 | + if ( User::isValidEmailAddr( $to ) ) { |
| 54 | + $mailResult = UserMailer::send( |
| 55 | + new MailAddress( $to ), |
| 56 | + new MailAddress( $this->from ), |
| 57 | + $subject, |
| 58 | + $message, |
| 59 | + new MailAddress( $this->from ), |
| 60 | + 'text/html; charset=UTF-8' |
| 61 | + ); |
| 62 | + } |
| 63 | + } |
| 64 | + if( class_exists( 'UserEmailTrack' ) ) { |
| 65 | + $mail = new UserEmailTrack( $wgUser->getID(), $wgUser->getName() ); |
| 66 | + $mail->track_email( |
| 67 | + $wgRequest->getVal( 'track' ), |
| 68 | + count( $addresses ), |
| 69 | + $wgRequest->getVal( 'page_title' ) |
| 70 | + ); |
| 71 | + } |
| 72 | + |
| 73 | + $wgOut->setPageTitle( wfMsg( 'invite-sent' ) ); |
| 74 | + |
| 75 | + $out = ''; |
| 76 | + |
| 77 | + if ( $wgUser->isLoggedIn() ) { |
| 78 | + $out .= '<div class="invite-links"> |
| 79 | + <a href="' . $wgUser->getUserPage()->escapeFullURL() . '">' . wfMsg( 'invite-back-to-userpage' ) . '</a> |
| 80 | + </div>'; |
| 81 | + } |
| 82 | + |
| 83 | + $out .= wfMsgExt( 'invite-sent-thanks', 'parsemag' ); |
| 84 | + |
| 85 | + $out .= '<p> |
| 86 | + <input type="button" class="invite-form-button" value="' . wfMsg( 'invite-more-friends' ) .'" onclick="window.location=\'' . SpecialPage::getTitleFor( 'InviteEmail' )->escapeFullURL() . '\'" /> |
| 87 | + </p>'; |
| 88 | + |
| 89 | + $wgOut->addHTML( $out ); |
| 90 | + } else { |
| 91 | + $_SESSION['alreadysubmitted'] = false; |
| 92 | + $wgOut->addHTML( $this->displayForm() ); |
| 93 | + } |
| 94 | + } |
| 95 | + |
| 96 | + function getInviteEmailContent( $type ) { |
| 97 | + global $wgUser; |
| 98 | + $title = Title::makeTitle( NS_USER, $wgUser->getName() ); |
| 99 | + $user_label = $wgUser->getRealName(); |
| 100 | + if( !trim( $user_label ) ) { |
| 101 | + $user_label = $wgUser->getName(); |
| 102 | + } |
| 103 | + |
| 104 | + switch( $type ) { |
| 105 | + case 'rate': |
| 106 | + $this->track = 6; |
| 107 | + $rate_title = Title::makeTitle( NS_MAIN, $this->page ); |
| 108 | + $email['subject'] = wfMsg( |
| 109 | + 'invite-rate-subject', |
| 110 | + $user_label, |
| 111 | + $rate_title->getText() |
| 112 | + ); |
| 113 | + $email['body'] = wfMsg( |
| 114 | + 'invite-rate-body', |
| 115 | + $user_label, |
| 116 | + $user_label, |
| 117 | + $title->getFullURL(), |
| 118 | + $rate_title->getText(), |
| 119 | + $rate_title->getFullURL() |
| 120 | + ); |
| 121 | + break; |
| 122 | + case 'edit': |
| 123 | + $this->track = 5; |
| 124 | + $rate_title = Title::makeTitle( NS_MAIN, $this->page ); |
| 125 | + $email['subject'] = wfMsg( |
| 126 | + 'invite-edit-subject', |
| 127 | + $user_label, |
| 128 | + $rate_title->getText() |
| 129 | + ); |
| 130 | + $email['body'] = wfMsg( |
| 131 | + 'invite-edit-body', |
| 132 | + $user_label, |
| 133 | + $user_label, |
| 134 | + $title->getFullURL(), |
| 135 | + $rate_title->getText(), |
| 136 | + $rate_title->getFullURL() |
| 137 | + ); |
| 138 | + break; |
| 139 | + case 'view': |
| 140 | + $this->track = 4; |
| 141 | + $rate_title = Title::makeTitle( NS_MAIN, $this->page ); |
| 142 | + $email['subject'] = wfMsg( |
| 143 | + 'invite-view-subject', |
| 144 | + $user_label, |
| 145 | + $rate_title->getText() |
| 146 | + ); |
| 147 | + $email['body'] = wfMsg( |
| 148 | + 'invite-view-body', |
| 149 | + $user_label, |
| 150 | + $user_label, |
| 151 | + $title->getFullURL(), |
| 152 | + $rate_title->getText(), |
| 153 | + $rate_title->getFullURL() |
| 154 | + ); |
| 155 | + break; |
| 156 | + default: |
| 157 | + $this->track = 3; |
| 158 | + $register = SpecialPage::getTitleFor( 'Userlogin', 'signup' ); |
| 159 | + $user_title = Title::makeTitle( NS_USER, $wgUser->getName() ); |
| 160 | + $email['subject'] = wfMsgExt( 'invite-subject', 'parsemag', $user_label ); |
| 161 | + |
| 162 | + $email['body'] = wfMsgExt( |
| 163 | + 'invite-body', |
| 164 | + 'parsemag', |
| 165 | + $user_label, |
| 166 | + $user_label, |
| 167 | + $title->getFullURL(), |
| 168 | + $register->getFullURL( 'from=1&referral=' . urlencode( $user_title->getDBkey() ) ) |
| 169 | + ); |
| 170 | + break; |
| 171 | + } |
| 172 | + return $email; |
| 173 | + } |
| 174 | + |
| 175 | + function displayForm() { |
| 176 | + global $wgUser, $wgOut, $wgRequest; |
| 177 | + |
| 178 | + $wgOut->setPageTitle( wfMsg( 'invite-your-friends' ) ); |
| 179 | + |
| 180 | + $this->email_type = $wgRequest->getVal( 'email_type' ); |
| 181 | + $this->page = $wgRequest->getVal( 'page' ); |
| 182 | + |
| 183 | + $email = $this->getInviteEmailContent( $this->email_type ); |
| 184 | + |
| 185 | + $out = ''; |
| 186 | + /* |
| 187 | + $out .= "<div class=\"invite-links\"> |
| 188 | + <a href=\"index.php?title=Special:InviteContacts\">Find Your Friends</a> |
| 189 | + - <span class=\"profile-on\"><a href=\"index.php?title=Special:InviteEmail\">Invite Your Friends</a></span> |
| 190 | + </div>"; |
| 191 | + */ |
| 192 | + //$out .= "<div class=\"invite-links\"><a href=\"index.php?title=Special:InviteContacts\">< Back to Invite</a></div>"; |
| 193 | + |
| 194 | + if( $wgRequest->getVal( 'from' ) == 'register' ) { |
| 195 | + $out .= '<div style="margin-top:10px;"> |
| 196 | + <a href="' . $wgUser->getUserPage()->getFullURL() . '" style="font-size:10px;">' |
| 197 | + . wfMsg( 'invite-skip-step' ) . |
| 198 | + '</a> |
| 199 | + </div>'; |
| 200 | + } |
| 201 | + |
| 202 | + $out .= '<p class="invite-message">' . wfMsgExt( 'invite-message', 'parsemag' ) . '</p> |
| 203 | + <form name="email" action="" method="post" style="margin:0px"> |
| 204 | + <input type="hidden" value="' . $this->track . '" name="track" /> |
| 205 | + |
| 206 | + <div class="invite-form-enter-email"> |
| 207 | + <p class="invite-email-title">' . wfMsg( 'invite-enter-emails' ) . '</p> |
| 208 | + <p class="invite-email-submessage">' . wfMsg( 'invite-comma-separated' ) . '</p> |
| 209 | + <p> |
| 210 | + <textarea name="email_to" id="email_to" rows="15" cols="42"></textarea> |
| 211 | + </p> |
| 212 | + </div> |
| 213 | + <div class="invite-email-content"> |
| 214 | + <p class="invite-email-title">' . wfMsg( 'invite-customize-email' ) . '</p> |
| 215 | + <p class="email-field">' . wfMsg( 'invite-customize-subject' ) . '</p> |
| 216 | + <p class="email-field"><input type="text" name="subject" id="subject" value="' . $email['subject'] . '" /></p> |
| 217 | + <p class="email-field">' . wfMsg( 'invite-customize-body' ) . '</p> |
| 218 | + <p class="email-field"> |
| 219 | + <textarea name="body" id="body" rows="15" cols="45" wrap="hard">' |
| 220 | + . $email['body'] . |
| 221 | + '</textarea> |
| 222 | + </p> |
| 223 | + <div class="email-buttons"> |
| 224 | + <input type="button" class="site-button" onclick="document.email.submit()" value="' . wfMsg( 'invite-customize-send' ) . '" /> |
| 225 | + </div> |
| 226 | + |
| 227 | + </div> |
| 228 | + <div class="cleared"></div> |
| 229 | + <input type="hidden" value="' . $this->page . '" name="page_title" /> |
| 230 | + </form>'; |
| 231 | + return $out; |
| 232 | + } |
| 233 | +} |
\ No newline at end of file |