本文整理汇总了PHP中UserAttributeValue函数的典型用法代码示例。如果您正苦于以下问题:PHP UserAttributeValue函数的具体用法?PHP UserAttributeValue怎么用?PHP UserAttributeValue使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UserAttributeValue函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_time_limit
set_time_limit(500);
if ($done % 50 == 0) {
print '<script type="text/javascript">
var parentJQuery = window.parent.jQuery;
parentJQuery("#progressbar").updateProgress("' . $done . ',' . $todo . '");
</script>';
flush();
}
++$done;
reset($_SESSION['export']['cols']);
while (list($key, $val) = each($_SESSION['export']['cols'])) {
fwrite($exportfile, strtr($user[$val], $col_delim, ',') . $col_delim);
}
reset($attributes);
while (list($key, $val) = each($attributes)) {
$value = UserAttributeValue($user['id'], $val['id']);
fwrite($exportfile, quoteEnclosed($value, $col_delim, $row_delim) . $col_delim);
}
if ($exporthistory) {
fwrite($exportfile, quoteEnclosed($user['ip'], $col_delim, $row_delim) . $col_delim);
fwrite($exportfile, quoteEnclosed($user['summary'], $col_delim, $row_delim) . $col_delim);
fwrite($exportfile, quoteEnclosed($user['detail'], $col_delim, $row_delim) . $col_delim);
}
$lists = Sql_query("select listid,name from\n {$tables['listuser']},{$tables['list']} where userid = " . $user['id'] . " and\n {$tables['listuser']}.listid = {$tables['list']}.id {$listselect_and}");
if (!Sql_Affected_rows($lists)) {
fwrite($exportfile, 'No Lists');
}
while ($list = Sql_fetch_array($lists)) {
fwrite($exportfile, stripslashes($list['name']) . '; ');
}
fwrite($exportfile, $row_delim);
示例2: UserAttributeValueSelect
function UserAttributeValueSelect($user,$attribute) {
if (!$user || !$attribute) return;
global $table_prefix,$tables;
# workaround for integration webbler/phplist
if (!isset($table_prefix))
$table_prefix = "phplist_";
if ($tables["attribute"]) {
$att_table = $tables["attribute"];
$user_att_table = $tables["user_attribute"];
} else {
$att_table = "attribute";
$user_att_table = "user_attribute";
}
if (!Sql_Table_exists($att_table)) {
return "broken attribute $attribute";
}
$att = Sql_Fetch_array_Query("select * from $att_table where id = $attribute");
# $value = UserAttributeValue($att["tablename"],$attribute);
$value = UserAttributeValue($user,$attribute);
$html .= 'Value: '.$value;
$html = sprintf('<select name="attribute[%d]" style="attributeinput" >',$attribute);
$res = Sql_Query("select id,name from $table_prefix"."listattr_".$att["tablename"]." order by name");
if (!Sql_Affected_Rows())
return "(No values available)";
$html .= '<option value="0">-- no value</option>';
while ($row = Sql_Fetch_Row($res))
$html .= sprintf('<option value="%d" %s>%s',$row[0],$row[1] == $value?"selected":"",$row[1]);
return $html . '</select>';
}
示例3: if
# if ($value != "") {
if (is_array($value)) {
$newval = array();
foreach ($value as $val) {
array_push($newval, sprintf('%0' . $checkboxgroup_storesize . 'd', $val));
}
$value = join(",", $newval);
} elseif ($row["type"] == "date") {
$value = $date->getDate($fieldname);
} elseif ($row['type'] != 'textarea') {
if (preg_match("/(.*)\n/U", $value, $regs)) {
$value = $regs[1];
}
}
Sql_Query(sprintf('replace into %s (attributeid,userid,value) values("%s","%s","%s")', $GLOBALS["tables"]["user_attribute"], $row["id"], $userid, $value));
$history_entry .= "\n" . $row["name"] . ' = ' . UserAttributeValue($userid, $row["id"]);
# }
}
}
$information_changed = 0;
if (isset($old_data) && is_array($old_data)) {
$history_subject = 'Re-Subscription';
# when they submit a new subscribe
$current_data = Sql_Fetch_Array_Query(sprintf('select * from %s where id = %d', $GLOBALS["tables"]["user"], $userid));
$current_data = array_merge($current_data, getUserAttributeValues('', $userid));
foreach ($current_data as $key => $val) {
if (!is_numeric($key)) {
if ($old_data[$key] != $val && $key != "password" && $key != "modified") {
$information_changed = 1;
$history_entry .= "\n{$key} = {$val}\n*changed* from {$old_data[$key]}";
}
示例4: forwardPage
function forwardPage($id)
{
global $tables;
$ok = true;
$subtitle = '';
$info = '';
$html = '';
$form = '';
$personalNote = '';
## Check requirements
# message
$mid = 0;
if (isset($_REQUEST['mid'])) {
$mid = sprintf('%d', $_REQUEST['mid']);
$messagedata = loadMessageData($mid);
$mid = $messagedata['id'];
if ($mid) {
$subtitle = $GLOBALS['strForwardSubtitle'] . ' ' . stripslashes($messagedata['subject']);
}
}
#mid set
# user
if (!isset($_REQUEST['uid']) || !$_REQUEST['uid']) {
FileNotFound();
}
## get userdata
$req = Sql_Query(sprintf('select * from %s where uniqid = "%s"', $tables['user'], sql_escape($_REQUEST['uid'])));
$userdata = Sql_Fetch_Array($req);
## verify that this subscriber actually received this message to forward, otherwise they're not allowed
$allowed = Sql_Fetch_Row_Query(sprintf('select userid from %s where userid = %d and messageid = %d', $GLOBALS['tables']['usermessage'], $userdata['id'], $mid));
if (empty($userdata['id']) || $allowed[0] != $userdata['id']) {
## when sending a test email as an admin, the entry isn't there yet
if (empty($_SESSION['adminloggedin']) || $_SESSION['adminloggedin'] != $_SERVER['REMOTE_ADDR']) {
FileNotFound('<br/><i>' . $GLOBALS['I18N']->get('When testing the phpList forward functionality, you need to be logged in as an administrator.') . '</i><br/>');
}
}
$firstpage = 1;
## is this the initial page or a followup
# forward addresses
$forwardemail = '';
if (isset($_REQUEST['email']) && !empty($_REQUEST['email'])) {
$firstpage = 0;
$forwardPeriodCount = Sql_Fetch_Array_Query(sprintf('select count(user) from %s where date_add(time,interval %s) >= now() and user = %d and status ="sent" ', $tables['user_message_forward'], FORWARD_EMAIL_PERIOD, $userdata['id']));
$forwardemail = stripslashes($_REQUEST['email']);
$emails = explode("\n", $forwardemail);
$emails = trimArray($emails);
$forwardemail = implode("\n", $emails);
#0011860: forward to friend, multiple emails
$emailCount = $forwardPeriodCount[0];
foreach ($emails as $index => $email) {
$emails[$index] = trim($email);
if (is_email($email)) {
++$emailCount;
} else {
$info .= sprintf('<br />' . $GLOBALS['strForwardInvalidEmail'], $email);
$ok = false;
}
}
if ($emailCount > FORWARD_EMAIL_COUNT) {
$info .= '<br />' . $GLOBALS['strForwardCountReached'];
$ok = false;
}
} else {
$ok = false;
}
#0011996: forward to friend - personal message
# text cannot be longer than max, to prevent very long text with only linefeeds total cannot be longer than twice max
if (FORWARD_PERSONAL_NOTE_SIZE && isset($_REQUEST['personalNote'])) {
if (strlen(strip_newlines($_REQUEST['personalNote'])) > FORWARD_PERSONAL_NOTE_SIZE || strlen($_REQUEST['personalNote']) > FORWARD_PERSONAL_NOTE_SIZE * 2) {
$info .= '<BR />' . $GLOBALS['strForwardNoteLimitReached'];
$ok = false;
}
$personalNote = strip_tags(htmlspecialchars_decode(stripslashes($_REQUEST['personalNote'])));
$userdata['personalNote'] = $personalNote;
}
if ($userdata['id'] && $mid) {
if ($ok && count($emails)) {
## All is well, send it
require_once 'admin/sendemaillib.php';
#0013845 Lead Ref Scheme
if (FORWARD_FRIEND_COUNT_ATTRIBUTE) {
$iCountFriends = FORWARD_FRIEND_COUNT_ATTRIBUTE;
} else {
$iCountFriends = 0;
}
if ($iCountFriends) {
$nFriends = intval(UserAttributeValue($userdata['id'], $iCountFriends));
}
## remember the lists for this message in order to notify only those admins
## that own them
$messagelists = array();
$messagelistsreq = Sql_Query(sprintf('select listid from %s where messageid = %d', $GLOBALS['tables']['listmessage'], $mid));
while ($row = Sql_Fetch_Row($messagelistsreq)) {
array_push($messagelists, $row[0]);
}
foreach ($emails as $index => $email) {
#0011860: forward to friend, multiple emails
$done = Sql_Fetch_Array_Query(sprintf('select user,status,time from %s where forward = "%s" and message = %d', $tables['user_message_forward'], $email, $mid));
$info .= '<br />' . $email . ': ';
if ($done['status'] === 'sent') {
//.........这里部分代码省略.........
示例5: set_time_limit
set_time_limit(500);
if ($done % 50 == 0) {
print '<script type="text/javascript">
var parentJQuery = window.parent.jQuery;
parentJQuery("#progressbar").updateProgress("' . $done . ',' . $todo . '");
</script>';
flush();
}
$done++;
reset($_SESSION['export']['cols']);
while (list($key, $val) = each($_SESSION['export']['cols'])) {
fwrite($exportfile, strtr($user[$val], $col_delim, ",") . $col_delim);
}
reset($attributes);
while (list($key, $val) = each($attributes)) {
$value = UserAttributeValue($user["id"], $val["id"]);
fwrite($exportfile, quoteEnclosed($value, $col_delim, $row_delim) . $col_delim);
}
if ($exporthistory) {
fwrite($exportfile, quoteEnclosed($user['ip'], $col_delim, $row_delim) . $col_delim);
fwrite($exportfile, quoteEnclosed($user['summary'], $col_delim, $row_delim) . $col_delim);
fwrite($exportfile, quoteEnclosed($user['detail'], $col_delim, $row_delim) . $col_delim);
}
$lists = Sql_query("select listid,name from\n {$tables['listuser']},{$tables['list']} where userid = " . $user["id"] . " and\n {$tables['listuser']}.listid = {$tables['list']}.id {$listselect_and}");
if (!Sql_Affected_rows($lists)) {
fwrite($exportfile, "No Lists");
}
while ($list = Sql_fetch_array($lists)) {
fwrite($exportfile, stripslashes($list["name"]) . "; ");
}
fwrite($exportfile, $row_delim);
示例6: if
# if ($value != "") {
if ($row['type'] == 'date') {
$value = $date->getDate($fieldname);
} elseif (is_array($value)) {
$newval = array();
foreach ($value as $val) {
array_push($newval, sprintf('%0' . $checkboxgroup_storesize . 'd', $val));
}
$value = implode(',', $newval);
} elseif ($row['type'] != 'textarea') {
if (preg_match("/(.*)\n/U", $value, $regs)) {
$value = $regs[1];
}
}
Sql_Query(sprintf('replace into %s (attributeid,userid,value) values("%s","%s","%s")', $GLOBALS['tables']['user_attribute'], $row['id'], $userid, $value));
$history_entry .= "\n" . $row['name'] . ' = ' . UserAttributeValue($userid, $row['id']);
# }
}
}
$information_changed = 0;
if (isset($old_data) && is_array($old_data)) {
$history_subject = 'Re-Subscription';
# when they submit a new subscribe
$current_data = Sql_Fetch_Array_Query(sprintf('select * from %s where id = %d', $GLOBALS['tables']['user'], $userid));
$current_data = array_merge($current_data, getUserAttributeValues('', $userid));
foreach ($current_data as $key => $val) {
if (!is_numeric($key)) {
if ($old_data[$key] != $val && $key != 'password' && $key != 'modified') {
$information_changed = 1;
$history_entry .= "\n{$key} = {$val}\n*changed* from {$old_data[$key]}";
}
示例7: UserAttributeValueSelect
function UserAttributeValueSelect($user = 0, $attribute = 0)
{
# if (!$user || !$attribute) return;
global $table_prefix, $tables;
# workaround for integration webbler/phplist
if (!isset($table_prefix)) {
$table_prefix = 'phplist_';
}
if ($tables['attribute']) {
$att_table = $tables['attribute'];
$user_att_table = $tables['user_attribute'];
} else {
$att_table = 'attribute';
$user_att_table = 'user_attribute';
}
if (!Sql_Table_exists($att_table)) {
return "broken attribute {$attribute}";
}
$att = Sql_Fetch_array_Query("select * from {$att_table} where id = {$attribute}");
# $value = UserAttributeValue($att["tablename"],$attribute);
$value = UserAttributeValue($user, $attribute);
# $html = 'Value: '.$value;
$html = sprintf('<select name="attribute[%d]" style="attributeinput" >', $attribute);
$res = Sql_Query("select id,name from {$table_prefix}" . 'listattr_' . $att['tablename'] . ' order by listorder,name');
if (!Sql_Affected_Rows()) {
return '(No values available)';
}
$html .= '<option value="0">-- no value</option>';
while ($row = Sql_Fetch_Row($res)) {
if ($row[1] != '') {
$html .= sprintf('<option value="%d" %s>%s </option>', $row[0], $row[1] == $value ? 'selected="selected"' : '', $row[1]);
}
}
return $html . '</select>';
}
示例8: Sql_query
}
print 'List Membership'."\n";
if ($list)
$result = Sql_query("SELECT {$tables['user']}.* FROM
{$tables['user']},{$tables['listuser']} where {$tables['user']}.id =
{$tables['listuser']}.userid and {$tables['listuser']}.listid = $list");
else
$result = Sql_query("SELECT * FROM {$tables['user']}");
while ($user = Sql_fetch_array($result)) {
set_time_limit(500);
reset($cols);
while (list ($key,$val) = each ($cols))
print strtr($user[$val],"\t",",")."\t";
reset($attributes);
while (list($key,$val) = each ($attributes)) {
print strtr(UserAttributeValue($user["id"],$val["id"]),"\t",",")."\t";
}
$lists = Sql_query("SELECT listid,name FROM
{$tables['listuser']},{$tables['list']} where userid = ".$user["id"]." and
{$tables['listuser']}.listid = {$tables['list']}.id");
if (!Sql_Affected_rows($lists))
print "No Lists";
while ($list = Sql_fetch_array($lists)) {
print $list["name"]." ";
}
print "\n";
}
exit;
示例9: forwardPage
function forwardPage($id)
{
global $data, $tables, $envelope;
$ok = true;
$subtitle = '';
$info = '';
$html = '';
$form = '';
## Check requirements
# user
if (!isset($_REQUEST["uid"]) || !$_REQUEST['uid']) {
FileNotFound();
}
$firstpage = 1;
## is this the initial page or a followup
# forward addresses
$forwardemail = '';
if (isset($_REQUEST['email']) && !empty($_REQUEST['email'])) {
$firstpage = 0;
$forwardPeriodCount = Sql_Fetch_Array_Query(sprintf('select count(user) from %s where date_add(time,interval %s) >= now() and user = %d and status ="sent" ', $tables['user_message_forward'], FORWARD_EMAIL_PERIOD, $userdata['id']));
$forwardemail = stripslashes($_REQUEST['email']);
$emails = explode("\n", $forwardemail);
$emails = trimArray($emails);
$forwardemail = implode("\n", $emails);
#0011860: forward to friend, multiple emails
$emailCount = $forwardPeriodCount[0];
foreach ($emails as $index => $email) {
$emails[$index] = trim($email);
if (is_email($email)) {
$emailCount++;
} else {
$info .= sprintf('<BR />' . $GLOBALS['strForwardInvalidEmail'], $email);
$ok = false;
}
}
if ($emailCount > FORWARD_EMAIL_COUNT) {
$info .= '<BR />' . $GLOBALS["strForwardCountReached"];
$ok = false;
}
} else {
$ok = false;
}
# message
$mid = 0;
if (isset($_REQUEST['mid'])) {
$mid = sprintf('%d', $_REQUEST['mid']);
$req = Sql_Query(sprintf('select * from %s where id = %d', $tables["message"], $mid));
$messagedata = Sql_Fetch_Array($req);
$mid = $messagedata['id'];
if ($mid) {
$subtitle = $GLOBALS['strForwardSubtitle'] . ' ' . stripslashes($messagedata['subject']);
}
}
#mid set
## get userdata
$req = Sql_Query("select * from {$tables["user"]} where uniqid = \"" . $_REQUEST["uid"] . "\"");
$userdata = Sql_Fetch_Array($req);
$req = Sql_Query(sprintf('select * from %s where email = "%s"', $tables["user"], $forwardemail));
$forwarduserdata = Sql_Fetch_Array($req);
#0011996: forward to friend - personal message
# text cannot be longer than max, to prevent very long text with only linefeeds total cannot be longer than twice max
if (FORWARD_PERSONAL_NOTE_SIZE && isset($_REQUEST['personalNote'])) {
if (strlen(strip_newlines($_REQUEST['personalNote'])) > FORWARD_PERSONAL_NOTE_SIZE || strlen($_REQUEST['personalNote']) > FORWARD_PERSONAL_NOTE_SIZE * 2) {
$info .= '<BR />' . $GLOBALS['strForwardNoteLimitReached'];
$ok = false;
}
$personalNote = strip_tags(htmlspecialchars_decode(stripslashes($_REQUEST['personalNote'])));
$userdata['personalNote'] = $personalNote;
}
if ($userdata["id"] && $mid) {
if ($ok && count($emails)) {
## All is well, send it
require 'admin/sendemaillib.php';
#0013845 Lead Ref Scheme
if (FORWARD_FRIEND_COUNT_ATTRIBUTE) {
$iCountFriends = getAttributeIDbyName(FORWARD_FRIEND_COUNT_ATTRIBUTE);
} else {
$iCountFriends = 0;
}
if ($iCountFriends) {
$nFriends = intval(UserAttributeValue($userdata['id'], $iCountFriends));
}
#0011860: forward to friend, multiple emails
foreach ($emails as $index => $email) {
#0011860: forward to friend, multiple emails
$done = Sql_Fetch_Array_Query(sprintf('select user,status,time from %s where forward = "%s" and message = %d', $tables['user_message_forward'], $email, $mid));
$info .= '<BR />' . $email . ': ';
if ($done['status'] === 'sent') {
$info .= $GLOBALS['strForwardAlreadyDone'];
} elseif (isBlackListed($email)) {
$info .= $GLOBALS['strForwardBlacklistedEmail'];
} else {
if (!TEST) {
# forward the message
# sendEmail will take care of blacklisting
if (sendEmail($mid, $email, 'forwarded', $userdata['htmlemail'], array(), $userdata)) {
$info .= $GLOBALS["strForwardSuccessInfo"];
sendAdminCopy("Message Forwarded", $userdata["email"] . " has forwarded a message {$mid} to {$email}");
Sql_Query(sprintf('insert into %s (user,message,forward,status,time)
values(%d,%d,"%s","sent",now())', $tables['user_message_forward'], $userdata['id'], $mid, $email));
//.........这里部分代码省略.........