コード例 #1
0
 /**
  * Sends a account activation mail to specified user
  *
  * @param $_id user id
  */
 function xxx_sendActivationMail($_id)
 {
     if (!is_numeric($_id)) {
         return false;
     }
     $email = loadUserdataEmail($_id);
     if (!$email) {
         return false;
     }
     $code = generateActivationCode(ACTIVATE_EMAIL, 1000000, 9999999);
     createActivation(ACTIVATE_EMAIL, $code, $_id);
     $subj = 'Account activation';
     $pattern = array('/__USERNAME__/', '/__IP__/', '/__CODE__/', '/__URL__/', '/__EXPIRETIME__/');
     $replacement = array(Users::getName($_id), client_ip(), $code, xhtmlGetUrl("activate.php?id=" . $_id . "&code=" . $code), shortTimePeriod($this->expire_time_email));
     $msg = preg_replace($pattern, $replacement, $this->mail_activate_msg);
     if (!$this->SmtpSend($email, $subj, $msg)) {
         return false;
     }
     $this->activation_sent = true;
     return true;
 }
コード例 #2
0
ファイル: soap_server.php プロジェクト: martinlindhe/core_dev
ini_set('soap.wsdl_cache_enabled', '0');
$config['no_session'] = true;
//force session "last active" update to be skipped
require_once 'config.php';
class SOAP_ProcessService
{
    function fetchAndConvert($username, $password, $uri, $callback, $watermark_uri)
    {
        $customerId = getCustomerId($username, $password);
        if (!$customerId || empty($uri)) {
            return false;
        }
        $id = addProcessEvent(PROCESS_FETCH, $customerId, $uri);
        $params['callback'] = $callback;
        $params['watermark'] = $watermark_uri;
        $endId = addProcessEvent(PROCESS_CONVERT_TO_DEFAULT, $customerId, $id, $params);
        return $endId;
    }
}
$server = new SoapServer(xhtmlGetUrl('process.wsdl.php'));
//, array('trace' => 1));
$server->setClass('SOAP_ProcessService');
$server->handle();
/*
  echo 'This SOAP server has the following functions:<br/>';
  $functions = $server->getFunctions();
  foreach($functions as $name) {
   echo $name.'<br/>';
  }
*/
コード例 #3
0
function shareForumItem($itemId)
{
    global $h;
    if (!$h->session->id || !is_numeric($itemId)) {
        return false;
    }
    if (!empty($_POST['fshare_mail'])) {
        if (is_email($_POST['fshare_mail'])) {
            $item = getForumItem($itemId);
            if (!empty($_POST['fshare_name'])) {
                $mail = "Hej " . $_POST['fshare_name'] . "!\n\n";
            } else {
                $mail = "Hej!\n\n";
            }
            $mail .= $h->session->username . " har skickat dig den här länken till dig från communityt\n";
            $mail .= "på vår sajt, " . xhtmlGetUrl('/') . ".\n\n";
            if ($item['authorId']) {
                $mail .= $item['itemSubject'] . ' av ' . $item['authorName'] . ', ' . formatTime($item['timeCreated']) . ":\n";
            } else {
                $mail .= $item['itemSubject'] . ' av gäst, ' . formatTime($item['timeCreated']) . "\n";
            }
            $mail .= "För att läsa inlägget i sin helhet, klicka på länken nedan:\n";
            $mail .= xhtmlGetUrl('forum.php?id=' . $itemId . '#' . $itemId) . "\n\n";
            if (!empty($_POST['fshare_comment'])) {
                $mail .= "\n";
                $mail .= "Din kompis lämnade även följande hälsning:\n";
                $mail .= $_POST['fshare_comment'] . "\n\n";
            }
            $subject = 'Meddelande från communityt';
            if (smtp_mail($_POST['fshare_mail'], $subject, $mail) == true) {
                echo 'Tipset ivägskickat<br/>';
            } else {
                echo 'Problem med utskicket<br/>';
            }
        } else {
            echo 'Ogiltig mailaddress!';
        }
        return;
    }
    $data = getForumItem($itemId);
    echo showForumPost($data) . '<br/>';
    echo xhtmlForm('forum_share', $_SERVER['PHP_SELF'] . '?id=' . $itemId);
    echo 'Din kompis namn: ' . xhtmlInput('fshare_name', '', 20, 30) . '<br/>';
    echo t('E-mail') . ': ' . xhtmlInput('fshare_mail', '', 40, 50) . '<br/>';
    echo '<br/>';
    echo 'Hälsning:<br/>';
    echo xhtmlTextarea('fshare_comment', '', 40, 6) . '<br/>';
    echo xhtmlSubmit('Share');
    echo xhtmlFormClose();
}
コード例 #4
0
<?php

$config['no_session'] = true;
//force session "last active" update to be skipped
require_once 'config.php';
require_once 'class.SOAP.php';
$serv = new SOAP('process', xhtmlGetUrl('soap_server.php'));
$serv->message('fetchAndConvert', array('username' => 'string', 'password' => 'string', 'uri' => 'string', 'callback' => 'string', 'watermark' => 'string', 'response' => 'integer'));
$serv->output();