From: <ru...@us...> - 2010-06-23 19:43:52
|
Revision: 7566 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7566&view=rev Author: rurban Date: 2010-06-23 19:43:46 +0000 (Wed, 23 Jun 2010) Log Message: ----------- undo deletions r7561 and r7563. we need that Modified Paths: -------------- trunk/lib/MailNotify.php trunk/lib/WikiTheme.php Property Changed: ---------------- trunk/g trunk/pgsrc/Help%2FGoogleLink trunk/pgsrc/Help%2FIncludeTreePlugin trunk/pgsrc/Help%2FInterWiki trunk/pgsrc/Help%2FPhpWiki trunk/pgsrc/Help%2FWikiWikiWeb trunk/themes/default/flowplayer-3.1.4.swf trunk/themes/default/flowplayer.controls-3.1.4.swf Property changes on: trunk/g ___________________________________________________________________ Deleted: svn:mergeinfo - Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2010-06-23 15:43:24 UTC (rev 7565) +++ trunk/lib/MailNotify.php 2010-06-23 19:43:46 UTC (rev 7566) @@ -364,6 +364,79 @@ } } + /** + * Send mail to user and store the cookie in the db + * wikiurl?action=ConfirmEmail&id=bla + */ + function sendEmailConfirmation ($email, $userid) { + $id = rand_ascii_readable(16); + $wikidb = $GLOBALS['request']->getDbh(); + $data = $wikidb->get('ConfirmEmail'); + while(!empty($data[$id])) { // id collision + $id = rand_ascii_readable(16); + } + $subject = _("E-Mail address confirmation"); + $ip = $request->get('REMOTE_HOST'); + $expire_date = time() + 7*86400; + $content = fmt("Someone, probably you from IP address %s, has registered an +account \"%s\" with this e-mail address on %s. + +To confirm that this account really does belong to you and activate +e-mail features on %s, open this link in your browser: + +%s + +If this is *not* you, don't follow the link. This confirmation code +will expire at %s.", + $ip, $userid, WIKI_NAME, WIKI_NAME, + WikiURL(HOME_PAGE, array('action' => 'ConfirmEmail', + 'id' => $id), + true), + CTime($expire_date)); + $this->sendMail($subject, $content, "", true); + $data[$id] = array('email' => $email, + 'userid' => $userid, + 'expire' => $expire_date); + $wikidb->set('ConfirmEmail', $data); + return ''; + } + + function checkEmailConfirmation () { + global $request; + $wikidb = $request->getDbh(); + $data = $wikidb->get('ConfirmEmail'); + $id = $request->getArg('id'); + if (empty($data[$id])) { // id not found + return HTML(HTML::h1("Confirm E-mail address"), + HTML::h1("Sorry! Wrong URL")); + } + // upgrade the user + $userid = $data['userid']; + $email = $data['email']; + $u = $request->getUser(); + if ($u->UserName() == $userid) { // lucky: current user (session) + $prefs = $u->getPreferences(); + $request->_user->_level = WIKIAUTH_USER; + $request->_prefs->set('emailVerified', true); + } else { // not current user + if (ENABLE_USER_NEW) { + $u = WikiUser($userid); + $u->getPreferences(); + $prefs = &$u->_prefs; + } else { + $u = new WikiUser($request, $userid); + $prefs = $u->getPreferences(); + } + $u->_level = WIKIAUTH_USER; + $request->setUser($u); + $request->_prefs->set('emailVerified', true); + } + unset($data[$id]); + $wikidb->set('ConfirmEmail', $data); + return HTML(HTML::h1("Confirm E-mail address"), + HTML::p("Your e-mail address has now been confirmed.")); + } + function subject_encode ($subject) { // We need to encode the subject if it contains non-ASCII characters // The page name may contain non-ASCII characters, as well as Modified: trunk/lib/WikiTheme.php =================================================================== --- trunk/lib/WikiTheme.php 2010-06-23 15:43:24 UTC (rev 7565) +++ trunk/lib/WikiTheme.php 2010-06-23 19:43:46 UTC (rev 7566) @@ -696,6 +696,7 @@ // //////////////////////////////////////////////////////////////// var $_imageAliases = array(); + var $_imageAlt = array(); /** * @@ -709,6 +710,13 @@ $this->_imageAliases[$alias] = $image_name; } + function addImageAlt ($alias, $alt_text) { + $this->_imageAlt[$alias] = $alt_text; + } + function getImageAlt ($alias) { + return $this->_imageAlt[$alias]; + } + function getImageURL ($image) { $aliases = &$this->_imageAliases; @@ -1515,6 +1523,11 @@ } } + function calendarLink($date = false) { + return $this->calendarBase() . SUBPAGE_SEPARATOR . + strftime("%Y-%m-%d", $date ? $date : time()); + } + function calendarBase() { static $UserCalPageTitle = false; global $request; Property changes on: trunk/pgsrc/Help%2FGoogleLink ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/pgsrc/Help%2FIncludeTreePlugin ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/pgsrc/Help%2FInterWiki ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/pgsrc/Help%2FPhpWiki ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/pgsrc/Help%2FWikiWikiWeb ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/themes/default/flowplayer-3.1.4.swf ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/themes/default/flowplayer.controls-3.1.4.swf ___________________________________________________________________ Deleted: svn:mergeinfo - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |