本文整理汇总了PHP中Sql_Fetch_array函数的典型用法代码示例。如果您正苦于以下问题:PHP Sql_Fetch_array函数的具体用法?PHP Sql_Fetch_array怎么用?PHP Sql_Fetch_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Sql_Fetch_array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Sql_Query
# nothing changed
case "1.5.1":
# nothing changed
# nothing changed
case "1.6.0":
case "1.6.1":
# not released
# nothing changed
# not released
# nothing changed
case "1.6.2":
# something we should have done ages ago. make checkboxes save "on" value in user_attribute
$req = Sql_Query("select * from {$tables["attribute"]} where type = \"checkbox\"");
while ($row = Sql_Fetch_Array($req)) {
$req2 = Sql_Query("select * from {$table_prefix}" . "listattr_{$row['tablename']}");
while ($row2 = Sql_Fetch_array($req2)) {
if ($row2["name"] == "Checked") {
Sql_Query(sprintf('update %s set value = "on" where attributeid = %d and value = %d', $tables["user_attribute"], $row["id"], $row2["id"]));
}
}
Sql_Query(sprintf('update %s set value = "" where attributeid = %d and value != "on"', $tables["user_attribute"], $row["id"]));
Sql_Query("drop table {$table_prefix}" . "listattr_" . $row["tablename"]);
}
Sql_Query("insert into {$tables["task"]} (page,type) values(\"export\",\"user\")");
case "1.6.3":
case "1.6.4":
Sql_Query("alter table {$tables["user"]} add column bouncecount integer default 0");
Sql_Query("alter table {$tables["message"]} add column bouncecount integer default 0");
# we actually never used these tables, so we can just as well drop and recreate them
Sql_Query("drop table if exists {$tables["bounce"]}");
Sql_Query("drop table if exists {$tables["user_message_bounce"]}");
示例2: giveAlternative
function giveAlternative($table, $delete, $attributeid)
{
print "Alternatively you can replace all values with another one:" . formStart();
print '<select name=replace><option value="0">-- Replace with</option>';
$req = Sql_Query("select * from {$table} order by listorder,name");
while ($row = Sql_Fetch_array($req)) {
if ($row[id] != $delete) {
printf('<option value="%d">%s</option>', $row[id], $row[name]);
}
}
print "</select>";
printf('<input type=hidden name="delete" value="%d">', $delete);
printf('<input type=hidden name="id" value="%d">', $attributeid);
print '<input type=submit name="action" value="Delete and Replace"></form>';
}
示例3: findEl
var div2 = findEl("criteria_values_text");
var div3 = findEl(value_divs[choice]);
div1.style.visibility = "hidden";
div2.style.visibility = "hidden";
div3.style.visibility = "visible";
}
</script>
';
$att_drop = '<select name="criteria_attribute" onChange="changeDropDowns()" class="criteria_element" >';
$att_drop .= '<option value="">[' . $GLOBALS['I18N']->get('selectattribute') . ']</option>';
$att_names = '';
# to remember them later
$attreq = Sql_Query(sprintf('select * from %s where type in ("select","radio","date","checkboxgroup","checkbox") %s', $tables["attribute"], $already_used));
while ($att = Sql_Fetch_array($attreq)) {
$att_drop .= sprintf('<option value="%d" %s>%s</option>', $att["id"], "", substr(stripslashes($att["name"]), 0, 30) . ' (' . $GLOBALS['I18N']->get($att["type"]) . ')');
$att_names .= sprintf('<input type=hidden name="attribute_names[%d]" value="%s">', $att["id"], stripslashes($att["name"]));
}
$att_drop .= '</select>' . $att_names;
$operator_drop = '
<select name="criteria_operator" class="criteria_element" >
<option value="is">' . $GLOBALS['I18N']->get('is') . '</option>
<option value="isnot">' . $GLOBALS['I18N']->get('isnot') . '</option>
<option value="isbefore">' . $GLOBALS['I18N']->get('isbefore') . '</option>
<option value="isafter">' . $GLOBALS['I18N']->get('isafter') . '</option>
</select>
';
$values_drop = '
<style type="text/css">
#criteria_values_select {
示例4: ListAttributes
function ListAttributes($attributes,$attributedata,$htmlchoice = 0,$userid = 0) {
global $strPreferHTMLEmail,$strPreferTextEmail,
$strEmail,$tables,$table_prefix,$strPreferredFormat,$strText,$strHTML;
/* if (!sizeof($attributes)) {
return "No attributes have been defined for this page";
}
*/
if ($userid) {
$data = array();
$current = Sql_Fetch_array_Query("select * from {$tables["user"]} where id = $userid");
$datareq = Sql_Query("select * from {$tables["user_attribute"]} where userid = $userid");
while ($row = Sql_Fetch_Array($datareq)) {
$data[$row["attributeid"]] = $row["value"];
}
$email = $current["email"];
$htmlemail = $current["htmlemail"];
# override with posted info
foreach ($current as $key => $val) {
if ($_POST[$key] && $key != "password") {
$current[$key] = $val;
}
}
} else {
$email = stripslashes($_REQUEST["email"]);
$htmlemail = $_POST["htmlemail"];
}
$textlinewidth = sprintf('%d',getConfig("textline_width"));
if (!$textlinewidth) $textlinewidth = 40;
list($textarearows,$textareacols) = explode(",",getConfig("textarea_dimensions"));
if (!$textarearows) $textarearows = 10;
if (!$textareacols) $textareacols = 40;
$html = "";
if ($_GET["page"] != "import1")
$html .= sprintf('
<tr><td><div class="required">%s</div></td>
<td class="attributeinput"><input type=text name=email value="%s" size="%d">
<script language="Javascript" type="text/javascript">addFieldToCheck("email","%s");</script></td></tr>',
$strEmail,htmlspecialchars($email),$textlinewidth,$strEmail);
if ($_GET["page"] != "import1")
if (ASKFORPASSWORD) {
# we only require a password if there isnt one, so they can set it
# otherwise they can keep the existing, if they do not enter anything
if (!$current["password"]) {
$pwdclass = "required";
$js = sprintf('<script language="Javascript" type="text/javascript">addFieldToCheck("password","%s");</script>',$GLOBALS["strPassword"]);
$js2 = sprintf('<script language="Javascript" type="text/javascript">addFieldToCheck("password_check","%s");</script>',$GLOBALS["strPassword2"]);
$html .= '<input type=hidden name="passwordreq" value="1">';
} else {
$pwdclass = 'attributename';
$html .= '<input type=hidden name="passwordreq" value="0">';
}
$html .= sprintf('
<tr><td><div class="%s">%s</div></td>
<td class="attributeinput"><input type=password name=password value="" size="%d">%s</td></tr>',
$pwdclass,$GLOBALS["strPassword"],$textlinewidth,$js);
$html .= sprintf('
<tr><td><div class="%s">%s</div></td>
<td class="attributeinput"><input type=password name="password_check" value="" size="%d">%s</td></tr>',
$pwdclass,$GLOBALS["strPassword2"],$textlinewidth,$js2);
}
switch($htmlchoice) {
case "textonly":
$html .= sprintf('<input type=hidden name="htmlemail" value="0">');
break;
case "htmlonly":
$html .= sprintf('<input type=hidden name="htmlemail" value="1">');
break;
case "checkfortext":
$html .= sprintf('<tr><td colspan=2>
<span class="attributeinput">
<input type=checkbox name="textemail" value="1" %s></span>
<span class="attributename">%s</span>
</td></tr>',!$htmlemail,$strPreferTextEmail);
break;
case "radiotext":
if (!isset($htmlemail))
$htmlemail = 0;
$html .= sprintf('<tr><td colspan=2>
<span class="attributename">%s<br/>
<span class="attributeinput"><input type=radio name="htmlemail" value="0" %s></span>
<span class="attributename">%s</span>
<span class="attributeinput"><input type=radio name="htmlemail" value="1" %s></span>
<span class="attributename">%s</span></td></tr>',
$strPreferredFormat,
!$htmlemail ? "checked":"",$strText,
$htmlemail ? "checked":"",$strHTML);
break;
case "radiohtml":
if (!isset($htmlemail))
$htmlemail = 1;
$html .= sprintf('<tr><td colspan=2>
<span class="attributename">%s</span><br/>
<span class="attributeinput"><input type=radio name="htmlemail" value="0" %s></span>
<span class="attributename">%s</span>
//.........这里部分代码省略.........
示例5: addAttachments
function addAttachments($msgid, &$mail, $type)
{
global $attachment_repository, $website;
$hasError = false;
$totalSize = 0;
$memlimit = phpcfgsize2bytes(ini_get('memory_limit'));
if (ALLOW_ATTACHMENTS) {
$req = Sql_Query("select * from {$GLOBALS["tables"]["message_attachment"]},{$GLOBALS["tables"]["attachment"]}\n where {$GLOBALS["tables"]["message_attachment"]}.attachmentid = {$GLOBALS["tables"]["attachment"]}.id and\n {$GLOBALS["tables"]["message_attachment"]}.messageid = {$msgid}");
if (!Sql_Affected_Rows()) {
return true;
}
if ($type == "text") {
$mail->append_text($GLOBALS["strAttachmentIntro"] . "\n");
}
while ($att = Sql_Fetch_array($req)) {
$totalSize += $att['size'];
if ($memlimit > 0 && 3 * $totalSize > $memlimit) {
## the 3 is roughly the size increase to encode the string
# $_SESSION['action_result'] = s('Insufficient memory to add attachment');
logEvent(s("Insufficient memory to add attachment to campaign %d %d - %d", $msgid, $totalSize, $memlimit));
$hasError = true;
}
if (!$hasError) {
switch ($type) {
case "HTML":
if (is_file($GLOBALS["attachment_repository"] . "/" . $att["filename"]) && filesize($GLOBALS["attachment_repository"] . "/" . $att["filename"])) {
$fp = fopen($GLOBALS["attachment_repository"] . "/" . $att["filename"], "r");
if ($fp) {
$contents = fread($fp, filesize($GLOBALS["attachment_repository"] . "/" . $att["filename"]));
fclose($fp);
$mail->add_attachment($contents, basename($att["remotefile"]), $att["mimetype"]);
}
} elseif (is_file($att["remotefile"]) && filesize($att["remotefile"])) {
# handle local filesystem attachments
$fp = fopen($att["remotefile"], "r");
if ($fp) {
$contents = fread($fp, filesize($att["remotefile"]));
fclose($fp);
$mail->add_attachment($contents, basename($att["remotefile"]), $att["mimetype"]);
list($name, $ext) = explode(".", basename($att["remotefile"]));
# create a temporary file to make sure to use a unique file name to store with
$newfile = tempnam($GLOBALS["attachment_repository"], $name);
$newfile .= "." . $ext;
$newfile = basename($newfile);
$fd = fopen($GLOBALS["attachment_repository"] . "/" . $newfile, "w");
fwrite($fd, $contents);
fclose($fd);
# check that it was successful
if (filesize($GLOBALS["attachment_repository"] . "/" . $newfile)) {
Sql_Query(sprintf('update %s set filename = "%s" where id = %d', $GLOBALS["tables"]["attachment"], $newfile, $att["attachmentid"]));
} else {
# now this one could be sent many times, so send only once per run
if (!isset($GLOBALS[$att["remotefile"] . "_warned"])) {
logEvent("Unable to make a copy of attachment " . $att["remotefile"] . " in repository");
$msg = s("Error, when trying to send campaign %d the attachment (%s) could not be copied to the repository. Check for permissions.", $msgid, $att["remotefile"]);
sendMail(getConfig("report_address"), s("phpList system error"), $msg, "");
$GLOBALS[$att["remotefile"] . "_warned"] = time();
}
}
} else {
logEvent(s("failed to open attachment (%s) to add to campaign %d", $att["remotefile"], $msgid));
$hasError = true;
}
} else {
## as above, avoid sending it many times
if (!isset($GLOBALS[$att["remotefile"] . "_warned"])) {
logEvent(s("Attachment %s does not exist", $att["remotefile"]));
$msg = s("Error, when trying to send campaign %d the attachment (%s) could not be found in the repository", $msgid, $att["remotefile"]);
sendMail(getConfig("report_address"), s("phpList system error"), $msg, "");
$GLOBALS[$att["remotefile"] . "_warned"] = time();
}
$hasError = true;
}
break;
case "text":
$viewurl = $GLOBALS["public_scheme"] . "://" . $website . $GLOBALS["pageroot"] . '/dl.php?id=' . $att["id"];
$mail->append_text($att["description"] . "\n" . $GLOBALS["strLocation"] . ": " . $viewurl . "\n");
break;
}
}
}
}
## keep track of an error count, when sending the queue
if ($GLOBALS['counters']['add attachment error'] > 20) {
Sql_Query(sprintf('update %s set status = "suspended" where id = %d', $GLOBALS['tables']['message'], $msgid));
logEvent(s('Campaign %d suspended for too many errors with attachments', $msgid));
foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
$plugin->processError(s('Campaign %d suspended for too many errors with attachments', $msgid));
}
}
if ($hasError) {
$GLOBALS['counters']['add attachment error']++;
}
return !$hasError;
}
示例6: adminTasks
function adminTasks()
{
$tasks = array("home" => "Administer Mailinglists", "send" => "Send a message", "configure" => "Configure Mailinglists", "list" => "Lists", "messages" => "Messages", "reconcileusers" => "Reconcile", "export" => "Export Emails", "attributes" => "Attributes", "spage" => "Configure Subscribe Pages");
if ($this->tables["attribute"] && Sql_Table_Exists($this->tables["attribute"])) {
$res = Sql_Query("select * from {$this->tables['attribute']}", 1);
while ($row = Sql_Fetch_array($res)) {
if ($row["type"] != "checkbox" && $row["type"] != "textarea" && $row["type"] != "textline" && $row["type"] != "hidden") {
$tasks["editattributes&" . "id=" . $row["id"]] = '=> ' . strip_tags($row["name"]);
}
}
}
$tasks["templates"] = "Templates";
$tasks["send"] = "Send a message";
$tasks["bounces"] = "View Bounces";
$tasks["eventlog"] = "Eventlog";
return $tasks;
}
示例7: formStart
");
warned = 1;
}
</script>
<?php
echo formStart();
print $GLOBALS['I18N']->get('Load data from') . ' ' . PageLinkButton('defaults', $GLOBALS['I18N']->get('predefined defaults')) . '<br />';
$res = Sql_Query("select * from {$tables['attribute']} order by listorder");
if (Sql_Affected_Rows()) {
print '<p class="information">' . $GLOBALS['I18N']->get('Existing attributes') . ':</p>';
} else {
print '<p class="information">' . $GLOBALS['I18N']->get('No Attributes have been defined yet') . '</p>';
}
$c = 0;
print '<div class="accordion">';
while ($row = Sql_Fetch_array($res)) {
++$c;
print '<h3><a name="' . $row['id'] . '">' . $GLOBALS['I18N']->get('Attribute') . ': ' . $row['id'] . ' ' . htmlspecialchars(stripslashes(strip_tags($row['name'])));
if ($formtable_exists) {
sql_query('select * from formfield where attribute = ' . $row['id']);
print ' (' . $GLOBALS['I18N']->get('used in') . ' ' . Sql_affected_rows() . ' ' . $GLOBALS['I18N']->get('forms') . ')';
}
print '</a></h3><div><label>' . $GLOBALS['I18N']->get('Tag') . '
<input type="checkbox" name="tag[' . $c . ']" value="' . $row['id'] . '" /></label>';
print '<label>' . s('Name') . ':</label>
<input type="text" name="name[' . $row['id'] . ']" value="' . htmlspecialchars(stripslashes(strip_tags($row['name']))) . '" size="40" />';
print '<label>' . s('Type') . ': </label>
<!--<input type="hidden" name="type[' . $row['id'] . ']" value="' . $row['type'] . '">' . $row['type'] . '-->';
print '<select name="type[' . $row['id'] . ']" onchange="warn();">';
foreach ($types as $key => $val) {
printf('<option value="%s" %s>%s</option>', $val, $val == $row['type'] ? 'selected="selected"' : '', $GLOBALS['I18N']->get($val));
示例8: addAttachments
function addAttachments($msgid, &$mail, $type)
{
global $attachment_repository, $website;
if (ALLOW_ATTACHMENTS) {
$req = Sql_Query("select * from {$GLOBALS["tables"]["message_attachment"]},{$GLOBALS["tables"]["attachment"]}\n where {$GLOBALS["tables"]["message_attachment"]}.attachmentid = {$GLOBALS["tables"]["attachment"]}.id and\n {$GLOBALS["tables"]["message_attachment"]}.messageid = {$msgid}");
if (!Sql_Affected_Rows()) {
return;
}
if ($type == "text") {
$mail->append_text($GLOBALS["strAttachmentIntro"] . "\n");
}
while ($att = Sql_Fetch_array($req)) {
switch ($type) {
case "HTML":
if (is_file($GLOBALS["attachment_repository"] . "/" . $att["filename"]) && filesize($GLOBALS["attachment_repository"] . "/" . $att["filename"])) {
$fp = fopen($GLOBALS["attachment_repository"] . "/" . $att["filename"], "r");
if ($fp) {
$contents = fread($fp, filesize($GLOBALS["attachment_repository"] . "/" . $att["filename"]));
fclose($fp);
$mail->add_attachment($contents, basename($att["remotefile"]), $att["mimetype"]);
}
} elseif (is_file($att["remotefile"]) && filesize($att["remotefile"])) {
# handle local filesystem attachments
$fp = fopen($att["remotefile"], "r");
if ($fp) {
$contents = fread($fp, filesize($att["remotefile"]));
fclose($fp);
$mail->add_attachment($contents, basename($att["remotefile"]), $att["mimetype"]);
list($name, $ext) = explode(".", basename($att["remotefile"]));
# create a temporary file to make sure to use a unique file name to store with
$newfile = tempnam($GLOBALS["attachment_repository"], $name);
$newfile .= "." . $ext;
$newfile = basename($newfile);
$fd = fopen($GLOBALS["attachment_repository"] . "/" . $newfile, "w");
fwrite($fd, $contents);
fclose($fd);
# check that it was successful
if (filesize($GLOBALS["attachment_repository"] . "/" . $newfile)) {
Sql_Query(sprintf('update %s set filename = "%s" where id = %d', $GLOBALS["tables"]["attachment"], $newfile, $att["attachmentid"]));
} else {
# now this one could be sent many times, so send only once per run
if (!isset($GLOBALS[$att["remotefile"] . "_warned"])) {
logEvent("Unable to make a copy of attachment " . $att["remotefile"] . " in repository");
$msg = "Error, when trying to send message {$msgid} the filesystem attachment\n " . $att["remotefile"] . " could not be copied to the repository. Check for permissions.";
sendMail(getConfig("report_address"), "Mail list error", $msg, "");
$GLOBALS[$att["remotefile"] . "_warned"] = time();
}
}
} else {
logEvent("failed to open attachment " . $att["remotefile"] . " to add to message {$msgid} ");
}
} else {
logEvent("Attachment " . $att["remotefile"] . " does not exist");
$msg = "Error, when trying to send message {$msgid} the attachment\n " . $att["remotefile"] . " could not be found";
sendMail(getConfig("report_address"), "Mail list error", $msg, "");
}
break;
case "text":
$viewurl = $GLOBALS["scheme"] . "://" . $website . $GLOBALS["pageroot"] . '/dl.php?id=' . $att["id"];
$mail->append_text($att["description"] . "\n" . $GLOBALS["strLocation"] . ": " . $viewurl);
break;
}
}
}
}
示例9: ListAttributes2011
function ListAttributes2011($attributes, $attributedata, $htmlchoice = 0, $userid = 0, $emaildoubleentry = 'no')
{
global $strPreferHTMLEmail, $strPreferTextEmail, $strEmail, $tables, $table_prefix, $strPreferredFormat, $strText, $strHTML;
if ($userid) {
$data = array();
$current = Sql_Fetch_array_Query("select * from {$GLOBALS["tables"]["user"]} where id = {$userid}");
$datareq = Sql_Query("select * from {$GLOBALS["tables"]["user_attribute"]} where userid = {$userid}");
while ($row = Sql_Fetch_Array($datareq)) {
$data[$row["attributeid"]] = $row["value"];
}
$email = $current["email"];
$htmlemail = $current["htmlemail"];
# override with posted info
foreach ($current as $key => $val) {
if (isset($_POST[$key]) && $key != "password") {
$current[$key] = $val;
}
}
} else {
if (isset($_REQUEST['email'])) {
$email = stripslashes($_REQUEST["email"]);
} else {
$email = '';
}
if (isset($_POST['htmlemail'])) {
$htmlemail = $_POST["htmlemail"];
}
$data = array();
$current = array();
}
$textlinewidth = sprintf('%d', getConfig("textline_width"));
if (!$textlinewidth) {
$textlinewidth = 40;
}
list($textarearows, $textareacols) = explode(",", getConfig("textarea_dimensions"));
if (!$textarearows) {
$textarearows = 10;
}
if (!$textareacols) {
$textareacols = 40;
}
$html = '';
$html .= '<fieldset class="subscriberdetails">';
$html .= sprintf('<div class="required"><label for="email">%s</label>
<input type="text" name="email" value="%s" class="input email required" />', $GLOBALS["strEmail"], htmlspecialchars($email));
if ($emaildoubleentry == 'yes') {
if (!isset($_REQUEST['emailconfirm'])) {
$_REQUEST['emailconfirm'] = '';
}
$html .= sprintf('<label for="emailconfirm">%s</label>
<input type="text" name="emailconfirm" value="%s" class="input emailconfirm required" />', $GLOBALS["strConfirmEmail"], htmlspecialchars(stripslashes($_REQUEST["emailconfirm"])), $GLOBALS["strConfirmEmail"]);
}
if (ASKFORPASSWORD) {
# we only require a password if there isnt one, so they can set it
# otherwise they can keep the existing, if they do not enter anything
if (!isset($current['password']) || !$current["password"]) {
$pwdclass = "required";
# $html .= '<input type="hidden" name="passwordreq" value="1" />';
} else {
$pwdclass = 'attributename';
# $html .= '<input type="hidden" name="passwordreq" value="0" />';
}
$html .= sprintf('
<label for="password">%s</label><input type="password" name="password" value="" class="input password required" />', $GLOBALS["strPassword"]);
$html .= sprintf('
<label for="password_check">%s</label><input type="password" name="password_check" value="" class="input password required" />', $GLOBALS["strPassword2"]);
}
$html .= '</div>';
## class=required
$htmlchoice = 'checkforhtml';
## Write attribute fields
switch ($htmlchoice) {
case "textonly":
if (!isset($htmlemail)) {
$htmlemail = 0;
}
$html .= sprintf('<input type="hidden" name="htmlemail" value="0" />');
break;
case "htmlonly":
if (!isset($htmlemail)) {
$htmlemail = 1;
}
$html .= sprintf('<input type="hidden" name="htmlemail" value="1" />');
break;
case "checkfortext":
if (!isset($htmlemail)) {
$htmlemail = 0;
}
$html .= sprintf('<fieldset class="htmlchoice"><div><input type="checkbox" name="textemail" value="1" %s /><label for="textemail">%s</label></div></fieldset>', empty($htmlemail) ? 'checked="checked"' : '', $GLOBALS["strPreferTextEmail"]);
break;
case "radiotext":
if (!isset($htmlemail)) {
$htmlemail = 0;
}
case "radiohtml":
if (!isset($htmlemail)) {
$htmlemail = 1;
}
$html .= sprintf('<fieldset class="htmlchoice">
<legend>%s</legend>
//.........这里部分代码省略.........
示例10: sendMessageTab
function sendMessageTab($messageid = 0, $data = array())
{
global $tables, $table_prefix;
if (!$this->enabled) {
return null;
}
$criteria_content = s('<p><b>Select the criteria for this campaign:</b></p>
<ol>
<li>To use a criterion, check the box "use this one" next to it</li>
<li>Then check the radio button next to the attribute you want to use</li>
<li>Finally choose the values of the attributes you want to send the campaign to
<i>Note:</i> Messages will be sent to people who fit to <i>Criteria 1</i> <b>AND</b> <i>Criteria 2</i> etc </li>
</ol>') . '
<div class="accordion">
';
$any = 0;
for ($i = 1; $i <= $this->numcriterias; $i++) {
$criteria_content .= sprintf('<h3><a name="attr%d">%s %d</a></h3><div><table>
', $i, s('Criterion'), $i);
$attributes_request = Sql_Query("select * from " . $tables['attribute']);
$criteria_content .= sprintf('<tr><td colspan="3"><span class="fright">%s <input type="checkbox" name="criteria_use[%d]" %s /></span></td></tr>', s('Use this one'), $i, isset($data['criteria_use'][$i]) ? 'checked="checked"' : '');
while ($attribute = Sql_Fetch_array($attributes_request)) {
$criteria_content .= "\n\n";
$attr_type = sprintf('<input type="hidden" name="attrtype[%d]" value="%s" />', $attribute["id"], $attribute["type"]);
switch ($attribute["type"]) {
case "checkbox":
$any = 1;
if (!isset($data['attr_value' . $attribute["id"] . $i])) {
$data['attr_value' . $attribute["id"] . $i] = 0;
}
$criteria_content .= sprintf('<tr><td>%s<input type="radio" name="criteria[%d]" value="%d" %s />
%s</td><td><b>%s</b></td><td><select name="attr_value%d%d">
<option value="0" %s>' . s('Not checked') . '</option>
<option value="1" %s>' . s('Checked') . '</option></select></td></tr>', $attr_type, $i, $attribute["id"], isset($data['criteria'][$i]) && $data['criteria'][$i] == $attribute['id'] ? 'checked="checked"' : '', strip_tags($attribute["name"]), s('is'), $attribute["id"], $i, $data['attr_value' . $attribute["id"] . $i] == "0" ? 'selected="selected"' : '', $data['attr_value' . $attribute["id"] . $i] == "1" ? 'selected="selected"' : '');
break;
case "select":
case "radio":
case "checkboxgroup":
$some = 0;
$thisone = "";
$values_request = Sql_Query("select * from {$table_prefix}" . "listattr_" . $attribute["tablename"]);
$thisone .= sprintf('<tr><td>%s <input type="radio" name="criteria[%d]" value="%d" %s /> %s</td>
<td><b>%s</b></td><td><select name="attr_value%d%d[]" size="4" multiple="multiple" />', $attr_type, $i, $attribute["id"], isset($data['criteria'][$i]) && $data['criteria'][$i] == $attribute['id'] ? 'checked="checked"' : '', strip_tags($attribute["name"]), s('is'), $attribute["id"], $i);
if (isset($data['attr_value' . $attribute["id"] . $i])) {
$selected_values = $data['attr_value' . $attribute["id"] . $i];
} else {
$selected_values = array();
}
while ($value = Sql_Fetch_array($values_request)) {
$some = 1;
$thisone .= sprintf('<option value="%d" %s>%s</option>', $value["id"], in_array($value['id'], $selected_values) ? 'selected="selected"' : '', strip_tags($value["name"]));
}
$thisone .= "</select></td></tr>";
if ($some) {
$criteria_content .= $thisone;
}
$any = $any || $some;
break;
default:
$criteria_content .= "\n<!-- error: huh, unknown type " . $attribute["type"] . " -->\n";
}
}
$criteria_content .= '</table></div>';
}
if (!$any) {
$criteria_content = "<p>" . $GLOBALS['I18N']->get('There are currently no attributes available to use for sending. The campaign will go to any subscriber on the lists selected') . "</p>";
# } else {
# $criteria_content .= '</table>';
}
return $criteria_content . '</div><!-- close accordion -->';
}
示例11: giveAlternative
function giveAlternative($table, $delete, $attributeid)
{
print $GLOBALS['I18N']->get('ReplaceAllWith') . formStart();
print '<select name=replace><option value="0">-- ' . $GLOBALS['I18N']->get('ReplaceWith') . '</option>';
$req = Sql_Query("select * from {$table} order by listorder,name");
while ($row = Sql_Fetch_array($req)) {
if ($row["id"] != $delete) {
printf('<option value="%d">%s</option>', $row["id"], $row["name"]);
}
}
print "</select>";
printf('<input type=hidden name="delete" value="%d">', $delete);
printf('<input type=hidden name="id" value="%d">', $attributeid);
printf('<input type=submit name="deleteandreplace" value="%s"></form>', $GLOBALS['I18N']->get('deleteandreplace'));
}
示例12: giveAlternative
function giveAlternative($table, $delete, $attributeid)
{
print $GLOBALS['I18N']->get('Alternatively you can replace all values with another one:') . formStart(' class="editattributesAlternatives" ');
print '<select name="replace"><option value="0">-- ' . $GLOBALS['I18N']->get('Replace with') . '</option>';
$req = Sql_Query("select * from {$table} order by listorder,name");
while ($row = Sql_Fetch_array($req)) {
if ($row["id"] != $delete) {
printf('<option value="%d">%s</option>', $row["id"], $row["name"]);
}
}
print "</select>";
printf('<input type="hidden" name="delete" value="%d" />', $delete);
printf('<input type="hidden" name="id" value="%d" />', $attributeid);
printf('<input class="submit" type="submit" name="deleteandreplace" value="%s" /><hr class="line" />', $GLOBALS['I18N']->get('Delete and replace'));
}
示例13: switch
switch ($attribute["type"]) {
case "checkbox":
$any = 1;
$html .= sprintf ('<tr><td><input type="radio" name="criteria[%d]" value="%d"> %s</td><td><b>IS</b></td><td><select name="attr%d%d[]">
<option value="0">Not checked
<option value="1">Checked</select></td></tr>',$i,$attribute["id"],$attribute["name"],$attribute["id"],$i);
break;
case "select":
case "radio":
case "checkboxgroup":
$some = 0;
$thisone = "";
$values_request = Sql_Query("select * from $table_prefix"."listattr_".$attribute["tablename"]);
$thisone .= sprintf ('<tr><td valign=top><input type="radio" name="criteria[%d]" value="%d"> %s</td>
<td valign=top><b>IS</b></td><td><select name="attr%d%d[]" size=4 multiple>',$i,$attribute["id"],strip_tags($attribute["name"]),$attribute["id"],$i);
while ($value = Sql_Fetch_array($values_request)) {
$some =1;
$thisone .= sprintf ('<option value="%d">%s',$value["id"],$value["name"]);
}
$thisone .= "</select></td></tr>";
if ($some)
$html .= $thisone;
$any = $any || $some;
break;
default:
$html .= "\n<!-- error: huh, unknown type ".$attribute["type"]." -->\n";
}
}
}
if ($any)
示例14: dirname
require_once dirname(__FILE__) . '/admin/connect.php';
include_once dirname(__FILE__) . "/admin/lib.php";
$id = sprintf('%s', $_GET['id']);
if ($id != $_GET['id']) {
print "Invalid Request";
exit;
}
$track = base64_decode($id);
$track = $track ^ XORmask;
@(list($msgtype, $fwdid, $messageid, $userid) = explode('|', $track));
$userid = sprintf('%d', $userid);
$fwdid = sprintf('%d', $fwdid);
$messageid = sprintf('%d', $messageid);
$query = sprintf('select * from %s where id = ?', $GLOBALS['tables']['linktrack_forward']);
$rs = Sql_Query_Params($query, array($fwdid));
$linkdata = Sql_Fetch_array($rs);
if (!$fwdid || $linkdata['id'] != $fwdid || !$userid || !$messageid) {
## try the old table to avoid breaking links
$linkdata = Sql_Fetch_array_query(sprintf('select * from %s where linkid = %d and userid = %d and messageid = %d', $GLOBALS['tables']['linktrack'], $fwdid, $userid, $messageid));
if (!empty($linkdata['forward'])) {
## we're not recording clicks, but at least links in older newsletters won't break.
header("Location: " . $linkdata['forward']);
exit;
}
# echo 'Invalid Request';
# maybe some logging?
FileNotFound();
exit;
}
## hmm a bit heavy to use here @@@optimise
$messagedata = loadMessageData($messageid);
示例15: Menu
function Menu() {
global $pixel,$tables;
$html = "";
if ($GLOBALS["require_login"])
$html .= PageLink2("logout","Logout").' <br /><br />';
$html .= PageLink2("home","Main Page")." <br />";
$html .= PageLink2("configure","Configure")." <br />";
$html .= ' =====<br />';
$html .= PageLink2("list","Lists").' <br />';
$html .= PageLink2("users","Users").' <br />';
$html .= PageLink2("messages","Messages").' <br />';
$html .= PageLink2("import","Import Emails").' <br />';
$html .= ' =====<br />';
$url = getConfig("subscribeurl");
if ($url)
$html .= '<a href="'.$url.'">Subscribe</a> <br/>';
else
$html .= '<a href="../?p=subscribe">Signup</a> <br/>';
$url = getConfig("unsubscribeurl");
if ($url)
$html .= '<a href="'.$url.'">Unsubscribe</a> <br/>';
else
$html .= '<a href="../?p=unsubscribe">Sign Off</a> <br/>';
$html .= ' =====<br />';
$html .= PageLink2("attributes","Attributes").' <br />';
if ($tables["attribute"] && Sql_Table_Exists($tables["attribute"])) {
$res = Sql_Query("select * from {$tables['attribute']}",1);
while ($row = Sql_Fetch_array($res)) {
if ($row["type"] != "checkbox" && $row["type"] != "textline" && $row["type"] != "hidden")
$html .= PageLink2("editattributes",$row["name"],"id=".$row["id"]) ." <br />";
}
}
$html .= ' =====<br />';
$html .= PageLink2("messages","All Messages").' <br />';
$html .= PageLink2("templates","Templates").' <br />';
$html .= PageLink2("send","Send a message").' <br />';
$html .= PageLink2("preparesend","Prepare a message").' <br />';
$html .= PageLink2("sendprepared","Send a message").' <br />';
$html .= ' =====<br />';
$html .= PageLink2("processqueue","Process Queue").' <br />';
return $html . $pixel;
}