当前位置: 首页>>代码示例>>PHP>>正文


PHP Sql_Fetch_Assoc_Query函数代码示例

本文整理汇总了PHP中Sql_Fetch_Assoc_Query函数的典型用法代码示例。如果您正苦于以下问题:PHP Sql_Fetch_Assoc_Query函数的具体用法?PHP Sql_Fetch_Assoc_Query怎么用?PHP Sql_Fetch_Assoc_Query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Sql_Fetch_Assoc_Query函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: runtest

 public function runtest()
 {
     $this->userdata = Sql_Fetch_Assoc_Query(sprintf('select * from %s where email = "%s"', $GLOBALS['tables']['user'], $GLOBALS['developer_email']));
     if (!$this->userdata['id']) {
         Sql_Query(sprintf('insert into %s (email) values("%s")', $GLOBALS['tables']['user'], $GLOBALS['developer_email']));
         print 'Bounce user created: ' . $GLOBALS['developer_email'] . '<br/>';
     }
     $GLOBALS['message_envelope'] = $GLOBALS['developer_email'];
     return 1;
 }
开发者ID:gillima,项目名称:phplist3,代码行数:10,代码来源:defaulttest.php

示例2: saveUserAttribute

function saveUserAttribute($userid, $attid, $data)
{
    global $usertable_prefix, $table_prefix, $tables;
    # workaround for integration webbler/phplist
    if (!isset($usertable_prefix)) {
        $usertable_prefix = '';
    }
    if (!isset($table_prefix)) {
        $table_prefix = 'phplist_';
    }
    if (!empty($tables["attribute"])) {
        $att_table = $usertable_prefix . $tables["attribute"];
        $user_att_table = $usertable_prefix . $tables["user_attribute"];
    } else {
        $att_table = $usertable_prefix . "attribute";
        $user_att_table = $usertable_prefix . "user_attribute";
    }
    if (!is_array($data)) {
        $tmp = $data;
        $data = Sql_Fetch_Assoc_Query(sprintf('select * from %s where id = %d', $att_table, $attid));
        $data['value'] = $tmp;
        $data['displayvalue'] = $tmp;
    }
    # dbg($data,'$data to store for '.$userid.' '.$attid);
    if ($data["nodbsave"]) {
        #   dbg($attid, "Not saving, nodbsave");
        return;
    }
    if ($attid == "emailcheck" || $attid == "passwordcheck") {
        #   dbg($attid, "Not saving, emailcheck/passwordcheck");
        return;
    }
    if (!$data["type"]) {
        $data["type"] = "textline";
    }
    if ($data["type"] == "static" || $data["type"] == "password" || $data['type'] == 'htmlpref') {
        if (!empty($GLOBALS['config']['dontsave_userpassword']) && $data['type'] == 'password') {
            $data["value"] = 'not authoritative';
        }
        Sql_Query(sprintf('update user set %s = "%s" where id = %d', $attid, $data["value"], $userid));
        dbg('Saving', $data['value'], DBG_TRACE);
        if ($data["type"] == "password") {
            Sql_Query(sprintf('update user set passwordchanged = now(),password="%s" where id = %d', hash('sha256', $data['value']), $userid));
        }
        return 1;
    }
    $attributetype = $data['type'];
    $attid_req = Sql_Fetch_Row_Query(sprintf('
    select id,type,tablename from %s where id = %d', $att_table, $attid));
    if (!$attid_req[0]) {
        $attid_req = Sql_Fetch_Row_Query(sprintf('
      select id,type,tablename from %s where name = "%s"', $att_table, $data["name"]));
        if (!$attid_req[0]) {
            if (!empty($data["name"]) && $GLOBALS["config"]["autocreate_attributes"]) {
                #      Dbg("Creating new Attribute: ".$data["name"]);
                sendError("creating new attribute " . $data["name"]);
                $atttable = getNewAttributeTablename($data["name"]);
                Sql_Query(sprintf('insert into %s (name,type,tablename) values("%s","%s","%s")', $att_table, $data["name"], $data["type"], $atttable));
                $attid = Sql_Insert_Id();
            } else {
                #     dbg("Not creating new Attribute: ".$data["name"]);
                # sendError("Not creating new attribute ".$data["name"]);
            }
        } else {
            $attid = $attid_req[0];
            if (empty($attributetype)) {
                $attributetype = $attid_req[1];
            }
            $atttable = $attid_req[2];
        }
    } else {
        $attid = $attid_req[0];
        if (empty($attributetype)) {
            $attributetype = $attid_req[1];
        }
        $atttable = $attid_req[2];
    }
    if (!$atttable && !empty($data['name'])) {
        $atttable = getNewAttributeTablename($data["name"]);
        # fix attribute without tablename
        Sql_Query(sprintf('update %s set tablename ="%s" where id = %d', $att_table, $atttable, $attid));
        #   sendError("Attribute without Tablename $attid");
    }
    switch ($attributetype) {
        case "static":
        case "password":
            #  dbg('SAVING STATIC OR  PASSWORD');
            if (!empty($GLOBALS['config']['dontsave_userpassword']) && $data['type'] == 'password') {
                $data["value"] = 'not authoritative';
            }
            Sql_Query(sprintf('update user set %s = "%s" where id = %d', $attid, $data["value"], $userid));
            break;
        case "select":
            $curval = Sql_Fetch_Row_Query(sprintf('select id from ' . $table_prefix . 'listattr_%s
        where name = "%s"', $atttable, $data["displayvalue"]), 1);
            if (!$curval[0] && $data['displayvalue'] && $data['displayvalue'] != '') {
                Sql_Query(sprintf('insert into ' . $table_prefix . 'listattr_%s (name) values("%s")', $atttable, $data["displayvalue"]));
                sendError("Added " . $data["displayvalue"] . " to {$atttable}");
                $valid = Sql_Insert_id();
            } else {
//.........这里部分代码省略.........
开发者ID:narareddy,项目名称:phplist3,代码行数:101,代码来源:userlib.php

示例3: verifyCsrfGetToken

<?php

verifyCsrfGetToken();
$access = accessLevel('export');
$list = $_SESSION['export']['list'];
switch ($access) {
    case 'owner':
        if ($list) {
            $check = Sql_Fetch_Assoc_Query(sprintf('select id from %s where owner = %d and id = %d', $GLOBALS['tables']['list'], $_SESSION['logindetails']['id'], $list));
            if (empty($check['id'])) {
                print Error(s('That is not your list'));
                return;
            }
        }
        $querytables = $GLOBALS['tables']['list'] . ' list INNER JOIN ' . $GLOBALS['tables']['listuser'] . ' listuser ON listuser.listid = list.id' . ' INNER JOIN ' . $GLOBALS['tables']['user'] . ' user ON listuser.userid = user.id';
        $subselect = ' and list.owner = ' . $_SESSION['logindetails']['id'];
        $listselect_and = ' and owner = ' . $_SESSION['logindetails']['id'];
        break;
    case 'all':
        if ($list) {
            $querytables = $GLOBALS['tables']['user'] . ' user' . ' INNER JOIN ' . $GLOBALS['tables']['listuser'] . ' listuser ON user.id = listuser.userid';
            $subselect = '';
        } else {
            $querytables = $GLOBALS['tables']['user'] . ' user';
            $subselect = '';
        }
        $listselect_and = '';
        break;
    case 'none':
    default:
        $querytables = $GLOBALS['tables']['user'] . ' user';
开发者ID:gillima,项目名称:phplist3,代码行数:31,代码来源:export.php

示例4: confirmPage

function confirmPage($id)
{
    global $tables, $envelope;
    if (!$_GET['uid']) {
        FileNotFound();
    }
    $req = Sql_Query(sprintf('select * from %s where uniqid = "%s"', $tables['user'], sql_escape($_GET['uid'])));
    $userdata = Sql_Fetch_Array($req);
    if ($userdata['id']) {
        $html = '<ul>';
        $lists = '';
        $currently = Sql_Fetch_Assoc_Query("select confirmed from {$tables['user']} where id = " . $userdata['id']);
        $blacklisted = isBlackListed($userdata['email']);
        foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
            $plugin->subscriberConfirmation($id, $userdata);
        }
        Sql_Query("update {$tables['user']} set confirmed = 1,blacklisted = 0, optedin = 1 where id = " . $userdata['id']);
        $subscriptions = array();
        $req = Sql_Query(sprintf('select list.id,name,description from %s list, %s listuser where listuser.userid = %d and listuser.listid = list.id and list.active', $tables['list'], $tables['listuser'], $userdata['id']));
        if (!Sql_Affected_Rows()) {
            $lists = "\n * " . $GLOBALS['strNoLists'];
            $html .= '<li>' . $GLOBALS['strNoLists'] . '</li>';
        }
        while ($row = Sql_fetch_array($req)) {
            array_push($subscriptions, $row['id']);
            $lists .= "\n *" . stripslashes($row['name']);
            $html .= '<li class="list">' . stripslashes($row['name']) . '<div class="listdescription">' . stripslashes($row['description']) . '</div></li>';
        }
        $html .= '</ul>';
        if ($blacklisted) {
            unBlackList($userdata['id']);
            addUserHistory($userdata['email'], 'Confirmation', s('Subscriber removed from Blacklist for manual confirmation of subscription'));
        }
        if (empty($_SESSION['subscriberConfirmed'])) {
            $_SESSION['subscriberConfirmed'] = array();
        }
        ## 17513 - don't process confirmation if the subscriber is already confirmed
        if (empty($currently['confirmed']) && empty($_SESSION['subscriberConfirmed'][$userdata['email']])) {
            addUserHistory($userdata['email'], 'Confirmation', "Lists: {$lists}");
            $confirmationmessage = str_ireplace('[LISTS]', $lists, getUserConfig("confirmationmessage:{$id}", $userdata['id']));
            if (!TEST) {
                sendMail($userdata['email'], getConfig("confirmationsubject:{$id}"), $confirmationmessage, system_messageheaders(), $envelope);
                $adminmessage = $userdata['email'] . ' has confirmed their subscription';
                if ($blacklisted) {
                    $adminmessage .= "\n\n" . s('Subscriber has been removed from blacklist');
                }
                sendAdminCopy('List confirmation', $adminmessage, $subscriptions);
                addSubscriberStatistics('confirmation', 1);
            }
        } else {
            $html = $GLOBALS['strAlreadyConfirmed'];
        }
        $_SESSION['subscriberConfirmed'][$userdata['email']] = time();
        $info = $GLOBALS['strConfirmInfo'];
    } else {
        logEvent('Request for confirmation for invalid user ID: ' . substr($_GET['uid'], 0, 150));
        $html = 'Error: ' . $GLOBALS['strUserNotFound'];
        $info = $GLOBALS['strConfirmFailInfo'];
    }
    $res = '<title>' . $GLOBALS['strConfirmTitle'] . '</title>';
    $res .= $GLOBALS['pagedata']['header'];
    $res .= '<h3>' . $info . '</h3>';
    $res .= $html;
    $res .= '<p>' . $GLOBALS['PoweredBy'] . '</p>';
    $res .= $GLOBALS['pagedata']['footer'];
    return $res;
}
开发者ID:gillima,项目名称:phplist3,代码行数:67,代码来源:index.php

示例5: processQueueOutput

        if ($num_messages == 1) {
            processQueueOutput(s('One campaign to process.'));
        } else {
            processQueueOutput(s('%d campaigns to process.', $num_messages));
        }
    }
    clearPageCache();
    if (!$GLOBALS['commandline'] && empty($reload)) {
        processQueueOutput(s('Please leave this window open.') . ' ' . s('phpList will process your queue until all messages have been sent.') . ' ' . s('This may take a while'));
        if (SEND_QUEUE_PROCESSING_REPORT) {
            processQueueOutput(s('Report of processing will be sent by email'));
        }
    }
} else {
    ## check for a future embargo, to be able to report when it expires.
    $future = Sql_Fetch_Assoc_Query('select unix_timestamp(embargo) - unix_timestamp(now()) as waittime ' . " from {$tables['message']}" . " where status not in ('draft', 'sent', 'prepared', 'suspended')" . ' and embargo > now()' . ' order by embargo asc limit 1');
    $counters['status'] = 'embargo';
    $counters['delaysend'] = $future['waittime'];
}
$script_stage = 2;
# we know the messages to process
#include_once "footer.inc";
if (empty($counters['num_per_batch'])) {
    $counters['num_per_batch'] = 10000000;
}
while ($message = Sql_fetch_array($messages)) {
    ++$counters['campaign'];
    $throttlecount = 0;
    $messageid = $message['id'];
    $counters['sent_users_for_message ' . $messageid] = 0;
    $counters['total_users_for_message ' . $messageid] = 0;
开发者ID:pedru,项目名称:phplist3,代码行数:31,代码来源:processqueue.php

示例6: createCachedLogoImage

function createCachedLogoImage($size)
{
    $logoImageId = getConfig('organisation_logo');
    if (empty($logoImageId)) {
        return false;
    }
    $imgData = Sql_Fetch_Assoc_Query(sprintf('select data from %s where template = 0 and filename = "ORGANISATIONLOGO%d.png"', $GLOBALS['tables']['templateimage'], $size));
    if (!empty($imgData['data'])) {
        return true;
    }
    $imgData = Sql_Fetch_Assoc_Query(sprintf('select data from %s where id = %d and template = 0', $GLOBALS['tables']['templateimage'], $logoImageId));
    $imageContent = base64_decode($imgData['data']);
    if (empty($imageContent)) {
        ## fall back to a single pixel, so that there are no broken images
        $imageContent = base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAABGdBTUEAALGPC/xhBQAAAAZQTFRF////AAAAVcLTfgAAAAF0Uk5TAEDm2GYAAAABYktHRACIBR1IAAAACXBIWXMAAAsSAAALEgHS3X78AAAAB3RJTUUH0gQCEx05cqKA8gAAAApJREFUeJxjYAAAAAIAAUivpHEAAAAASUVORK5CYII=');
    }
    if (function_exists('getimagesizefromstring')) {
        $imgSize = getimagesizefromstring($imageContent);
        $sizeW = $imgSize[0];
        $sizeH = $imgSize[1];
        if ($sizeH > $sizeW) {
            $sizefactor = (double) ($size / $sizeH);
        } else {
            $sizefactor = (double) ($size / $sizeW);
        }
        $newwidth = (int) ($sizeW * $sizefactor);
        $newheight = (int) ($sizeH * $sizefactor);
    } else {
        $sizefactor = 1;
    }
    if ($sizefactor < 1) {
        $original = imagecreatefromstring($imageContent);
        $resized = imagecreatetruecolor($newwidth, $newheight);
        ## creates a black image (why would you want that....)
        imagesavealpha($resized, true);
        $transparent = imagecolorallocatealpha($resized, 255, 255, 255, 127);
        ## white. All the methods to make it transparent didn't work for me @@TODO really make transparent
        imagefill($resized, 0, 0, $transparent);
        if (imagecopyresized($resized, $original, 0, 0, 0, 0, $newwidth, $newheight, $sizeW, $sizeH)) {
            Sql_Query(sprintf('delete from %s where template = 0 and filename = "ORGANISATIONLOGO%d.png"', $GLOBALS['tables']['templateimage'], $size));
            ## rather convoluted way to get the image contents
            $buffer = ob_get_contents();
            ob_end_clean();
            ob_start();
            imagepng($resized);
            $imageContent = ob_get_contents();
            ob_end_clean();
            print $buffer;
        }
    }
    # else copy original
    Sql_Query(sprintf('insert into %s (template,filename,mimetype,data,width,height) values(0,"ORGANISATIONLOGO%d.png","%s","%s",%d,%d)', $GLOBALS['tables']['templateimage'], $size, $imgSize['mime'], base64_encode($imageContent), $newwidth, $newheight));
    return true;
}
开发者ID:pedru,项目名称:phplist3,代码行数:54,代码来源:lib.php

示例7: loadMessageData

function loadMessageData($msgid)
{
    $default = array('from' => getConfig('message_from_address'), 'google_track' => getConfig('always_add_googletracking'));
    if (empty($default['from'])) {
        $default['from'] = getConfig('admin_address');
    }
    if (!isset($GLOBALS['MD']) || !is_array($GLOBALS['MD'])) {
        $GLOBALS['MD'] = array();
    }
    if (isset($GLOBALS['MD'][$msgid])) {
        return $GLOBALS['MD'][$msgid];
    }
    ## when loading an old message that hasn't got data stored in message data, load it from the message table
    $prevMsgData = Sql_Fetch_Assoc_Query(sprintf('select * from %s where id = %d', $GLOBALS['tables']['message'], $msgid));
    $finishSending = time() + DEFAULT_MESSAGEAGE;
    $messagedata = array('template' => getConfig("defaultmessagetemplate"), 'sendformat' => 'HTML', 'message' => '', 'forwardmessage' => '', 'textmessage' => '', 'rsstemplate' => '', 'embargo' => array('year' => date('Y'), 'month' => date('m'), 'day' => date('d'), 'hour' => date('H'), 'minute' => date('i')), 'repeatinterval' => 0, 'repeatuntil' => array('year' => date('Y'), 'month' => date('m'), 'day' => date('d'), 'hour' => date('H'), 'minute' => date('i')), 'requeueinterval' => 0, 'requeueuntil' => array('year' => date('Y'), 'month' => date('m'), 'day' => date('d'), 'hour' => date('H'), 'minute' => date('i')), 'finishsending' => array('year' => date('Y', $finishSending), 'month' => date('m', $finishSending), 'day' => date('d', $finishSending), 'hour' => date('H', $finishSending), 'minute' => date('i', $finishSending)), 'fromfield' => '', 'subject' => '', 'forwardsubject' => '', 'footer' => getConfig("messagefooter"), 'forwardfooter' => getConfig("forwardfooter"), 'status' => '', 'tofield' => '', 'replyto' => '', 'targetlist' => '', 'criteria_match' => '', 'sendurl' => '', 'sendmethod' => 'inputhere', 'testtarget' => '', 'notify_start' => getConfig("notifystart_default"), 'notify_end' => getConfig("notifyend_default"), 'google_track' => $default['google_track'] == 'true' || $default['google_track'] === true || $default['google_track'] == '1', 'excludelist' => array());
    if (is_array($prevMsgData)) {
        foreach ($prevMsgData as $key => $val) {
            $messagedata[$key] = $val;
        }
    }
    $msgdata_req = Sql_Query(sprintf('select * from %s where id = %d', $GLOBALS['tables']['messagedata'], $msgid));
    while ($row = Sql_Fetch_Assoc($msgdata_req)) {
        if (strpos($row['data'], 'SER:') === 0) {
            $data = stripSlashesArray(unserialize(substr($row['data'], 4)));
        } else {
            $data = stripslashes($row['data']);
        }
        if (!in_array($row['name'], array('astext', 'ashtml', 'astextandhtml', 'aspdf', 'astextandpdf'))) {
            ## don't overwrite counters in the message table from the data table
            $messagedata[stripslashes($row['name'])] = $data;
        }
    }
    foreach (array('embargo', 'repeatuntil', 'requeueuntil') as $datefield) {
        if (!is_array($messagedata[$datefield])) {
            $messagedata[$datefield] = array('year' => date('Y'), 'month' => date('m'), 'day' => date('d'), 'hour' => date('H'), 'minute' => date('i'));
        }
    }
    // Load lists that were targetted with message...
    $result = Sql_Query(sprintf('select list.name,list.id 
    from ' . $GLOBALS['tables']['listmessage'] . ' listmessage,' . $GLOBALS['tables']['list'] . ' list
     where listmessage.messageid = %d and listmessage.listid = list.id', $msgid));
    while ($lst = Sql_fetch_array($result)) {
        $messagedata["targetlist"][$lst["id"]] = 1;
    }
    ## backwards, check that the content has a url and use it to fill the sendurl
    if (empty($messagedata['sendurl'])) {
        ## can't do "ungreedy matching, in case the URL has placeholders, but this can potentially
        ## throw problems
        if (preg_match('/\\[URL:(.*)\\]/i', $messagedata['message'], $regs)) {
            $messagedata['sendurl'] = $regs[1];
        }
    }
    if (empty($messagedata['sendurl']) && !empty($messagedata['message'])) {
        # if there's a message and no url, make sure to show the editor, and not the URL input
        $messagedata['sendmethod'] = 'inputhere';
    }
    ### parse the from field into it's components - email and name
    if (preg_match("/([^ ]+@[^ ]+)/", $messagedata["fromfield"], $regs)) {
        # if there is an email in the from, rewrite it as "name <email>"
        $messagedata["fromname"] = str_replace($regs[0], "", $messagedata["fromfield"]);
        $messagedata["fromemail"] = $regs[0];
        # if the email has < and > take them out here
        $messagedata["fromemail"] = str_replace("<", "", $messagedata["fromemail"]);
        $messagedata["fromemail"] = str_replace(">", "", $messagedata["fromemail"]);
        # make sure there are no quotes around the name
        $messagedata["fromname"] = str_replace('"', "", ltrim(rtrim($messagedata["fromname"])));
    } elseif (strpos($messagedata["fromfield"], " ")) {
        # if there is a space, we need to add the email
        $messagedata["fromname"] = $messagedata["fromfield"];
        #  $cached[$messageid]["fromemail"] = "listmaster@$domain";
        $messagedata["fromemail"] = $default['from'];
    } else {
        $messagedata["fromemail"] = $default['from'];
        $messagedata["fromname"] = $messagedata["fromfield"];
    }
    $messagedata["fromname"] = trim($messagedata["fromname"]);
    # erase double spacing
    while (strpos($messagedata["fromname"], "  ")) {
        $messagedata["fromname"] = str_replace("  ", " ", $messagedata["fromname"]);
    }
    ## if the name ends up being empty, copy the email
    if (empty($messagedata["fromname"])) {
        $messagedata["fromname"] = $messagedata["fromemail"];
    }
    if (!empty($messagedata['targetlist']['unselect'])) {
        unset($messagedata['targetlist']['unselect']);
    }
    if (!empty($messagedata['excludelist']['unselect'])) {
        unset($messagedata['excludelist']['unselect']);
    }
    $GLOBALS['MD'][$msgid] = $messagedata;
    #  var_dump($messagedata);
    return $messagedata;
}
开发者ID:juvenal,项目名称:PHPlist,代码行数:95,代码来源:lib.php

示例8: sendEmail

function sendEmail($messageid, $email, $hash, $htmlpref = 0, $rssitems = array(), $forwardedby = array())
{
    $getspeedstats = VERBOSE && !empty($GLOBALS['getspeedstats']) && isset($GLOBALS['processqueue_timer']);
    $sqlCountStart = $GLOBALS['pagestats']['number_of_queries'];
    $isTestMail = isset($_GET['page']) && $_GET['page'] == 'send';
    ## for testing concurrency, put in a delay to check if multiple send processes cause duplicates
    #usleep(rand(0,10) * 1000000);
    global $strThisLink, $strUnsubscribe, $PoweredByImage, $PoweredByText, $cached, $website, $counters;
    if ($email == '') {
        return 0;
    }
    if ($getspeedstats) {
        output('sendEmail start ' . $GLOBALS['processqueue_timer']->interval(1));
    }
    #0013076: different content when forwarding 'to a friend'
    if (FORWARD_ALTERNATIVE_CONTENT) {
        $forwardContent = count($forwardedby) > 0;
    } else {
        $forwardContent = 0;
    }
    if (empty($cached[$messageid])) {
        if (!precacheMessage($messageid, $forwardContent)) {
            unset($cached[$messageid]);
            logEvent('Error loading message ' . $messageid . '  in cache');
            return 0;
        }
    } else {
        #  dbg("Using cached {$cached[$messageid]["fromemail"]}");
        if (VERBOSE) {
            output('Using cached message');
        }
    }
    if (VERBOSE) {
        output(s('Sending message %d with subject %s to %s', $messageid, $cached[$messageid]['subject'], $email));
    }
    ## at this stage we don't know whether the content is HTML or text, it's just content
    $content = $cached[$messageid]['content'];
    if (VERBOSE && $getspeedstats) {
        output('Load user start');
    }
    $userdata = array();
    $user_att_values = array();
    #0011857: forward to friend, retain attributes
    if ($hash == 'forwarded' && defined('KEEPFORWARDERATTRIBUTES') && KEEPFORWARDERATTRIBUTES) {
        $user_att_values = getUserAttributeValues($forwardedby['email']);
    } elseif ($hash != 'forwarded') {
        $user_att_values = getUserAttributeValues($email);
    }
    if (!is_array($user_att_values)) {
        $user_att_values = array();
    }
    foreach ($user_att_values as $key => $val) {
        $newkey = cleanAttributeName($key);
        ## in the help, we only list attributes with "strlen <= 30"
        unset($user_att_values[$key]);
        if (strlen($key) <= 30) {
            $user_att_values[$newkey] = $val;
        }
    }
    # print '<pre>';var_dump($user_att_values);print '</pre>';exit;
    $query = sprintf('select * from %s where email = "%s"', $GLOBALS['tables']['user'], sql_escape($email));
    $userdata = Sql_Fetch_Assoc_Query($query);
    if (empty($userdata['id'])) {
        $userdata = array();
    }
    #var_dump($userdata);
    if (stripos($content, '[LISTS]') !== false) {
        $listsarr = array();
        $req = Sql_Query(sprintf('select list.name,list.active from %s as list,%s as listuser where list.id = listuser.listid and listuser.userid = %d', $GLOBALS['tables']['list'], $GLOBALS['tables']['listuser'], $userdata['id']));
        while ($row = Sql_Fetch_Assoc($req)) {
            if ($row['active'] || PREFERENCEPAGE_SHOW_PRIVATE_LISTS) {
                array_push($listsarr, stripslashes($row['name']));
            }
        }
        if (!empty($listsarr)) {
            $html['lists'] = implode('<br/>', $listsarr);
            $text['lists'] = implode("\n", $listsarr);
        } else {
            $html['lists'] = $GLOBALS['strNoListsFound'];
            $text['lists'] = $GLOBALS['strNoListsFound'];
        }
        unset($listsarr);
    }
    if (VERBOSE && $getspeedstats) {
        output('Load user end');
    }
    if ($cached[$messageid]['userspecific_url']) {
        if (VERBOSE && $getspeedstats) {
            output('fetch personal URL start');
        }
        ## Fetch external content, only if the URL has placeholders
        if ($GLOBALS['can_fetchUrl'] && preg_match("/\\[URL:([^\\s]+)\\]/i", $content, $regs)) {
            while (isset($regs[1]) && strlen($regs[1])) {
                $url = $regs[1];
                if (!preg_match('/^http/i', $url)) {
                    $url = 'http://' . $url;
                }
                $remote_content = fetchUrl($url, $userdata);
                # @@ don't use this
                #      $remote_content = includeStyles($remote_content);
//.........这里部分代码省略.........
开发者ID:MarcelvC,项目名称:phplist3,代码行数:101,代码来源:sendemaillib.php

示例9: sendEmail

function sendEmail($messageid, $email, $hash, $htmlpref = 0, $rssitems = array(), $forwardedby = array())
{
    global $strThisLink, $PoweredByImage, $PoweredByText, $cached, $website;
    if ($email == "") {
        return 0;
    }
    #0013076: different content when forwarding 'to a friend'
    if (FORWARD_ALTERNATIVE_CONTENT) {
        $forwardContent = sizeof($forwardedby) > 0;
        $messagedata = loadMessageData($messageid);
    } else {
        $forwardContent = 0;
    }
    if (empty($cached[$messageid])) {
        $domain = getConfig("domain");
        $message = Sql_query("select * from {$GLOBALS["tables"]["message"]} where id = {$messageid}");
        $cached[$messageid] = array();
        $message = Sql_fetch_array($message);
        if (ereg("([^ ]+@[^ ]+)", $message["fromfield"], $regs)) {
            # if there is an email in the from, rewrite it as "name <email>"
            $message["fromfield"] = ereg_replace($regs[0], "", $message["fromfield"]);
            $cached[$messageid]["fromemail"] = $regs[0];
            # if the email has < and > take them out here
            $cached[$messageid]["fromemail"] = ereg_replace("<", "", $cached[$messageid]["fromemail"]);
            $cached[$messageid]["fromemail"] = ereg_replace(">", "", $cached[$messageid]["fromemail"]);
            # make sure there are no quotes around the name
            $cached[$messageid]["fromname"] = ereg_replace('"', "", ltrim(rtrim($message["fromfield"])));
        } elseif (ereg(" ", $message["fromfield"], $regs)) {
            # if there is a space, we need to add the email
            $cached[$messageid]["fromname"] = $message["fromfield"];
            $cached[$messageid]["fromemail"] = "listmaster@{$domain}";
        } else {
            $cached[$messageid]["fromemail"] = $message["fromfield"] . "@{$domain}";
            ## makes more sense not to add the domain to the word, but the help says it does
            ## so let's keep it for now
            $cached[$messageid]["fromname"] = $message["fromfield"] . "@{$domain}";
        }
        # erase double spacing
        while (ereg("  ", $cached[$messageid]["fromname"])) {
            $cached[$messageid]["fromname"] = eregi_replace("  ", " ", $cached[$messageid]["fromname"]);
        }
        ## this has weird effects when used with only one word, so take it out for now
        #    $cached[$messageid]["fromname"] = eregi_replace("@","",$cached[$messageid]["fromname"]);
        $cached[$messageid]["fromname"] = trim($cached[$messageid]["fromname"]);
        $cached[$messageid]["to"] = $message["tofield"];
        #0013076: different content when forwarding 'to a friend'
        $cached[$messageid]["subject"] = $forwardContent ? stripslashes($messagedata["forwardsubject"]) : $message["subject"];
        $cached[$messageid]["replyto"] = $message["replyto"];
        #0013076: different content when forwarding 'to a friend'
        $cached[$messageid]["content"] = $forwardContent ? stripslashes($messagedata["forwardmessage"]) : $message["message"];
        if (USE_MANUAL_TEXT_PART && !$forwardContent) {
            $cached[$messageid]["textcontent"] = $message["textmessage"];
        } else {
            $cached[$messageid]["textcontent"] = '';
        }
        #0013076: different content when forwarding 'to a friend'
        $cached[$messageid]["footer"] = $forwardContent ? stripslashes($messagedata["forwardfooter"]) : $message["footer"];
        $cached[$messageid]["htmlformatted"] = $message["htmlformatted"];
        $cached[$messageid]["sendformat"] = $message["sendformat"];
        if ($message["template"]) {
            $req = Sql_Fetch_Row_Query("select template from {$GLOBALS["tables"]["template"]} where id = {$message["template"]}");
            $cached[$messageid]["template"] = stripslashes($req[0]);
            $cached[$messageid]["templateid"] = $message["template"];
            #   dbg("TEMPLATE: ".$req[0]);
        } else {
            $cached[$messageid]["template"] = '';
            $cached[$messageid]["templateid"] = 0;
        }
        ## @@ put this here, so it can become editable per email sent out at a later stage
        $cached[$messageid]["html_charset"] = getConfig("html_charset");
        ## @@ need to check on validity of charset
        if (!$cached[$messageid]["html_charset"]) {
            $cached[$messageid]["html_charset"] = 'iso-8859-1';
        }
        $cached[$messageid]["text_charset"] = getConfig("text_charset");
        if (!$cached[$messageid]["text_charset"]) {
            $cached[$messageid]["text_charset"] = 'iso-8859-1';
        }
    }
    # else
    #  dbg("Using cached {$cached[$messageid]["fromemail"]}");
    if (VERBOSE) {
        output($GLOBALS['I18N']->get('sendingmessage') . ' ' . $messageid . ' ' . $GLOBALS['I18N']->get('withsubject') . ' ' . $cached[$messageid]["subject"] . ' ' . $GLOBALS['I18N']->get('to') . ' ' . $email);
    }
    # erase any placeholders that were not found
    #  $msg = ereg_replace("\[[A-Z ]+\]","",$msg);
    #0011857: forward to friend, retain attributes
    if ($hash == 'forwarded' && defined('KEEPFORWARDERATTRIBUTES') && KEEPFORWARDERATTRIBUTES) {
        $user_att_values = getUserAttributeValues($forwardedby['email']);
    } else {
        $user_att_values = getUserAttributeValues($email);
    }
    $userdata = Sql_Fetch_Assoc_Query(sprintf('select * from %s where email = "%s"', $GLOBALS["tables"]["user"], $email));
    $url = getConfig("unsubscribeurl");
    $sep = ereg('\\?', $url) ? '&' : '?';
    $html["unsubscribe"] = sprintf('<a href="%s%suid=%s">%s</a>', $url, $sep, $hash, $strThisLink);
    $text["unsubscribe"] = sprintf('%s%suid=%s', $url, $sep, $hash);
    $html["unsubscribeurl"] = sprintf('%s%suid=%s', $url, $sep, $hash);
    $text["unsubscribeurl"] = sprintf('%s%suid=%s', $url, $sep, $hash);
    #0013076: Blacklisting posibility for unknown users
//.........这里部分代码省略.........
开发者ID:kvervo,项目名称:phplist-aiesec,代码行数:101,代码来源:sendemaillib.php

示例10: sprintf

          $userid = $req[1];
          $userpassword = $req[2];
          $emailcheck = $req[3];
        */
    }
}
if (isset($_REQUEST['id']) && $_REQUEST["id"]) {
    $id = sprintf('%d', $_REQUEST["id"]);
}
# make sure the subscribe page still exists
$req = Sql_fetch_row_query(sprintf('select id from %s where id = %d', $tables["subscribepage"], $id));
$id = $req[0];
$msg = "";
if (!empty($_POST["sendpersonallocation"])) {
    if (isset($_POST['email']) && $_POST["email"]) {
        $uid = Sql_Fetch_Assoc_Query(sprintf('select uniqid,email,id,blacklisted from %s where email = "%s"', $tables["user"], sql_escape($_POST["email"])));
        if ($uid['blacklisted']) {
            $msg .= $GLOBALS["strYouAreBlacklisted"];
        } elseif ($uid['uniqid']) {
            sendMail($uid['email'], getConfig("personallocation_subject"), getUserConfig("personallocation_message", $uid['id']), system_messageheaders(), $GLOBALS["envelope"]);
            $msg = $GLOBALS["strPersonalLocationSent"];
            addSubscriberStatistics('personal location sent', 1);
        } else {
            $msg = $GLOBALS["strUserNotFound"];
        }
    }
}
if (isset($_GET['p']) && $_GET["p"] == "subscribe") {
    $_SESSION["userloggedin"] = 0;
    $_SESSION["userdata"] = array();
}
开发者ID:bcantwell,项目名称:website,代码行数:31,代码来源:index.php

示例11: dirname

<?php

require_once dirname(__FILE__) . '/accesscheck.php';
@ob_end_clean();
$id = sprintf('%d', $_GET['id']);
if (!$id) {
    return '';
}
$message = Sql_Fetch_Assoc_Query(sprintf('select * from %s where id = %d', $GLOBALS['tables']['message'], $id));
$messagedata = loadMessageData($id);
if ($message['status'] != 'inprocess') {
    $html = $message['status'];
    $html .= '<br/>' . PageLink2('messages', $GLOBALS['I18N']->get('requeue'), 'resend=' . $message['id']);
} else {
    $active = time() - $messagedata['last msg sent'];
    if ($active > 60) {
        $html = $GLOBALS['I18N']->get('Stalled');
    } else {
        $totalsent = $messagedata['astext'] + $messagedata['ashtml'] + $messagedata['astextandhtml'] + $messagedata['aspdf'] + $messagedata['astextandpdf'];
        $html = $GLOBALS['I18N']->get($message['status']) . '<br/>' . $messagedata['to process'] . ' ' . $GLOBALS['I18N']->get('still to process') . '<br/>' . $GLOBALS['I18N']->get('ETA') . ': ' . $messagedata['ETA'] . '<br/>' . $GLOBALS['I18N']->get('sent') . ': ' . $totalsent . '<br/>' . $GLOBALS['I18N']->get('Processing') . ' ' . sprintf('%d', $messagedata['msg/hr']) . ' ' . $GLOBALS['I18N']->get('msgs/hr');
    }
}
print $html;
exit;
开发者ID:MarcelvC,项目名称:phplist3,代码行数:24,代码来源:msgstatus.php

示例12: shortenTextDisplay

            $element = shortenTextDisplay($row['url']);
            $ls->addElement($element, PageUrl2('uclicks&amp;id=' . $row['forwardid']));
            $ls->setClass($element, 'row1');
            $ls->addColumn($element, $GLOBALS['I18N']->get('message'), PageLink2('mclicks&amp;id=' . $row['messageid'], ' ' . $row['messageid']));
        }
        #  $element = sprintf('<a href="%s" target="_blank" class="url" title="%s">%s</a>',$row['url'],$row['url'],substr(str_replace('http://','',$row['url']),0,50));
        #  $total = Sql_Verbose_Query(sprintf('select count(*) as total from %s where messageid = %d and url = "%s"',
        #    $GLOBALS['tables']['linktrack'],$id,$row['url']));
        #  $totalsent = Sql_Fetch_Array_Query(sprintf('select count(*) as total from %s where url = "%s"',
        #    $GLOBALS['tables']['linktrack'],$urldata['url']));
        $ls_userid = '';
        if (!$userid) {
            $ls_userid = '<span class="viewusers"><a class="button" href="' . PageUrl2('userclicks&amp;userid=' . $row['userid']) . '" title="' . $GLOBALS['I18N']->get('view user') . '"></a></span>';
        }
        if (!empty($row['userid'])) {
            $userStatus = Sql_Fetch_Assoc_Query(sprintf('select blacklisted,confirmed from %s where id = %d', $GLOBALS['tables']['user'], $row['userid']));
            $ls->addColumn($element, s('Status'), $userStatus['confirmed'] && empty($userStatus['blacklisted']) ? $GLOBALS['img_tick'] : $GLOBALS['img_cross']);
        }
        $ls->addColumn($element, $GLOBALS['I18N']->get('firstclick'), formatDateTime($row['firstclick'], 1));
        $ls->addColumn($element, $GLOBALS['I18N']->get('latestclick'), $row['latestclick']);
        $ls->addColumn($element, $GLOBALS['I18N']->get('clicks'), $row['clicked'] . $ls_userid);
        if (!empty($row['htmlclicked']) && !empty($row['textclicked'])) {
            $ls->addRow($element, '<div class="content listingsmall fright gray">' . $GLOBALS['I18N']->get('HTML') . ': ' . $row['htmlclicked'] . '</div>' . '<div class="content listingsmall fright gray">' . $GLOBALS['I18N']->get('text') . ': ' . $row['textclicked'] . '</div>', '');
        }
        #  $ls->addColumn($element,$GLOBALS['I18N']->get('sent'),$total['total']);
        #  $perc = sprintf('%0.2f',($row['numclicks'] / $totalsent['total'] * 100));
        #  $ls->addColumn($element,$GLOBALS['I18N']->get('clickrate'),$perc.'%');
        $summary['totalclicks'] += $row['clicked'];
    }
}
## adding a total doesn't make sense if we're not listing everything, it'll only do the total of the page
开发者ID:gillima,项目名称:phplist3,代码行数:31,代码来源:userclicks.php

示例13: sprintf

<?php

$id = sprintf('%d', $_GET['id']);
if (!$id) {
    return '';
}
$message = Sql_Fetch_Assoc_Query(sprintf('select *,unix_timestamp(embargo) - unix_timestamp(now()) as secstowait from %s where id = %d', $GLOBALS['tables']['message'], $id));
$messagedata = loadMessageData($id);
$pqchoice = getConfig('pqchoice');
$totalsent = $messagedata['astext'] + $messagedata['ashtml'] + $messagedata['astextandhtml'] + $messagedata['aspdf'] + $messagedata['astextandpdf'] + $messagedata['sentastest'];
$num_users = 0;
if (isset($messagedata['to process'])) {
    $num_users = $messagedata['to process'];
}
$sent = $totaltime = $sampletime = $samplesent = 0;
if (!isset($messagedata['sampletime'])) {
    ## take a "sample" of the send speed, to calculate msg/hr
    $sampletime = time();
    $samplesent = $totalsent;
    setMessageData($id, 'sampletime', $sampletime);
    setMessageData($id, 'samplesent', $samplesent);
} else {
    $totaltime = time() - $messagedata['sampletime'];
    $sent = $totalsent - $messagedata['samplesent'];
    if ($totaltime > MESSAGE_SENDSTATUS_SAMPLETIME) {
        ## refresh speed sampling
        setMessageData($id, 'sampletime', time());
        setMessageData($id, 'samplesent', $totalsent);
    }
}
if ($sent > 0 && $totaltime > 0) {
开发者ID:gillima,项目名称:phplist3,代码行数:31,代码来源:msgstatus.php

示例14: campaignTitle

function campaignTitle($id)
{
    $campaignTitle = Sql_Fetch_Assoc_Query(sprintf('select data as title from %s where name = "subject" and id = %d', $GLOBALS['tables']['messagedata'], $id));
    if (empty($campaignTitle['title'])) {
        $campaignTitle = Sql_Fetch_Assoc_Query(sprintf('select subject as title from %s where id = %d', $GLOBALS['tables']['message'], $id));
    }
    if (empty($campaignTitle['title'])) {
        $campaignTitle['title'] = $id;
    }
    return stripslashes($campaignTitle['title']);
}
开发者ID:hedrickbt,项目名称:phplist3,代码行数:11,代码来源:lib.php


注:本文中的Sql_Fetch_Assoc_Query函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。