Пример #1
0
function preferencesPage($id, $userid)
{
    list($attributes, $attributedata) = PageAttributes($GLOBALS['pagedata']);
    $selected_lists = explode(',', $GLOBALS['pagedata']['lists']);
    $html = '<title>' . $GLOBALS['strPreferencesTitle'] . '</title>';
    $html .= $GLOBALS['pagedata']['header'];
    $html .= '<h3>' . $GLOBALS['strPreferencesInfo'] . '</h3>';
    $html .= '

<br/><div class="error"><span class="required">' . $GLOBALS['strRequired'] . '</span></div><br/>
' . $GLOBALS['msg'] . '

<script language="Javascript" type="text/javascript">

var fieldstocheck = new Array();
    fieldnames = new Array();

function checkform()
{
  for (i=0;i<fieldstocheck.length;i++) {
    if (eval("document.subscribeform.elements[\'"+fieldstocheck[i]+"\'].value") == "") {
      alert("' . $GLOBALS['strPleaseEnter'] . ' "+fieldnames[i]);
      eval("document.subscribeform.elements[\'"+fieldstocheck[i]+"\'].focus()");

      return false;
    }
  }
';
    if ($GLOBALS['pagedata']['emaildoubleentry'] == 'yes') {
        $html .= '
  if (! compareEmail()) {
    alert("Email addresses you entered do not match");

    return false;
  }';
    }
    $html .= '
  if (! checkEmail()) {
    alert("Email addresses you entered is not valid");

    return false;
  }';
    $html .= '

  return true;
}

function addFieldToCheck(value,name)
{
  fieldstocheck[fieldstocheck.length] = value;
  fieldnames[fieldnames.length] = name;
}

function compareEmail()
{
  return (document.subscribeform.elements["email"].value == document.subscribeform.elements["emailconfirm"].value);
}

function checkEmail()
{
  var re = /^(([^<>()[\\]\\.,;:\\s@\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\"]+)*)|(\\".+\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;
    return re.test(document.subscribeform.elements["email"].value);
}

</script>';
    $html .= formStart('name="subscribeform"');
    $html .= '<table border=0>';
    $html .= ListAttributes($attributes, $attributedata, $GLOBALS['pagedata']['htmlchoice'], $userid, $GLOBALS['pagedata']['emaildoubleentry']);
    $html .= '</table>';
    //obsolete, moved to rssmanager plugin
    //  if (ENABLE_RSS) {
    //    $html .= rssOptions($data,$userid);
    //   }
    foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
        if ($plugin->enabled) {
            $html .= $plugin->displaySubscriptionChoice($GLOBALS['pagedata'], $userid);
        }
    }
    $html .= ListAvailableLists($userid, $GLOBALS['pagedata']['lists']);
    if (isBlackListedID($userid)) {
        $html .= $GLOBALS['strYouAreBlacklisted'];
    }
    $html .= '<p><input type=submit name="update" value="' . $GLOBALS['strUpdatePreferences'] . '" onClick="return checkform();"></p></form>';
    $html .= '<br/><br/>';
    if (SHOW_UNSUBSCRIBELINK) {
        $html .= '<p><a href="' . getConfig('unsubscribeurl') . '&id=' . $id . '">' . $GLOBALS['strUnsubscribe'] . '</a></p>';
    }
    $html .= $GLOBALS['PoweredBy'];
    $html .= $GLOBALS['pagedata']['footer'];
    return $html;
}
Пример #2
0
function preferencesPage($id, $userid)
{
    $data = PageData($id);
    if (isset($data['language_file']) && is_file(dirname(__FILE__) . '/texts/' . $data['language_file'])) {
        @(include dirname(__FILE__) . '/texts/' . $data['language_file']);
    }
    list($attributes, $attributedata) = PageAttributes($data);
    $selected_lists = explode(',', $data["lists"]);
    $html = '<title>' . $GLOBALS["strPreferencesTitle"] . '</title>';
    $html .= $data["header"];
    $html .= '<b>' . $GLOBALS["strPreferencesInfo"] . '</b>';
    $html .= '

<br/><font class="required">' . $GLOBALS["strRequired"] . '</font><br/>
' . $GLOBALS["msg"] . '

<script language="Javascript" type="text/javascript">

var fieldstocheck = new Array();
    fieldnames = new Array();

function checkform() {
  for (i=0;i<fieldstocheck.length;i++) {
    if (eval("document.subscribeform.elements[\'"+fieldstocheck[i]+"\'].value") == "") {
      alert("' . $GLOBALS["strPleaseEnter"] . ' "+fieldnames[i]);
      eval("document.subscribeform.elements[\'"+fieldstocheck[i]+"\'].focus()");
      return false;
    }
  }
';
    if ($data['emaildoubleentry'] == 'yes') {
        $html .= '
  if(! compareEmail())
  {
    alert("Email addresses you entered do not match");
    return false;
  }';
    }
    $html .= '
  return true;
}

function addFieldToCheck(value,name) {
  fieldstocheck[fieldstocheck.length] = value;
  fieldnames[fieldnames.length] = name;
}

function compareEmail()
{
  return (document.subscribeform.elements["email"].value == document.subscribeform.elements["emailconfirm"].value);
}


</script>';
    $html .= formStart('name="subscribeform"');
    $html .= '<table border=0>';
    $html .= ListAttributes($attributes, $attributedata, $data["htmlchoice"], $userid, $data['emaildoubleentry']);
    $html .= '</table>';
    if (ENABLE_RSS) {
        $html .= RssOptions($data, $userid);
    }
    $html .= ListAvailableLists($userid, $data["lists"]);
    if (isBlackListedID($userid)) {
        $html .= $GLOBALS["strYouAreBlacklisted"];
    }
    $html .= '<p><input type=submit name="update" value="' . $GLOBALS["strUpdatePreferences"] . '" onClick="return checkform();"></p>
    </form><br/><br/>
    <p><a href="' . getConfig("unsubscribeurl") . '&id=' . $id . '">' . $GLOBALS["strUnsubscribe"] . '</a></p>
  ' . $GLOBALS["PoweredBy"];
    $html .= $data["footer"];
    return $html;
}