/** * users_admin_email_user * * @param array $pParamHash * @access public * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure */ function users_admin_email_user(&$pParamHash) { global $gBitSmarty, $gBitSystem; $ret = FALSE; $siteName = $gBitSystem->getConfig('site_title', $_SERVER['HTTP_HOST']); $gBitSmarty->assign('siteName', $_SERVER["SERVER_NAME"]); $gBitSmarty->assign('mail_site', $_SERVER["SERVER_NAME"]); $gBitSmarty->assign('mail_user', $pParamHash['login']); if (!empty($_REQUEST['admin_verify_user']) && !empty($pParamHash['user_store']['provpass'])) { $apass = addslashes(substr(md5($gBitSystem->genPass()), 0, 25)); $apass = $pParamHash['user_store']['provpass']; $machine = httpPrefix() . USERS_PKG_URL . 'confirm.php'; // Send the mail $gBitSmarty->assign('mail_machine', $machine); $gBitSmarty->assign('mailUserId', $pParamHash['user_store']['user_id']); $gBitSmarty->assign('mailProvPass', $apass); $mail_data = $gBitSmarty->fetch('bitpackage:users/admin_validation_mail.tpl'); mail($pParamHash['email'], $siteName . ' - ' . tra('Your registration information'), $mail_data, "From: " . $gBitSystem->getConfig('site_sender_email') . "\r\nContent-type: text/plain;charset=utf-8\r\n"); $gBitSmarty->assign('showmsg', 'n'); $ret = array('confirm' => 'Validation email sent to ' . $pParamHash['email'] . '.'); } elseif (!empty($pParamHash['password'])) { // Send the welcome mail $gBitSmarty->assign('mailPassword', $pParamHash['password']); $gBitSmarty->assign('mailEmail', $pParamHash['email']); $mail_data = $gBitSmarty->fetch('bitpackage:users/admin_welcome_mail.tpl'); mail($pParamHash["email"], tra('Welcome to') . ' ' . $siteName, $mail_data, "From: " . $gBitSystem->getConfig('site_sender_email') . "\r\nContent-type: text/plain;charset=utf-8\r\n"); $ret = array('welcome' => 'Welcome email sent to ' . $pParamHash['email'] . '.'); } return $ret; }
function galaxia_execute_activity($activity_id = 0, $iid = 0, $auto = 1) { // Now execute the code for the activity but we are in a method! // so just use an fopen with http mode $parsed = parse_url($_SERVER["REQUEST_URI"]); $URI = httpPrefix() . $parsed["path"]; $parts = explode('/', $URI); $parts[count($parts) - 1] = "g_run_activity.php?activity_id={$activity_id}&iid={$iid}&auto={$auto}"; $URI = implode('/', $parts); $fp = fopen($URI, "r"); $data = ''; if (!$fp) { trigger_error(tra("Fatal error: cannot execute automatic activity {$activity_id}"), E_USER_WARNING); die; } while (!feof($fp)) { $data .= fread($fp, 8192); } /* if(!empty($data)) { trigger_error(tra("Fatal error: automatic activity produced some output:$data"),E_USER_WARNING); } */ fclose($fp); }
*/ require_once '../kernel/setup_inc.php'; include_once NEWSLETTERS_PKG_PATH . 'BitNewsletterMailer.php'; $gBitSystem->verifyPackage('newsletters'); if (!$gBitUser->isRegistered() && !$gBitUser->hasPermission('p_newsletters_subscribe') && empty($_REQUEST['c'])) { $gBitSystem->fatalError(tra("You must be logged in to subscribe to newsletters")); } require_once NEWSLETTERS_PKG_PATH . 'lookup_newsletter_inc.php'; $feedback = array(); /* List newsletters */ $listHash = array(); $newsletters = $gContent->getList($listHash); $gBitSmarty->assignByRef('subs', BitNewsletter::getUserSubscriptions($gBitUser->getField('user_id'), $gBitUser->getField('email'))); $gBitSmarty->assignByRef('newsletters', $newsletters); $foo = parse_url($_SERVER["REQUEST_URI"]); $gBitSmarty->assign('url_subscribe', httpPrefix() . $foo["path"]); $subinfo = array(); $unsubs = array(); // We have a url_code from a clicked link in an email if (isset($_REQUEST['c']) && strlen($_REQUEST['c']) == 32 && ($subInfo = BitNewsletterMailer::lookupSubscription(array('url_code' => $_REQUEST['c'])))) { } elseif ($gBitUser->isRegistered()) { if (!($subInfo = BitNewsletterMailer::lookupSubscription(array('user_id' => $gBitUser->mUserId)))) { $subInfo = $gBitUser->mInfo; } } if (!empty($subInfo['user_id']) && BitBase::verifyId($subInfo['user_id'])) { $lookup['user_id'] = $subInfo['user_id']; } else { $lookup['email'] = $subInfo['email']; } $unsubs = BitNewsletterMailer::getUnsubscriptions($lookup);
require_once '../kernel/setup_inc.php'; include_once BLOGS_PKG_PATH . 'BitBlogPost.php'; $gBitSystem->verifyPackage('blogs'); if (!isset($_REQUEST["post_id"])) { $gBitSystem->fatalError(tra('No post indicated')); } include_once BLOGS_PKG_PATH . 'lookup_post_inc.php'; $gBitSmarty->assign('post_info', $gContent->mInfo); //Build absolute URI for this $parts = parse_url($_SERVER['REQUEST_URI']); /*OLD with blog_id - might later want to reincorporate blog_id but will have to start in the view_blog_post.tpl -wjames5 $uri = httpPrefix(). $parts['path'] . '?blog_id=' . $gContent->mInfo['blog_id'] . '&post_id=' . $gContent->mInfo['post_id']; $uri2 = httpPrefix(). $parts['path'] . '/' . $gContent->mInfo['blog_id'] . '/' . $gContent->mInfo['post_id']; */ $uri = httpPrefix() . $parts['path'] . '?post_id=' . $gContent->mInfo['post_id']; $uri2 = httpPrefix() . $parts['path'] . '/' . $gContent->mInfo['post_id']; $gBitSmarty->assign('uri', $uri); $gBitSmarty->assign('uri2', $uri2); if (!isset($_REQUEST['offset'])) { $_REQUEST['offset'] = 0; } if (!isset($_REQUEST['sort_mode'])) { $_REQUEST['sort_mode'] = 'created_desc'; } if (!isset($_REQUEST['find'])) { $_REQUEST['find'] = ''; } $gBitSmarty->assign('offset', $_REQUEST["offset"]); $gBitSmarty->assign('sort_mode', $_REQUEST["sort_mode"]); $gBitSmarty->assign('find', $_REQUEST["find"]); $offset = $_REQUEST["offset"];
/** * Post changes to registered email addresses related to a change event * @param object number of the content item being updated * @param object content_type of the item * @param object the package that is being updated * @param object the name of the object * @param object the name of user making the change * @param object any comment added to the change * @param object the content of the change * * @todo Improve the generic handling of the messages * Param information probably needs to be passed as an array, or accessed from Content directly */ function post_content_event($contentid, $type, $package, $name, $user, $comment, $data) { global $gBitSystem; $emails = $this->get_mail_events($package . '_page_changes', $type . $contentid); foreach ($emails as $email) { global $gBitSmarty; $gBitSmarty->assign('mail_site', $_SERVER["SERVER_NAME"]); $gBitSmarty->assign('mail_page', $name); $gBitSmarty->assign('mail_date', $gBitSystem->getUTCTime()); $gBitSmarty->assign('mail_user', $user); $gBitSmarty->assign('mail_comment', $comment); $gBitSmarty->assign('mail_last_version', 1); $gBitSmarty->assign('mail_data', $data); $gBitSmarty->assign('mail_machine', httpPrefix()); $gBitSmarty->assign('mail_pagedata', $data); $mail_data = $gBitSmarty->fetch('bitpackage:' . $package . '/' . $package . '_change_notification.tpl'); @mail($email, $package . tra(' page') . ' ' . $name . ' ' . tra('changed'), $mail_data, "From: " . $gBitSystem->getConfig('site_sender_email') . "\r\nContent-type: text/plain;charset=utf-8\r\n"); } }
function sendTrackbacks($pTrackbacks) { $ret = array(); if ($this->isValid() && !empty($pTrackbacks)) { // Split to get each URI $tracks = explode(',', $pTrackbacks); //Build uri for post $parts = parse_url($_SERVER['REQUEST_URI']); $uri = httpPrefix() . str_replace('post', 'view_post', $parts['path']) . '?post_id=' . $this->mPostId . '&blog_id=' . $this->mInfo['blog_id']; include_once UTIL_PKG_PATH . 'Snoopy.class.inc'; $snoopy = new Snoopy(); foreach ($tracks as $track) { @($fp = fopen($track, 'r')); if ($fp) { $data = ''; while (!feof($fp)) { $data .= fread($fp, 32767); } fclose($fp); preg_match("/trackback:ping=(\"|\\'|\\s*)(.+)(\"|\\'\\s)/", $data, $reqs); if (!isset($reqs[2])) { return $ret; } @($fp = fopen($reqs[2], 'r')); if ($fp) { fclose($fp); $submit_url = $reqs[2]; $submit_vars["url"] = $uri; $submit_vars["blog_name"] = $this->mInfo['blogtitle']; $submit_vars["title"] = $this->mInfo['title'] ? $this->mInfo['title'] : date("d/m/Y [h:i]", $this->mInfo['created']); $submit_vars["title"] .= ' ' . tra('by') . ' ' . BitUser::getDisplayNameFromHash(FALSE, $this->mInfo); $submit_vars["excerpt"] = substr($post_info['data'], 0, 200); $snoopy->submit($submit_url, $submit_vars); $back = $snoopy->results; if (!strstr('<error>1</error>', $back)) { $ret[] = $track; } } } } } return $ret; }
// Added check for IIS $_SERVER['HTTPS'] uses 'off' value - wolff_borg $https_mode = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'; if ($gBitSystem->isLive() && $gBitSystem->isFeatureActive('site_https_login_required') && !$https_mode) { $url = $gBitSystem->getConfig('site_https_domain', $_SERVER['HTTP_HOST']); $site_https_port = $gBitSystem->getConfig('site_https_port', $site_https_port); if ($site_https_port != 443) { $url .= ':' . $site_https_port; } $url .= $gBitSystem->getConfig('site_https_prefix') . $gBitSystem->getDefaultPage(); if (defined('SID')) { $url .= '?' . SID; } $url = preg_replace('/\\/+/', '/', $url); header("Location: https://{$url}"); exit; } $user = isset($_REQUEST['user']) ? $_REQUEST['user'] : false; $pass = isset($_REQUEST['pass']) ? $_REQUEST['pass'] : false; $challenge = isset($_REQUEST['challenge']) ? $_REQUEST['challenge'] : false; $response = isset($_REQUEST['response']) ? $_REQUEST['response'] : false; // if $referer is set, login() will return the user to whence he came $url = $gBitUser->login($user, $pass, $challenge, $response); if (!preg_match('/^\\w+:\\/{2}/', $url)) { $url = httpPrefix() . $url; } // but if we came from a login page, let's go home (except if we got an error when login in) if ((strpos($url, 'login.php?') || strpos($url, 'remind_password.php')) && strpos($url, 'login.php?error=') == -1) { $url = $gBitSystem->getDefaultPage(); } bit_redirect($url); exit;
function getUserBlogs($params) { global $gBitSystem, $userlib, $gBlog; $appkeyp = $params->getParam(0); $appkey = $appkeyp->scalarval(); $usernamep = $params->getParam(1); $username = $usernamep->scalarval(); $passwordp = $params->getParam(2); $password = $passwordp->scalarval(); $arrayVal = array(); $blogs = $gBitSystem->list_user_blogs($username, true); $foo = parse_url($_SERVER["REQUEST_URI"]); $foo1 = httpPrefix() . str_replace("xmlrpc", "tiki-view_blog", $foo["path"]); foreach ($blogs as $blog) { $myStruct = new xmlrpcval(array("blogName" => new xmlrpcval($blog["title"]), "url" => new xmlrpcval($foo1 . "?blog_id=" . $blog["blog_id"]), "blogid" => new xmlrpcval($blog["blog_id"])), "struct"); $arrayVal[] = $myStruct; } $myVal = new xmlrpcval($arrayVal, "array"); return new xmlrpcresp($myVal); }
$watches = $editUser->getWatches(); $gBitSmarty->assign('watches', $watches); } else { $gBitUser->load(TRUE); $editUser =& $gBitUser; } global $gQueryUserId; $gQueryUserId =& $editUser->mUserId; $parsedUrl = parse_url($_SERVER["REQUEST_URI"]); // settings only applicable when the wiki package is active if ($gBitSystem->isPackageActive('wiki')) { include_once WIKI_PKG_PATH . 'BitPage.php'; $parsedUrl1 = str_replace(USERS_PKG_URL . "user_preferences", WIKI_PKG_URL . "edit", $parsedUrl["path"]); $parsedUrl2 = str_replace(USERS_PKG_URL . "user_preferences", WIKI_PKG_URL . "index", $parsedUrl["path"]); $gBitSmarty->assign('url_edit', httpPrefix() . $parsedUrl1); $gBitSmarty->assign('url_visit', httpPrefix() . $parsedUrl2); } // custom user fields if ($gBitSystem->isFeatureActive('custom_user_fields')) { $customFields = explode(',', $gBitSystem->getConfig('custom_user_fields')); $gBitSmarty->assign('customFields', $customFields); } // include preferences settings from other packages - these will be included as individual tabs $includeFiles = $gBitSystem->getIncludeFiles('user_preferences_inc.php', 'user_preferences_inc.tpl'); foreach ($includeFiles as $file) { require_once $file['php']; } $gBitSmarty->assign('includFiles', $includeFiles); // fetch available languages $gBitLanguage->mLanguage = $editUser->getPreference('bitlanguage', $gBitLanguage->mLanguage); $gBitSmarty->assign('gBitLanguage', $gBitLanguage);
/** * If an unrecoverable error has occurred, this method should be invoked. script exist occurs * * @param string $ pMsg error message to be displayed * @return none this function will DIE DIE DIE!!! * @access public */ function install_error($pMsg = null) { global $gBitDbType; // here we decide where to go. if there are no db settings yet, we go the welcome page. if (isset($gBitDbType)) { $step = 1; } else { $step = 0; } header("Location: " . httpPrefix() . BIT_ROOT_URL . "install/install.php?step=" . $step); die; }
} $setup_parsed_uri = parse_url($_SERVER["REQUEST_URI"]); if (isset($setup_parsed_uri["query"])) { parse_str($setup_parsed_uri["query"], $setup_query_data); } else { $setup_query_data = array(); } // check the session to get the parent or create parent =0 $_template->tpl_vars['ownurl'] = new Smarty_variable(httpPrefix() . $_SERVER["REQUEST_URI"]); if (!isset($_SESSION["bookmarks_parent"])) { $_SESSION["bookmarks_parent"] = 0; } if (isset($_REQUEST["bookmarks_parent"])) { $_SESSION["bookmarks_parent"] = $_REQUEST["bookmarks_parent"]; } $ownurl = httpPrefix() . $_SERVER["REQUEST_URI"]; // Now build urls if (strstr($ownurl, '?')) { $modb_sep = '&'; } else { $modb_sep = '?'; } $_template->tpl_vars['modb_sep'] = new Smarty_variable($modb_sep); if (isset($_REQUEST["bookmark_removeurl"])) { $bookmarklib->remove_url($_REQUEST["bookmark_removeurl"], $gBitUser->mUserId); header('Location: ' . $_SERVER['HTTP_REFERER']); die; } elseif (isset($_REQUEST["bookmark_create_folder"])) { $bookmarklib->add_folder($_SESSION["bookmarks_parent"], $_REQUEST['bookmark_urlname'], $gBitUser->mUserId); } elseif (isset($_REQUEST["bookmark_mark"])) { if (empty($_REQUEST["bookmark_urlname"])) {
/** * This is the ONLY method that should be called in order to store (create or update) a wiki page! * It is very smart and will figure out what to do for you. It should be considered a black box. * * @param array pParams hash of values that will be used to store the page * * @return bool TRUE on success, FALSE if store could not occur. If FALSE, $this->mErrors will have reason why * * @access public **/ function store(&$pParamHash) { $this->StartTrans(); if ($this->verify($pParamHash) && LibertyMime::store($pParamHash)) { $pParamHash['page_store']['wiki_page_size'] = !empty($pParamHash['edit']) ? strlen($pParamHash['edit']) : 0; $table = BIT_DB_PREFIX . "wiki_pages"; if ($this->verifyId($this->mPageId)) { $result = $this->mDb->associateUpdate($table, $pParamHash['page_store'], array("page_id" => $this->mPageId)); } else { $pParamHash['page_store']['content_id'] = $pParamHash['content_id']; if (@$this->verifyId($pParamHash['page_id'])) { // if pParamHash['page_id'] is set, some is requesting a particular page_id. Use with caution! $pParamHash['page_store']['page_id'] = $pParamHash['page_id']; } else { $pParamHash['page_store']['page_id'] = $this->mDb->GenID('wiki_pages_page_id_seq'); } $this->mPageId = $pParamHash['page_store']['page_id']; $result = $this->mDb->associateInsert($table, $pParamHash['page_store']); } // Access new data for notifications $this->load(); if (isset($mailEvents)) { global $notificationlib, $gBitUser, $gBitSystem, $gBitSmarty; include_once KERNEL_PKG_PATH . 'notification_lib.php'; $notificationlib->post_content_event($this->mContentId, $this->mInfo['content_type_guid'], 'wiki', $this->mInfo['title'], $this->mInfo['modifier_user'], $this->mInfo['edit_comment'], $this->mInfo['data']); if ($gBitSystem->isFeatureActive('users_watches')) { $nots = $gBitUser->get_event_watches('wiki_page_changed', $this->mPageId); foreach ($nots as $not) { # if ($wiki_watch_editor != 'y' && $not['user_id'] == $user) # break; $gBitSmarty->assign('mail_site', $_SERVER["SERVER_NAME"]); $gBitSmarty->assign('mail_page', $this->mInfo['title']); $gBitSmarty->assign('mail_date', $gBitSystem->getUTCTime()); $gBitSmarty->assign('mail_user', $this->mInfo['modifier_user']); $gBitSmarty->assign('mail_comment', $this->mInfo['edit_comment']); $gBitSmarty->assign('mail_last_version', $this->mInfo['version'] - 1); $gBitSmarty->assign('mail_data', $this->mInfo['data']); $gBitSmarty->assign('mail_hash', $not['hash']); $foo = parse_url($_SERVER["REQUEST_URI"]); $machine = httpPrefix(); $gBitSmarty->assign('mail_machine', $machine); $parts = explode('/', $foo['path']); if (count($parts) > 1) { unset($parts[count($parts) - 1]); } $gBitSmarty->assign('mail_machine_raw', httpPrefix() . implode('/', $parts)); $gBitSmarty->assign('mail_pagedata', $this->mInfo['data']); $mail_data = $gBitSmarty->fetch('bitpackage:wiki/user_watch_wiki_page_changed.tpl'); $email_to = $not['email']; @mail($email_to, tra('Wiki page') . ' ' . $this->mInfo['title'] . ' ' . tra('changed'), $mail_data, "From: " . $gBitSystem->getConfig('site_sender_email') . "\r\nContent-type: text/plain;charset=utf-8\r\n"); } } } } $this->CompleteTrans(); return count($this->mErrors) == 0; }
/** * register - will handle everything necessary for registering a user and sending appropriate emails, etc. * * @access public * @author Christian Fowler<*****@*****.**> * @return TRUE on success, FALSE on failure */ function register(&$pParamHash, $pNotifyRegistrant = TRUE) { global $notificationlib, $gBitSmarty, $gBitSystem; $ret = FALSE; if (!empty($_FILES['user_portrait_file']) && empty($_FILES['user_avatar_file'])) { $pParamHash['user_auto_avatar'] = TRUE; } if ($this->verify($pParamHash)) { for ($i = 0; $i < BaseAuth::getAuthMethodCount(); $i++) { $instance = BaseAuth::init($i); if ($instance && $instance->canManageAuth()) { if ($userId = $instance->createUser($pParamHash)) { $this->mUserId = $userId; break; } else { $this->mErrors = array_merge($this->mErrors, $instance->mErrors); return FALSE; } } } if (!empty($pParamHash['verified_email']) && $pParamHash['verified_email'] && $gBitSystem->getConfig('users_validate_email_role')) { RolePermUser::addUserToRole($this->mUserId, $gBitSystem->getConfig('users_validate_email_role')); } $this->mLogs['register'] = 'New user registered.'; $ret = TRUE; $this->load(FALSE, $pParamHash['login']); require_once KERNEL_PKG_PATH . 'notification_lib.php'; $notificationlib->post_new_user_event($pParamHash['login']); // set local time zone as default when registering $this->storePreference('site_display_utc', 'Local'); if (!empty($_REQUEST['CUSTOM'])) { foreach ($_REQUEST['CUSTOM'] as $field => $value) { $this->storePreference($field, $value); } } // Handle optional user preferences that may be collected during registration if (!empty($pParamHash['prefs'])) { foreach (array_keys($pParamHash['prefs']) as $key) { $this->storePreference($key, $pParamHash['prefs'][$key]); } } // Send notification if ($pNotifyRegistrant) { $siteName = $gBitSystem->getConfig('site_title', $_SERVER['HTTP_HOST']); $gBitSmarty->assign('siteName', $_SERVER["SERVER_NAME"]); $gBitSmarty->assign('mail_site', $_SERVER["SERVER_NAME"]); $gBitSmarty->assign('mail_user', $pParamHash['login']); if ($gBitSystem->isFeatureActive('users_validate_user')) { // $apass = addslashes(substr(md5($gBitSystem->genPass()),0,25)); $apass = $pParamHash['user_store']['provpass']; $foo = parse_url($_SERVER["REQUEST_URI"]); $foo1 = str_replace("register", "confirm", $foo["path"]); $machine = httpPrefix() . $foo1; // Send the mail $gBitSmarty->assign('msg', tra('You will receive an email with information to login for the first time into this site')); $gBitSmarty->assign('mail_machine', $machine); $gBitSmarty->assign('mailUserId', $this->mUserId); $gBitSmarty->assign('mailProvPass', $apass); $mail_data = $gBitSmarty->fetch('bitpackage:users/user_validation_mail.tpl'); mail($pParamHash["email"], $siteName . ' - ' . tra('Your registration information'), $mail_data, "From: " . $gBitSystem->getConfig('site_sender_email') . "\nContent-type: text/plain;charset=utf-8\n"); $gBitSmarty->assign('showmsg', 'y'); $this->mLogs['confirm'] = 'Validation email sent.'; } elseif ($gBitSystem->isFeatureActive('send_welcome_email')) { // Send the welcome mail $gBitSmarty->assign('mailPassword', $pParamHash['password']); $gBitSmarty->assign('mailEmail', $pParamHash['email']); $mail_data = $gBitSmarty->fetch('bitpackage:users/welcome_mail.tpl'); mail($pParamHash["email"], tra('Welcome to') . ' ' . $siteName, $mail_data, "From: " . $gBitSystem->getConfig('site_sender_email') . "\nContent-type: text/plain;charset=utf-8\n"); $this->mLogs['welcome'] = 'Welcome email sent.'; } } $logHash['action_log']['title'] = $pParamHash['login']; $this->storeActionLog($logHash); } return $ret; }