示例#1
0
 # 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
0
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
0
    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
0
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>
        <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 "checkforhtml":
    default:
      $html .= sprintf('<tr><td colspan=2>
      	<span class="attributeinput"><input type=checkbox name="htmlemail" value="1" %s></span>
        <span class="attributename">%s</span></td></tr>',$htmlemail ? "checked":"",$strPreferHTMLEmail);
      break;
	}
  $html .= "\n";

  $attids = join(',',array_keys($attributes));
  if ($attids) {
    $res = Sql_Query("select * from {$tables["attribute"]} where id in ($attids)");
    while ($attr = Sql_Fetch_Array($res)) {
      $attr["required"] = $attributedata[$attr["id"]]["required"];
      $attr["default_value"] = $attributedata[$attr["id"]]["default_value"];
      if ($attr["tablename"] != "")
        $fieldname = $attr["tablename"];
      else
        $fieldname = "attribute" .$attr["id"];
  #  print "<tr><td>".$attr["id"]."</td></tr>";
      if ($userid && !isset($_POST[$fieldname])) {
        # post values take precedence
        $val = Sql_Fetch_Row_Query(sprintf('select value from %s where
          attributeid = %d and userid = %d',$tables["user_attribute"],$attr["id"],$userid));
        $_POST[$postvalue] = $val[0];
      }
      switch ($attr["type"]) {
        case "checkbox":
          $output[$attr["id"]] = '<tr><td colspan=2>';
          # what they post takes precedence over the database information
          if ($_POST[$fieldname])
            $checked = $_POST[$fieldname] ? "checked":"";
          else
            $checked = $data[$attr["id"]] ? "checked":"";
          $output[$attr["id"]] .= sprintf("\n".'<input type="checkbox" name="%s" value="on" %s class="attributeinput">',$fieldname,$checked);
          $output[$attr["id"]] .= sprintf("\n".'<span class="%s">%s</span>',$attr["required"] ? 'required' : 'attributename',stripslashes($attr["name"]));
          break;
        case "radio":
          $output[$attr["id"]] .= sprintf("\n".'<tr><td colspan=2><div class="%s">%s</div>',$attr["required"] ? 'required' : 'attributename',stripslashes($attr["name"]));
          $values_request = Sql_Query("select * from $table_prefix"."listattr_".$attr["tablename"]." order by listorder,name");
          while ($value = Sql_Fetch_array($values_request)) {
            if (isset($_POST[$fieldname]))
              $checked = $_POST[$fieldname] == $value["id"] ? "checked":"";
            else if (isset($data[$attr["id"]]))
              $checked = $data[$attr["id"]] == $value["id"] ? "checked":"";
            else
              $checked = $attr["default_value"] == $value["name"] ? "checked":"";
            $output[$attr["id"]] .= sprintf('&nbsp;%s&nbsp;<input type=radio  class="attributeinput" name="%s" value="%s" %s>',
              $value["name"],$fieldname,$value["id"],$checked);
          }
          break;
        case "select":
          $output[$attr["id"]] .= sprintf("\n".'<tr><td><div class="%s">%s</div>',$attr["required"] ? 'required' : 'attributename',stripslashes($attr["name"]));
          $values_request = Sql_Query("select * from $table_prefix"."listattr_".$attr["tablename"]." order by listorder,name");
          $output[$attr["id"]] .= sprintf('</td><td class="attributeinput"><!--%d--><select name="%s" class="attributeinput">',$data[$attr["id"]],$fieldname);
          while ($value = Sql_Fetch_array($values_request)) {
            if (isset($_POST[$fieldname]))
              $selected = $_POST[$fieldname] == $value["id"] ? "selected" : "";
            else if (isset($data[$attr["id"]]))
              $selected = $data[$attr["id"]] == $value["id"] ? "selected":"";
            else
              $selected = $attr["default_value"] == $value["name"] ? "selected":"";
            $output[$attr["id"]] .= sprintf('<option value="%s" %s>%s',$value["id"],$selected,stripslashes($value["name"]));
          }
          $output[$attr["id"]] .= "</select>";
          break;
        case "checkboxgroup":
          $output[$attr["id"]] .= sprintf("\n".'<tr><td colspan=2><div class="%s">%s</div>',$attr["required"] ? 'required' : 'attributename',stripslashes($attr["name"]));
          $values_request = Sql_Query("select * from $table_prefix"."listattr_".$attr["tablename"]." order by listorder,name");
          $output[$attr["id"]] .= sprintf('</td></tr>');
          while ($value = Sql_Fetch_array($values_request)) {
            if (isset($_POST[$fieldname]))
              $selected = in_array($value["id"],$_POST[$fieldname]) ? "checked" : "";
            else if (isset($data[$attr["id"]])) {
              $selection = explode(",",$data[$attr["id"]]);
              $selected = in_array($value["id"],$selection) ? "checked":"";
            }
            $output[$attr["id"]] .= sprintf('<tr><td colspan=2 class="attributeinput"><input type=checkbox name="%s[]"  class="attributeinput" value="%s" %s> %s</td></tr>',$fieldname,$value["id"],$selected,stripslashes($value["name"]));
          }
          break;
        case "textline":
          $output[$attr["id"]] .= sprintf("\n".'<tr><td><div class="%s">%s</div>',$attr["required"] ? 'required' : 'attributename',$attr["name"]);
          $output[$attr["id"]] .= sprintf ('</td><td class="attributeinput">
            <input type=text name="%s"  class="attributeinput" size="%d" value="%s">',$fieldname,
            $textlinewidth,
            $_POST[$fieldname] ? htmlspecialchars(stripslashes($_POST[$fieldname])) : ($data[$attr["id"]] ? $data[$attr["id"]] : $attr["default_value"]));
          if ($attr["required"])
            $output[$attr["id"]] .= sprintf('<script language="Javascript" type="text/javascript">addFieldToCheck("%s","%s");</script>',$fieldname,$attr["name"]);
          break;
        case "textarea":
          $output[$attr["id"]] .= sprintf("\n".'<tr><td colspan=2>
            <div class="%s">%s</div></td></tr>',$attr["required"] ? 'required' : 'attributename',
            $attr["name"]);
          $output[$attr["id"]] .= sprintf ('<tr><td class="attributeinput" colspan=2>
            <textarea name="%s" rows="%d"  class="attributeinput" cols="%d" wrap="virtual">%s</textarea>',
            $fieldname,$textarearows,$textareacols,
            $_POST[$fieldname] ? htmlspecialchars(stripslashes($_POST[$fieldname])) : ($data[$attr["id"]] ? $data[$attr["id"]] : $attr["default_value"]));
          if ($attr["required"])
            $output[$attr["id"]] .= sprintf('<script language="Javascript" type="text/javascript">addFieldToCheck("%s","%s");</script>',$fieldname,$attr["name"]);
          break;
        case "hidden":
          $output[$attr["id"]] .= sprintf('<input type=hidden name="%s" size=40 value="%s">',$fieldname,$data[$attr["id"]] ? $data[$attr["id"]] : $attr["default_value"]);
          break;
        default:
          print "<!-- error: huh, invalid attribute type -->";
      }
      $output[$attr["id"]] .= "</td></tr>\n";
    }
  }

  # make sure the order is correct
	foreach ($attributes as $attribute => $listorder) {
  	$html .= $output[$attribute];
 	}
  return $html;
}
示例#5
0
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
0
 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"]] = '=&gt; ' . strip_tags($row["name"]);
             }
         }
     }
     $tasks["templates"] = "Templates";
     $tasks["send"] = "Send a message";
     $tasks["bounces"] = "View Bounces";
     $tasks["eventlog"] = "Eventlog";
     return $tasks;
 }
示例#7
0
");
  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
0
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
0
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>
        <div><input type="radio" id="choicetext" name="htmlemail" value="0" %s /><label for="choicetext" class="htmlchoice">%s</label></div>
        <div><input type="radio" id="choicehtml" name="htmlemail" value="1" %s /><label for="choicehtml" class="htmlchoice">%s</label></div>
        </fieldset>', $GLOBALS["strPreferredFormat"], empty($htmlemail) ? 'checked="checked"' : '', $GLOBALS["strText"], !empty($htmlemail) ? 'checked="checked"' : '', $GLOBALS["strHTML"]);
            break;
        case "checkforhtml":
        default:
            if (!isset($htmlemail)) {
                $htmlemail = 0;
            }
            $html .= sprintf('<fieldset class="htmlchoice"><div><input type="checkbox" name="htmlemail" value="1" %s />
        <label for="htmlemail">%s</label></div></fieldset>', !empty($htmlemail) ? 'checked="checked"' : '', $GLOBALS["strPreferHTMLEmail"]);
            break;
    }
    $html .= "</fieldset>\n";
    $html .= '<fieldset class="attributes">' . "\n";
    $attids = join(',', array_keys($attributes));
    $output = array();
    if ($attids) {
        $res = Sql_Query("select * from {$GLOBALS["tables"]["attribute"]} where id in ({$attids})");
        while ($attr = Sql_Fetch_Array($res)) {
            $output[$attr["id"]] = '';
            if (!isset($data[$attr['id']])) {
                $data[$attr['id']] = '';
            }
            $attr["required"] = $attributedata[$attr["id"]]["required"];
            $attr["default_value"] = $attributedata[$attr["id"]]["default_value"];
            $fieldname = "attribute" . $attr["id"];
            #  print "<tr><td>".$attr["id"]."</td></tr>";
            if ($userid && !isset($_POST[$fieldname])) {
                # post values take precedence
                $val = Sql_Fetch_Row_Query(sprintf('select value from %s where
          attributeid = %d and userid = %d', $GLOBALS["tables"]["user_attribute"], $attr["id"], $userid));
                $_POST[$fieldname] = $val[0];
            } elseif (!isset($_POST[$fieldname])) {
                $_POST[$fieldname] = 0;
            }
            switch ($attr["type"]) {
                case "checkbox":
                    $output[$attr["id"]] = '';
                    # what they post takes precedence over the database information
                    if (isset($_POST[$fieldname])) {
                        $checked = !empty($_POST[$fieldname]) ? 'checked="checked"' : '';
                    } else {
                        $checked = !empty($data[$attr["id"]]) ? 'checked="checked"' : '';
                    }
                    $output[$attr["id"]] .= sprintf("\n" . '<input type="checkbox" name="%s" value="on" %s class="input%s" />', $fieldname, $checked, $attr["required"] ? ' required' : '');
                    $output[$attr["id"]] .= sprintf("\n" . '<label for="%s" class="%s">%s</label>', $fieldname, $attr["required"] ? 'required' : '', stripslashes($attr["name"]));
                    break;
                case "radio":
                    $output[$attr["id"]] .= sprintf("\n" . '<fieldset class="radiogroup %s"><legend>%s</legend>', $attr["required"] ? 'required' : '', stripslashes($attr["name"]));
                    $values_request = Sql_Query("select * from {$table_prefix}" . "listattr_" . $attr["tablename"] . " order by listorder,name");
                    while ($value = Sql_Fetch_array($values_request)) {
                        if (!empty($_POST[$fieldname])) {
                            $checked = $_POST[$fieldname] == $value["id"] ? 'checked="checked"' : '';
                        } else {
                            if ($data[$attr["id"]]) {
                                $checked = $data[$attr["id"]] == $value["id"] ? 'checked="checked"' : '';
                            } else {
                                $checked = $attr["default_value"] == $value["name"] ? 'checked="checked"' : '';
                            }
                        }
                        $output[$attr["id"]] .= sprintf('<input type="radio" class="input%s" name="%s" value="%s" %s /><label for="%s">%s</label>', $attr["required"] ? ' required' : '', $fieldname, $value["id"], $checked, $fieldname, $value["name"]);
                    }
                    $output[$attr["id"]] . '</fieldset>';
                    break;
                case "select":
                    $output[$attr["id"]] .= sprintf("\n" . '<fieldset class="selectgroup %s"><label for="%s">%s</label>', $attr["required"] ? 'required' : '', $fieldname, stripslashes($attr["name"]));
                    $values_request = Sql_Query("select * from {$table_prefix}" . "listattr_" . $attr["tablename"] . " order by listorder,name");
                    $output[$attr["id"]] .= sprintf('<select name="%s" class="input%s">', $fieldname, $attr["required"] ? 'required' : '');
                    while ($value = Sql_Fetch_array($values_request)) {
                        if (!empty($_POST[$fieldname])) {
                            $selected = $_POST[$fieldname] == $value["id"] ? 'selected="selected"' : '';
                        } elseif ($data[$attr["id"]]) {
                            $selected = $data[$attr["id"]] == $value["id"] ? 'selected="selected"' : '';
                        } else {
                            $selected = $attr["default_value"] == $value["name"] ? 'selected="selected"' : '';
                        }
                        if (preg_match('/^' . preg_quote(EMPTY_VALUE_PREFIX) . '/i', $value['name'])) {
                            $value['id'] = '';
                        }
                        $output[$attr["id"]] .= sprintf('<option value="%s" %s>%s</option>', $value["id"], $selected, stripslashes($value["name"]));
                    }
                    $output[$attr["id"]] .= "</select>";
                    $output[$attr["id"]] .= "</fieldset>";
                    break;
                case "checkboxgroup":
                    $output[$attr["id"]] .= sprintf("\n" . '<fieldset class="checkboxgroup %s"><label for="%s">%s</label>', $attr["required"] ? 'required' : '', $fieldname, stripslashes($attr["name"]));
                    $values_request = Sql_Query("select * from {$table_prefix}" . "listattr_" . $attr["tablename"] . " order by listorder,name");
                    $cbCounter = 0;
                    while ($value = Sql_Fetch_array($values_request)) {
                        $cbCounter++;
                        $selected = '';
                        if (is_array($_POST[$fieldname])) {
                            $selected = in_array($value["id"], $_POST[$fieldname]) ? 'checked="checked"' : '';
                        } elseif ($data[$attr["id"]]) {
                            $selection = explode(",", $data[$attr["id"]]);
                            $selected = in_array($value["id"], $selection) ? 'checked="checked"' : '';
                        }
                        $output[$attr["id"]] .= sprintf('<input type="checkbox" name="%s[]" id="%s%d" class="input%s" value="%s" %s /><label for="%s%d">%s</label>', $fieldname, $fieldname, $cbCounter, $attr["required"] ? ' required' : '', $value["id"], $selected, $fieldname, $cbCounter, stripslashes($value["name"]));
                    }
                    $output[$attr["id"]] .= '</fieldset>';
                    break;
                case "textline":
                    $output[$attr["id"]] .= sprintf("\n" . '<label for="%s" class="input %s">%s</label>', $fieldname, $attr["required"] ? ' required' : '', $attr["name"]);
                    $output[$attr["id"]] .= sprintf('<input type="text" name="%s" class="input%s" value="%s" />', $fieldname, $attr["required"] ? ' required' : '', isset($_POST[$fieldname]) ? htmlspecialchars(stripslashes($_POST[$fieldname])) : (isset($data[$attr["id"]]) ? $data[$attr["id"]] : $attr["default_value"]));
                    break;
                case "textarea":
                    $output[$attr["id"]] .= sprintf("\n" . '<label for="%s" class="input %s">%s</label>', $fieldname, $attr["required"] ? ' required' : '', $attr["name"]);
                    $output[$attr["id"]] .= sprintf('<textarea name="%s" rows="%d" cols="%d" class="input%s" wrap="virtual">%s</textarea>', $fieldname, $textarearows, $textareacols, $attr["required"] ? ' required' : '', isset($_POST[$fieldname]) ? htmlspecialchars(stripslashes($_POST[$fieldname])) : (isset($data[$attr["id"]]) ? htmlspecialchars(stripslashes($data[$attr["id"]])) : $attr["default_value"]));
                    break;
                case "hidden":
                    $output[$attr["id"]] .= sprintf('<input type="hidden" name="%s" value="%s" />', $fieldname, $data[$attr["id"]] ? $data[$attr["id"]] : $attr["default_value"]);
                    break;
                case "date":
                    require_once dirname(__FILE__) . "/date.php";
                    $date = new Date();
                    $postval = $date->getDate($fieldname);
                    if ($data[$attr["id"]]) {
                        $val = $data[$attr["id"]];
                    } else {
                        $val = $postval;
                    }
                    $output[$attr["id"]] = sprintf("\n" . '<fieldset class="date%s"><label for="%s">%s</label>', $attr["required"] ? ' required' : '', $fieldname, $attr["name"]);
                    $output[$attr["id"]] .= sprintf('%s', $date->showInput($fieldname, "", $val));
                    $output[$attr["id"]] .= '</fieldset>';
                    break;
                default:
                    print "<!-- error: huh, invalid attribute type -->";
            }
            $output[$attr["id"]] .= "\n";
        }
    }
    # make sure the order is correct
    foreach ($attributes as $attribute => $listorder) {
        if (isset($output[$attribute])) {
            $html .= $output[$attribute];
        }
    }
    $html .= '</fieldset>' . "\n";
    ## class=attributes
    #  print htmlspecialchars( '<fieldset class="phplist">'.$html.'</fieldset>');exit;
    return $html;
}
 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 -->';
 }
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
0
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
0
    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
0
文件: lt.php 项目: juvenal/PHPlist
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
0
function Menu() {
  global $pixel,$tables;
  $html = "";
  if ($GLOBALS["require_login"])
    $html .= PageLink2("logout","Logout").'&nbsp;<br /><br />';
  $html .= PageLink2("home","Main Page")."&nbsp;<br />";
  $html .= PageLink2("configure","Configure")."&nbsp;<br />";
  $html .= '&nbsp;=====<br />';
  $html .= PageLink2("list","Lists").'&nbsp;<br />';
  $html .= PageLink2("users","Users").'&nbsp;<br />';
  $html .= PageLink2("messages","Messages").'&nbsp;<br />';
  $html .= PageLink2("import","Import Emails").'&nbsp;<br />';
  $html .= '&nbsp;=====<br />';
	$url = getConfig("subscribeurl");
	if ($url)
		$html .= '<a href="'.$url.'">Subscribe</a>&nbsp;<br/>';
	else
	  $html .= '<a href="../?p=subscribe">Signup</a>&nbsp;<br/>';
	$url = getConfig("unsubscribeurl");
	if ($url)
		$html .= '<a href="'.$url.'">Unsubscribe</a>&nbsp;<br/>';
	else
	  $html .= '<a href="../?p=unsubscribe">Sign Off</a>&nbsp;<br/>';

  $html .= '&nbsp;=====<br />';
  $html .= PageLink2("attributes","Attributes").'&nbsp;<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"]) ."&nbsp;<br />";
    }
  }
  $html .= '&nbsp;=====<br />';
  $html .= PageLink2("messages","All Messages").'&nbsp;<br />';
  $html .= PageLink2("templates","Templates").'&nbsp;<br />';
  $html .= PageLink2("send","Send a message").'&nbsp;<br />';
  $html .= PageLink2("preparesend","Prepare a message").'&nbsp;<br />';
  $html .= PageLink2("sendprepared","Send a message").'&nbsp;<br />';
  $html .= '&nbsp;=====<br />';
  $html .= PageLink2("processqueue","Process Queue").'&nbsp;<br />';
  return $html . $pixel;
}
示例#16
0
function newMenu()
{
    if ($GLOBALS["firsttime"]) {
        return;
    }
    $access = accessLevel("spage");
    switch ($access) {
        case "owner":
            $subselect = sprintf(' where owner = %d', $_SESSION["logindetails"]["id"]);
            break;
        case "all":
        case "view":
            $subselect = "";
            break;
        case "none":
        default:
            $subselect = " where id = 0";
            break;
    }
    if (TEST && REGISTER) {
        $pixel = '<img src="http://phplist.tincan.co.uk/images/pixel.gif" width=1 height=1>';
    }
    global $tables;
    $html = "";
    $spb = '<span class="menulinkleft">';
    $spe = '</span>';
    if ($GLOBALS["require_login"]) {
        $html .= $spb . PageLink2("logout", "Logout") . '<br />' . $spe;
    }
    $_GET["pi"] = "";
    $html .= $spb . PageLink2("home", "Main Page") . $spe;
    $req = Sql_Query(sprintf('select * from %s %s', $tables["subscribepage"], $subselect));
    $spages = array();
    if (Sql_Affected_Rows()) {
        $spages["div1"] = $GLOBALS["strSubscribeTitle"];
        while ($row = Sql_Fetch_Array($req)) {
            $spages[sprintf('%s&id=%d', getConfig("subscribeurl"), $row["id"])] = $row["title"];
        }
        $url = getConfig("unsubscribeurl");
        if ($url) {
            $spages[$url] = 'Unsubscribe';
        }
    } else {
        #	  $html .= $spb.sprintf('<a href="%s">%s</a>',getConfig("subscribeurl"),$GLOBALS["strSubscribeTitle"]).$spe;
        $spages["spage"] = "Create Subscribe Pages";
    }
    if ($tables["attribute"] && Sql_Table_Exists($tables["attribute"])) {
        $attrmenu = array();
        $res = Sql_Query("select * from {$tables['attribute']}", 1);
        while ($row = Sql_Fetch_array($res)) {
            if ($row["type"] != "checkbox" && $row["type"] != "textarea" && $row["type"] != "textline" && $row["type"] != "hidden") {
                $attrmenu["editattributes&id=" . $row["id"]] = strip_tags($row["name"]);
            }
        }
    }
    foreach ($GLOBALS["main_menu"] as $page => $desc) {
        $link = PageLink2($page, $desc);
        if ($link) {
            if ($page == "preparesend" || $page == "sendprepared") {
                if (USE_PREPARE) {
                    $html .= $spb . $link . $spe;
                }
            } else {
                $html .= $spb . $link . $spe;
            }
        }
    }
    if (sizeof($GLOBALS["plugins"])) {
        $html .= $spb . "<hr/>" . $spe;
        foreach ($GLOBALS["plugins"] as $pluginName => $plugin) {
            $html .= $spb . PageLink2("main&pi={$pluginName}", $pluginName) . $spe;
        }
    }
    return $html . $pixel;
}