Example #1
0
<?php

require_once dirname(__FILE__) . '/accesscheck.php';
#$spb ='<li>';
#$spe = '</li>';
# Replace the $spb & $spe by <li id="li_ID"> & </li>
$html = '<ul>';
$html .= '<li id="users">' . PageLink2('users', $GLOBALS['I18N']->get('search subscribers')) . '</li>';
$html .= '<li id="attributes">' . PageLink2('attributes', $GLOBALS['I18N']->get('manage subscriber attributes')) . '</li>';
$attributehtml = '';
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'] == 'checkboxgroup' || $row['type'] == 'select' || $row['type'] == 'radio') {
            $attrmenu['editattributes&amp;id=' . $row['id']] = strip_tags($row['name']);
        }
    }
}
foreach ($attrmenu as $page => $desc) {
    $link = PageLink2($page, $desc);
    if ($link) {
        $attributehtml .= '<li>' . $link . '</li>';
    }
}
if (!empty($attributehtml)) {
    $html .= '<li id="edit-values">' . $GLOBALS['I18N']->get('edit values for attributes') . '<ul>' . $attributehtml . '</ul>';
}
$html .= '<li id="reconcileusers">' . PageLink2('reconcileusers', $GLOBALS['I18N']->get('Reconcile Subscribers')) . '</li>';
$html .= '<li id="massunconfirm">' . PageLink2('suppressionlist', $GLOBALS['I18N']->get('Suppression list')) . '</li>';
$html .= '<li id="massremove">' . PageLink2('massremove', $GLOBALS['I18N']->get('Bulk remove subscribers')) . '</li>';
Example #2
0
          printf('<li><input type="hidden" name="listname[%d]" value="%s"><input type="checkbox" name="lists[%d]" value="%d">%s', $c, stripslashes($row["name"]), $c, $row["id"], stripslashes($row["name"]));
          $some = 1;
          $c++;
        }
    */
    if (!$some) {
        echo $GLOBALS['I18N']->get('No lists available') . ' ' . PageLink2("editlist", $GLOBALS['I18N']->get('Add a list'));
    } else {
        $selected_lists = getSelectedLists('lists');
        print listSelectHTML($selected_lists, 'lists', $subselect, s('Select the lists to add the emails to'));
    }
}
/*
}
*/
if (defined('IN_WEBBLER') && Sql_Table_Exists("groups")) {
    $result = Sql_query("SELECT id,name FROM groups ORDER BY listorder");
    $c = 0;
    if (Sql_Affected_Rows() == 1) {
        $row = Sql_fetch_array($result);
        printf('<p class="information"><input type="hidden" name="groupname[%d]" value="%s"><input type="hidden" name="groups[%d]" value="%d">Adding users to group <b>%s</b></p>', $c, $row["name"], $c, $row["id"], $row["name"]);
    } else {
        print '<p class="information">' . $GLOBALS['I18N']->get('Select the groups to add the users to') . '</p>';
        while ($row = Sql_fetch_array($result)) {
            if ($row["id"] == $everyone_groupid) {
                printf('<li><input type="hidden" name="groupname[%d]" value="%s"><input type="hidden" name="groups[%d]" value="%d"><b>%s</b> - ' . $GLOBALS['I18N']->get('automatically added'), $c, $row["name"], $c, $row["id"], $row["name"]);
            } else {
                printf('<li><input type="hidden" name="groupname[%d]" value="%s"><input type="checkbox" name="groups[%d]" value="%d">%s', $c, $row["name"], $c, $row["id"], $row["name"]);
            }
            $some = 1;
            $c++;
Example #3
0
require_once dirname(__FILE__) . '/accesscheck.php';
# quick installation checklist
# initialise database
# setup config values
# configure attributes
# create lists
# create subscribe pages
# add subscribers
$alldone = 1;
$html = '';
$html .= '<table class="setupMain">';
$link = PageLink2('initialise', $GLOBALS['I18N']->get('Go there'));
if (!empty($link)) {
    $html .= '<tr><td>' . $GLOBALS['I18N']->get('Initialise Database') . '</td>
  <td>' . $link . '</td><td>';
    if (Sql_Table_Exists($tables['config'], 1)) {
        $html .= $GLOBALS['img_tick'];
    } else {
        $html .= $GLOBALS['img_cross'];
        $alldone = 0;
    }
    $html .= '</td></tr>';
}
$link = PageLink2('admin&amp;id=1', s('Go there'));
if (!empty($link) && $GLOBALS['require_login']) {
    $html .= '<tr><td>' . s('Change admin password') . ' </td>
  <td>' . $link . '</td><td>';
    $curpwd = Sql_Fetch_Row_Query("select password from {$tables['admin']} where loginname = \"admin\"");
    if ($curpwd[0] != 'phplist' && $curpwd[0] != encryptPass('phplist')) {
        $html .= $GLOBALS['img_tick'];
    } else {
Example #4
0
<?php

require_once dirname(__FILE__) . '/accesscheck.php';
# convert the database to add the prefix
# dangerous, should not be used, particularly not if the prefix already exists
if (!$GLOBALS["table_prefix"]) {
    print "No prefix defined, nothing to do";
    return;
}
include "structure.php";
while (list($table, $value) = each($DBstruct)) {
    if ($table != $tables[$table]) {
        Sql_Drop_Table($tables[$table]);
        Sql_Verbose_Query("alter table {$table} rename {$tables[$table]}", 0);
    }
}
$req = Sql_Verbose_Query("select tablename from " . $tables["attribute"]);
while ($row = Sql_Fetch_Row($req)) {
    set_time_limit(500);
    if (Sql_Table_Exists("listattr_" . $row[0]) && $table_prefix) {
        Sql_Verbose_Query("alter table listattr_{$row['0']} rename {$table_prefix}" . "listattr_" . $row[0]);
    }
    if (Sql_Table_Exists($table_prefix . "listattr_" . $row[0])) {
        Sql_Query("alter table {$table_prefix}" . "listattr_" . $row[0] . " add column listorder integer default 0", 0);
    }
}
flush();
Example #5
0
function SaveConfig($item, $value, $editable = 1, $ignore_errors = 0)
{
    global $tables;
    ## in case DB hasn't been initialised
    if (empty($_SESSION['hasconf'])) {
        $_SESSION['hasconf'] = Sql_Table_Exists($tables['config']);
    }
    if (empty($_SESSION['hasconf'])) {
        return;
    }
    if (isset($GLOBALS['default_config'][$item])) {
        $configInfo = $GLOBALS['default_config'][$item];
    } else {
        $configInfo = array('type' => 'unknown', 'allowempty' => true, 'value' => '');
    }
    ## to validate we need the actual values
    $value = str_ireplace('[domain]', $GLOBALS['domain'], $value);
    $value = str_ireplace('[website]', $GLOBALS['website'], $value);
    switch ($configInfo['type']) {
        case 'boolean':
            if ($value == 'false' || $value == 'no') {
                $value = 0;
            } elseif ($value == 'true' || $value == 'yes') {
                $value = 1;
            }
            break;
        case 'integer':
            $value = sprintf('%d', $value);
            if ($value < $configInfo['min']) {
                $value = $configInfo['min'];
            }
            if ($value > $configInfo['max']) {
                $value = $configInfo['max'];
            }
            break;
        case 'email':
            if (!empty($value) && !is_email($value)) {
                ## hmm, this is displayed only later
                # $_SESSION['action_result'] = s('Invalid value for email address');
                return $configInfo['description'] . ': ' . s('Invalid value for email address');
                $value = '';
            }
            break;
        case 'emaillist':
            $valid = array();
            $hasError = false;
            $emails = explode(',', $value);
            foreach ($emails as $email) {
                if (is_email($email)) {
                    $valid[] = $email;
                } else {
                    $hasError = true;
                }
            }
            $value = implode(',', $valid);
            /*
             * hmm, not sure this is good or bad for UX
             *
             */
            if ($hasError) {
                return $configInfo['description'] . ': ' . s('Invalid value for email address');
            }
            break;
        case 'image':
            include 'class.image.inc';
            $image = new imageUpload();
            $imageId = $image->uploadImage($item, 0);
            if ($imageId) {
                $value = $imageId;
            }
            ## we only use the image type for the logo
            flushLogoCache();
    }
    ## reset to default if not set, and required
    if (empty($configInfo['allowempty']) && empty($value)) {
        $value = $configInfo['value'];
    }
    if (!empty($configInfo['hidden'])) {
        $editable = 0;
    }
    ## force reloading config values in session
    unset($_SESSION['config']);
    ## and refresh the config immediately https://mantis.phplist.com/view.php?id=16693
    unset($GLOBALS['config']);
    Sql_Query(sprintf('replace into %s set item = "%s", value = "%s", editable = %d', $tables['config'], sql_escape($item), sql_escape($value), $editable));
    return false;
    ## true indicates error, and which one
}
Example #6
0
function logEvent($msg)
{
    global $tables;
    if (isset($GLOBALS['page'])) {
        $p = $GLOBALS['page'];
    } elseif (isset($_GET['page'])) {
        $p = $_GET['page'];
    } elseif (isset($_GET['p'])) {
        $p = $_GET['p'];
    } else {
        $p = 'unknown page';
    }
    if (Sql_Table_Exists($tables["eventlog"])) {
        Sql_Query(sprintf('insert into %s (entered,page,entry) values(now(),"%s","%s")', $tables["eventlog"], $p, addslashes($msg)));
    }
}
Example #7
0
<?php

require_once dirname(__FILE__) . '/accesscheck.php';
# convert the database to add the prefix
# dangerous, should not be used, particularly not if the prefix already exists
if (!$GLOBALS['table_prefix']) {
    print 'No prefix defined, nothing to do';
    return;
}
include 'structure.php';
while (list($table, $value) = each($DBstruct)) {
    if ($table != $tables[$table]) {
        Sql_Verbose_Query("drop table if exists {$tables[$table]}", 0);
        Sql_Verbose_Query("alter table {$table} rename {$tables[$table]}", 0);
    }
}
$req = Sql_Verbose_Query('select tablename from ' . $tables['attribute']);
while ($row = Sql_Fetch_Row($req)) {
    set_time_limit(500);
    if (Sql_Table_Exists('listattr_' . $row[0]) && $table_prefix) {
        Sql_Verbose_Query("alter table listattr_{$row['0']} rename {$table_prefix}" . 'listattr_' . $row[0]);
    }
    if (Sql_Table_Exists($table_prefix . 'listattr_' . $row[0])) {
        Sql_Query("alter table {$table_prefix}" . 'listattr_' . $row[0] . ' add column listorder integer default 0', 0);
    }
}
flush();
Example #8
0
function logEvent($msg)
{
    $logged = false;
    foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
        $logged = $logged || $plugin->logEvent($msg);
    }
    if ($logged) {
        return;
    }
    global $tables;
    if (isset($GLOBALS['page'])) {
        $p = $GLOBALS['page'];
    } elseif (isset($_GET['page'])) {
        $p = $_GET['page'];
    } elseif (isset($_GET['p'])) {
        $p = $_GET['p'];
    } else {
        $p = 'unknown page';
    }
    if (!Sql_Table_Exists($tables['eventlog'])) {
        return;
    }
    Sql_Query(sprintf('insert into %s (entered,page,entry) values(now(),"%s","%s")', $tables['eventlog'], $p, sql_escape($msg)));
}
Example #9
0
require_once dirname(__FILE__) . '/accesscheck.php';
# quick installation checklist
# initialise database
# setup config values
# configure attributes
# create lists
# create subscribe pages
# add subscribers
$alldone = 1;
$html = '';
$html .= '<table class="setupMain">';
$link = PageLink2("initialise", $GLOBALS['I18N']->get('Go there'));
if (!empty($link)) {
    $html .= '<tr><td>' . $GLOBALS['I18N']->get('Initialise Database') . '</td>
  <td>' . $link . '</td><td>';
    if (Sql_Table_Exists($tables["config"], 1)) {
        $html .= $GLOBALS["img_tick"];
    } else {
        $html .= $GLOBALS["img_cross"];
        $alldone = 0;
    }
    $html .= '</td></tr>';
}
$link = PageLink2("admin&amp;id=1", s('Go there'));
if (!empty($link) && $GLOBALS["require_login"]) {
    $html .= '<tr><td>' . s('Change admin password') . ' </td>
  <td>' . $link . '</td><td>';
    $curpwd = Sql_Fetch_Row_Query("select password from {$tables["admin"]} where loginname = \"admin\"");
    if ($curpwd[0] != "phplist" && $curpwd[0] != encryptPass('phplist')) {
        $html .= $GLOBALS["img_tick"];
    } else {
Example #10
0
function upgradeTable($table, $tablestructure)
{
    global $tmpdir;
    $columns = array();
    $records = array();
    $fname = tempnam($tmpdir, "");
    $fp = fopen($fname, "w");
    if (Sql_Table_Exists($table)) {
        $cols = Sql_Query("show columns from {$table}");
        while ($row = Sql_Fetch_Row($cols)) {
            array_push($columns, $row[0]);
        }
        #$fp = tmpfile();
        #    print "Writing tempfile $fname<br>";
        $recs = Sql_Query("select * from {$table}");
        while ($data = Sql_Fetch_Array($recs)) {
            reset($columns);
            foreach ($columns as $column) {
                fwrite($fp, "{$column}:" . base64_encode($data[$column]) . "\n");
            }
            fwrite($fp, "--\n");
        }
    }
    fclose($fp);
    Sql_Query("drop table if exists {$table}");
    Sql_Create_table($table, $tablestructure);
    $fp = fopen($fname, "r");
    if (!$fp) {
        unlink($fname);
        return 0;
    }
    #  print "Reading tempfile<br>";
    while (!feof($fp)) {
        # read one record
        $buffer = "";
        $record = array();
        $buffer = fgets($fp, 4096);
        while (!feof($fp) && !ereg("^--", $buffer)) {
            list($column, $value) = explode(":", $buffer);
            if ($column && $value) {
                $record[$column] = base64_decode($value);
            }
            $buffer = fgets($fp, 4096);
        }
        $collist = "";
        $vallist = "";
        if (sizeof($record)) {
            reset($tablestructure);
            while (list($column, $value) = each($tablestructure)) {
                if ($column != "primary key" && $column != "unique") {
                    $collist .= "{$column},";
                    $vallist .= sprintf('"%s",', addslashes($record[$column]));
                }
            }
            $collist = substr($collist, 0, -1);
            $vallist = substr($vallist, 0, -1);
            $query = "replace into {$table} ({$collist}) values({$vallist})";
            #      print $query . "<br>";
            if (!Sql_Query($query)) {
                unlink($fname);
                return 0;
            }
        }
    }
    fclose($fp);
    unlink($fname);
    return 1;
}
Example #11
0
function SaveConfig($item, $value, $editable = 1, $ignore_errors = 0)
{
    global $tables;
    ## in case DB hasn't been initialised
    if (empty($_SESSION['hasconf'])) {
        $_SESSION['hasconf'] = Sql_Table_Exists($tables["config"]);
    }
    if (empty($_SESSION['hasconf'])) {
        return;
    }
    if (isset($GLOBALS['default_config'][$item])) {
        $configInfo = $GLOBALS['default_config'][$item];
    } else {
        $configInfo = array('type' => 'unknown', 'allowempty' => true, 'value' => '');
    }
    ## to validate we need the actual values
    $value = str_ireplace('[domain]', $GLOBALS['domain'], $value);
    $value = str_ireplace('[website]', $GLOBALS['website'], $value);
    switch ($configInfo['type']) {
        case 'boolean':
            if ($value == "false" || $value == "no") {
                $value = 0;
            } elseif ($value == "true" || $value == "yes") {
                $value = 1;
            }
            break;
        case 'integer':
            $value = sprintf('%d', $value);
            if ($value < $configInfo['min']) {
                $value = $configInfo['min'];
            }
            if ($value > $configInfo['max']) {
                $value = $configInfo['max'];
            }
            break;
        case 'email':
            if (!is_email($value)) {
                ## hmm, this is displayed only later
                # $_SESSION['action_result'] = s('Invalid value for email address');
                return $configInfo['description'] . ': ' . s('Invalid value for email address');
                $value = '';
            }
            break;
        case 'emaillist':
            $valid = array();
            $hasError = false;
            $emails = explode(',', $value);
            foreach ($emails as $email) {
                if (is_email($email)) {
                    $valid[] = $email;
                } else {
                    $hasError = true;
                }
            }
            $value = join(',', $valid);
            /*
             * hmm, not sure this is good or bad for UX
             * 
             */
            if ($hasError) {
                return $configInfo['description'] . ': ' . s('Invalid value for email address');
            }
            break;
    }
    ## reset to default if not set, and required
    if (empty($configInfo['allowempty']) && empty($value)) {
        $value = $configInfo['value'];
    }
    if (!empty($configInfo['hidden'])) {
        $editable = false;
    }
    ## force reloading config values in session
    unset($_SESSION['config']);
    ## and refresh the config immediately https://mantis.phplist.com/view.php?id=16693
    unset($GLOBALS['config']);
    Sql_Replace($tables["config"], array('item' => $item, 'value' => $value, 'editable' => $editable), 'item');
    return false;
    ## true indicates error, and which one
}
Example #12
0
print '</div>';
$bouncels = new WebblerListing($GLOBALS['I18N']->get('Bounces'));
$bouncelist = '';
$bounces = array();
# check for bounces
$req = Sql_Query(sprintf('select *,date_format(time,"%%e %%b %%Y %%T") as ftime from %s where user = %d', $tables['user_message_bounce'], $user['id']));
if (Sql_Affected_Rows()) {
    while ($row = Sql_Fetch_Array($req)) {
        $bouncels->addElement($row['bounce'], PageURL2('bounce', $GLOBALS['I18N']->get('view'), 'id=' . $row['bounce']));
        $bouncels->addColumn($row['bounce'], $GLOBALS['I18N']->get('msg'), $row['message']);
        $bouncels->addColumn($row['bounce'], $GLOBALS['I18N']->get('time'), $row['ftime']);
        $bounces[$row['message']] = $row['ftime'];
    }
}
$ls = new WebblerListing($GLOBALS['I18N']->get('Messages'));
if (Sql_Table_Exists($tables['usermessage'])) {
    $msgs = Sql_Query(sprintf('select messageid,entered,viewed,(viewed = 0 or viewed is null) as notviewed,
    abs(unix_timestamp(entered) - unix_timestamp(viewed)) as responsetime from %s where userid = %d and status = "sent" order by entered desc', $tables['usermessage'], $user['id']));
    $num = Sql_Affected_Rows();
} else {
    $num = 0;
}
printf('%d ' . $GLOBALS['I18N']->get('messages sent to this user') . '<br/>', $num);
if ($num) {
    $resptime = 0;
    $totalresp = 0;
    $ls->setElementHeading($GLOBALS['I18N']->get('Campaign Id'));
    while ($msg = Sql_Fetch_Array($msgs)) {
        $ls->addElement($msg['messageid'], PageURL2('message', $GLOBALS['I18N']->get('view'), 'id=' . $msg['messageid']));
        if (defined('CLICKTRACK') && CLICKTRACK) {
            $clicksreq = Sql_Fetch_Row_Query(sprintf('select sum(clicked) as numclicks from %s where userid = %s and messageid = %s', $GLOBALS['tables']['linktrack_uml_click'], $user['id'], $msg['messageid']));
Example #13
0
function logEvent($msg)
{
    global $tables;
    if (isset($GLOBALS['page'])) {
        $p = $GLOBALS['page'];
    } elseif (isset($_GET['page'])) {
        $p = $_GET['page'];
    } elseif (isset($_GET['p'])) {
        $p = $_GET['p'];
    } else {
        $p = 'unknown page';
    }
    $p = removeXss($p);
    if (Sql_Table_Exists($tables["eventlog"])) {
        Sql_Query(sprintf('insert into %s (entered,page,entry) values(now(),"%s","%s")', $tables["eventlog"], sql_escape($p), htmlspecialchars(sql_escape($msg))));
    }
}
Example #14
0
function logEvent($msg)
{
    $logged = false;
    foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
        $logged = $logged || $plugin->logEvent($msg);
    }
    if ($logged) {
        return;
    }
    global $tables;
    if (isset($GLOBALS['page'])) {
        $p = $GLOBALS['page'];
    } elseif (isset($_GET['page'])) {
        $p = $_GET['page'];
    } elseif (isset($_GET['p'])) {
        $p = $_GET['p'];
    } else {
        $p = 'unknown page';
    }
    if (!Sql_Table_Exists($tables["eventlog"])) {
        return;
    }
    $query = ' insert into %s' . '    (entered,page,entry)' . ' values' . '    (current_timestamp, ?, ?)';
    $query = sprintf($query, $tables["eventlog"]);
    Sql_Query_Params($query, array($p, $msg));
}
Example #15
0
if (!isset($_GET['page'])) {
    $page = $GLOBALS['homepage'];
} else {
    $page = $_GET['page'];
}
if (preg_match("/([\\w_]+)/", $page, $regs)) {
    $page = $regs[1];
} else {
    $page = '';
}
if (!is_file($page . '.php') && !isset($_GET['pi'])) {
    $page = $GLOBALS['homepage'];
}
if (!$GLOBALS['admin_auth_module']) {
    # stop login system when no admins exist
    if (!Sql_Table_Exists($tables['admin'])) {
        $GLOBALS['require_login'] = 0;
    } else {
        $num = Sql_Query("select * from {$tables['admin']}");
        if (!Sql_Affected_Rows()) {
            $GLOBALS['require_login'] = 0;
        }
    }
} elseif (!Sql_Table_exists($GLOBALS['tables']['config'])) {
    $GLOBALS['require_login'] = 0;
}
if (!empty($_GET['pi']) && isset($GLOBALS['plugins'][$_GET['pi']])) {
    $page_title = $GLOBALS['plugins'][$_GET['pi']]->pageTitle($page);
} else {
    $page_title = $GLOBALS['I18N']->pageTitle($page);
}
Example #16
0
function getUserConfig($item, $userid = 0)
{
    global $default_config, $tables, $domain, $website;
    $hasconf = Sql_Table_Exists($tables["config"]);
    $value = '';
    if ($hasconf) {
        $query = 'select value,editable from ' . $tables['config'] . ' where item = ?';
        $req = Sql_Query_Params($query, array($item));
        if (!Sql_Num_Rows($req)) {
            if (array_key_exists($item, $default_config)) {
                $value = $default_config[$item]['value'];
            }
        } else {
            $row = Sql_fetch_Row($req);
            $value = $row[0];
            if ($row[1] == 0) {
                $GLOBALS['noteditableconfig'][] = $item;
            }
        }
    }
    # if this is a subpage item, and no value was found get the global one
    if (!$value && strpos($item, ":") !== false) {
        list($a, $b) = explode(":", $item);
        $value = getUserConfig($a, $userid);
    }
    if ($userid) {
        $query = 'select uniqid, email from ' . $tables['user'] . ' where id = ?';
        $rs = Sql_Query_Params($query, array($userid));
        $user_req = Sql_Fetch_Row($rs);
        $uniqid = $user_req[0];
        $email = $user_req[1];
        # parse for placeholders
        # do some backwards compatibility:
        # hmm, reverted back to old system
        $url = getConfig("unsubscribeurl");
        $sep = strpos($url, '?') !== false ? '&' : '?';
        $value = str_ireplace('[UNSUBSCRIBEURL]', $url . $sep . 'uid=' . $uniqid, $value);
        $url = getConfig("confirmationurl");
        $sep = strpos($url, '?') !== false ? '&' : '?';
        $value = str_ireplace('[CONFIRMATIONURL]', $url . $sep . 'uid=' . $uniqid, $value);
        $url = getConfig("preferencesurl");
        $sep = strpos($url, '?') !== false ? '&' : '?';
        $value = str_ireplace('[PREFERENCESURL]', $url . $sep . 'uid=' . $uniqid, $value);
        $value = str_ireplace('[EMAIL]', $email, $value);
        $value = parsePlaceHolders($value, getUserAttributeValues($email));
    }
    $value = str_ireplace('[SUBSCRIBEURL]', getConfig("subscribeurl"), $value);
    $value = preg_replace('/\\[DOMAIN\\]/i', $domain, $value);
    #@ID Should be done only in one place. Combine getConfig and this one?
    $value = preg_replace('/\\[WEBSITE\\]/i', $website, $value);
    if ($value == "0") {
        $value = "false";
    } elseif ($value == "1") {
        $value = "true";
    }
    return $value;
}
    if (Sql_Affected_Rows() == 1) {
        $row = Sql_fetch_array($result);
        printf('<input type=hidden name="listname[%d]" value="%s"><input type=hidden name="lists[%d]" value="%d">%s <b>%s</b>', $c, stripslashes($row["name"]), $c, $row["id"], $GLOBALS['I18N']->get('Adding users to list'), stripslashes($row["name"]));
    } else {
        print '<p>' . $GLOBALS['I18N']->get('Select the lists to add the emails to') . '</p>';
        while ($row = Sql_fetch_array($result)) {
            printf('<li><input type=hidden name="listname[%d]" value="%s"><input type=checkbox name="lists[%d]" value="%d">%s', $c, stripslashes($row["name"]), $c, $row["id"], stripslashes($row["name"]));
            $some = 1;
            $c++;
        }
        if (!$some) {
            echo $GLOBALS['I18N']->get('No lists available') . ' ' . PageLink2("editlist", $GLOBALS['I18N']->get('Add a list'));
        }
    }
}
if (Sql_Table_Exists("groups")) {
    $result = Sql_query("SELECT id,name FROM groups ORDER BY listorder");
    $c = 0;
    if (Sql_Affected_Rows() == 1) {
        $row = Sql_fetch_array($result);
        printf('<p><input type=hidden name="groupname[%d]" value="%s"><input type=hidden name="groups[%d]" value="%d">Adding users to group <b>%s</b></p>', $c, $row["name"], $c, $row["id"], $row["name"]);
    } else {
        print '<p>' . $GLOBALS['I18N']->get('Select the groups to add the users to') . '</p>';
        while ($row = Sql_fetch_array($result)) {
            if ($row["id"] == $everyone_groupid) {
                printf('<li><input type=hidden name="groupname[%d]" value="%s"><input type=hidden name="groups[%d]" value="%d"><b>%s</b> - ' . $GLOBALS['I18N']->get('automatically added'), $c, $row["name"], $c, $row["id"], $row["name"]);
            } else {
                printf('<li><input type=hidden name="groupname[%d]" value="%s"><input type=checkbox name="groups[%d]" value="%d">%s', $c, $row["name"], $c, $row["id"], $row["name"]);
            }
            $some = 1;
            $c++;
 $query = "CREATE TABLE {$tables[$table]} (\n";
 while (list($column, $struct) = each($DBstruct[$table])) {
     if (preg_match('/index_\\d+/', $column)) {
         $query .= "index " . $struct[0] . ",";
     } elseif (preg_match('/unique_\\d+/', $column)) {
         $query .= "unique " . $struct[0] . ",";
     } else {
         $query .= "{$column} " . $struct[0] . ",";
     }
 }
 # get rid of the last ,
 $query = substr($query, 0, -1);
 $query .= "\n)";
 # submit it to the database
 echo $GLOBALS['I18N']->get("Initialising table") . " <b>{$table}</b>";
 if ($force && Sql_Table_Exists($tables[$table])) {
     Error($GLOBALS['I18N']->get("Table already exists") . '<br />');
     echo "... " . $GLOBALS['I18N']->get("failed") . "<br />\n";
     $success = 0;
 } else {
     $res = Sql_Query($query, 0);
     $error = Sql_Has_Error($database_connection);
     $success = $force || $success && !$error;
     if (!$error || $force) {
         if ($table == "admin") {
             # create a default admin
             Sql_Query(sprintf('insert into %s values(0,"%s","%s","%s",now(),now(),"%s","%s",now(),%d,0)', $tables["admin"], "admin", "admin", "", $adminname, "phplist", 1));
         } elseif ($table == "task") {
             while (list($type, $pages) = each($system_pages)) {
                 foreach ($pages as $page => $access_level) {
                     Sql_Query(sprintf('replace into %s (page,type) values("%s","%s")', $tables["task"], $page, $type));
Example #19
0
<?php

require_once dirname(__FILE__) . '/accesscheck.php';
#$spb ='<li>';
#$spe = '</li>';
# Replace the $spb & $spe by <li id="li_ID"> & </li>
$html = '<ul>';
$html .= '<li id="users">' . PageLink2("users", $GLOBALS['I18N']->get('search subscribers')) . '</li>';
$html .= '<li id="attributes">' . PageLink2("attributes", $GLOBALS['I18N']->get('manage subscriber attributes')) . '</li>';
$attributehtml = '';
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"] == "checkboxgroup" || $row["type"] == "select" || $row["type"] == "radio") {
            $attrmenu["editattributes&amp;id=" . $row["id"]] = strip_tags($row["name"]);
        }
    }
}
foreach ($attrmenu as $page => $desc) {
    $link = PageLink2($page, $desc);
    if ($link) {
        $attributehtml .= '<li>' . $link . '</li>';
    }
}
if (!empty($attributehtml)) {
    $html .= '<li id="edit-values">' . $GLOBALS['I18N']->get('edit values for attributes') . '<ul>' . $attributehtml . '</ul>';
}
$html .= '<li id="reconcileusers">' . PageLink2("reconcileusers", $GLOBALS['I18N']->get('Reconcile Subscribers')) . '</li>';
$html .= '<li id="massunconfirm">' . PageLink2("suppressionlist", $GLOBALS['I18N']->get('Suppression list')) . '</li>';
$html .= '<li id="massremove">' . PageLink2("massremove", $GLOBALS['I18N']->get('Bulk remove subscribers')) . '</li>';
Example #20
0
if (!isset($_GET['page'])) {
    $page = $GLOBALS['homepage'];
} else {
    $page = $_GET['page'];
}
if (preg_match("/([\\w_]+)/", $page, $regs)) {
    $page = $regs[1];
} else {
    $page = '';
}
if (!is_file($page . '.php') && !isset($_GET['pi'])) {
    $page = $GLOBALS['homepage'];
}
if (!$GLOBALS["admin_auth_module"]) {
    # stop login system when no admins exist
    if (!Sql_Table_Exists($tables["admin"])) {
        $GLOBALS["require_login"] = 0;
    } else {
        $num = Sql_Query("select * from {$tables["admin"]}");
        if (!Sql_Affected_Rows()) {
            $GLOBALS["require_login"] = 0;
        }
    }
} elseif (!Sql_Table_exists($GLOBALS['tables']['config'])) {
    $GLOBALS['require_login'] = 0;
}
if (!empty($_GET['pi']) && isset($GLOBALS['plugins'][$_GET['pi']])) {
    $page_title = $GLOBALS['plugins'][$_GET['pi']]->pageTitle($page);
} else {
    $page_title = $GLOBALS['I18N']->pageTitle($page);
}
Example #21
0
          printf('<li><input type="hidden" name="listname[%d]" value="%s"><input type="checkbox" name="lists[%d]" value="%d">%s', $c, stripslashes($row["name"]), $c, $row["id"], stripslashes($row["name"]));
          $some = 1;
          $c++;
        }
    */
    if (!$some) {
        echo $GLOBALS['I18N']->get('No lists available') . ' ' . PageLink2('editlist', $GLOBALS['I18N']->get('Add a list'));
    } else {
        $selected_lists = getSelectedLists('lists');
        print listSelectHTML($selected_lists, 'lists', $subselect, s('Select the lists to add the emails to'));
    }
}
/*
}
*/
if (defined('IN_WEBBLER') && Sql_Table_Exists('groups')) {
    $result = Sql_query('SELECT id,name FROM groups ORDER BY listorder');
    $c = 0;
    if (Sql_Affected_Rows() == 1) {
        $row = Sql_fetch_array($result);
        printf('<p class="information"><input type="hidden" name="groupname[%d]" value="%s"><input type="hidden" name="groups[%d]" value="%d">Adding users to group <b>%s</b></p>', $c, $row['name'], $c, $row['id'], $row['name']);
    } else {
        print '<p class="information">' . $GLOBALS['I18N']->get('Select the groups to add the users to') . '</p>';
        while ($row = Sql_fetch_array($result)) {
            if ($row['id'] == $everyone_groupid) {
                printf('<li><input type="hidden" name="groupname[%d]" value="%s"><input type="hidden" name="groups[%d]" value="%d"><b>%s</b> - ' . $GLOBALS['I18N']->get('automatically added'), $c, $row['name'], $c, $row['id'], $row['name']);
            } else {
                printf('<li><input type="hidden" name="groupname[%d]" value="%s"><input type="checkbox" name="groups[%d]" value="%d">%s', $c, $row['name'], $c, $row['id'], $row['name']);
            }
            $some = 1;
            ++$c;
Example #22
0
 }
 flush();
 if (preg_match("/(.*?)-/", $dbversion, $regs)) {
     $dbversion = $regs[1];
 }
 switch ($dbversion) {
     case "1.4.1":
         # nothing changed,
     # nothing changed,
     case "1.4.2":
         # nothing changed,
     # nothing changed,
     case "dev":
     case "1.4.3":
         foreach (array("admin", "adminattribute", "admin_attribute", "task", "admin_task") as $table) {
             if (!Sql_Table_Exists($table)) {
                 Sql_Create_Table($tables[$table], $DBstruct[$table]);
                 if ($table == "admin") {
                     # create a default admin
                     Sql_Query(sprintf('insert into %s values(0,"%s","%s","%s",now(),now(),"%s","%s",now(),%d,0)', $tables["admin"], "admin", "admin", "", $adminname, "phplist", 1));
                 } elseif ($table == "task") {
                     while (list($type, $pages) = each($system_pages)) {
                         foreach ($pages as $page) {
                             Sql_Query(sprintf('insert into %s (page,type) values("%s","%s")', $tables["task"], $page, $type));
                         }
                     }
                 }
             }
         }
         Sql_Query("alter table {$tables["list"]} add column owner integer");
         Sql_Query("alter table {$tables["message"]} change column status status enum('submitted','inprocess','sent','cancelled','prepared')");
 $query = "CREATE TABLE {$tables[$table]} (\n";
 while (list($column, $struct) = each($DBstruct[$table])) {
     if (preg_match('/index_\\d+/', $column)) {
         $query .= "index " . $struct[0] . ",";
     } elseif (preg_match('/unique_\\d+/', $column)) {
         $query .= "unique " . $struct[0] . ",";
     } else {
         $query .= "{$column} " . $struct[0] . ",";
     }
 }
 # get rid of the last ,
 $query = substr($query, 0, -1);
 $query .= "\n)";
 # submit it to the database
 echo $GLOBALS['I18N']->get("Initialising table") . " <b>{$table}</b>";
 if (!isset($force) && Sql_Table_Exists($tables[$table])) {
     Error($GLOBALS['I18N']->get("Table already exists") . '<br />');
     echo "... " . $GLOBALS['I18N']->get("failed") . "<br />\n";
     $success = 0;
 } else {
     $res = Sql_Query($query, 0);
     $error = Sql_Has_Error($database_connection);
     $success = $force || $success && !$error;
     if (!$error || $force) {
         if ($table == "admin") {
             # create a default admin
             Sql_Query(sprintf('insert into %s values(0,"%s","%s","%s",now(),now(),"%s","%s",now(),%d,0)', $tables["admin"], "admin", "admin", "", $adminname, "phplist", 1));
         } elseif ($table == "task") {
             while (list($type, $pages) = each($system_pages)) {
                 foreach ($pages as $page => $access_level) {
                     Sql_Query(sprintf('replace into %s (page,type) values("%s","%s")', $tables["task"], $page, $type));
Example #24
0
print '</div>';
$bouncels = new WebblerListing($GLOBALS['I18N']->get('Bounces'));
$bouncelist = "";
$bounces = array();
# check for bounces
$req = Sql_Query(sprintf('select *,date_format(time,"%%e %%b %%Y %%T") as ftime from %s where user = %d', $tables["user_message_bounce"], $user["id"]));
if (Sql_Affected_Rows()) {
    while ($row = Sql_Fetch_Array($req)) {
        $bouncels->addElement($row["bounce"], PageURL2("bounce", $GLOBALS['I18N']->get('view'), "id=" . $row["bounce"]));
        $bouncels->addColumn($row["bounce"], $GLOBALS['I18N']->get('msg'), $row["message"]);
        $bouncels->addColumn($row["bounce"], $GLOBALS['I18N']->get('time'), $row["ftime"]);
        $bounces[$row["message"]] = $row["ftime"];
    }
}
$ls = new WebblerListing($GLOBALS['I18N']->get('Messages'));
if (Sql_Table_Exists($tables["usermessage"])) {
    $msgs = Sql_Query(sprintf('select messageid,entered,viewed,(viewed = 0 or viewed is null) as notviewed,
    abs(unix_timestamp(entered) - unix_timestamp(viewed)) as responsetime from %s where userid = %d and status = "sent"', $tables["usermessage"], $user["id"]));
    $num = Sql_Affected_Rows();
} else {
    $num = 0;
}
printf('%d ' . $GLOBALS['I18N']->get('messages sent to this user') . '<br/>', $num);
if ($num) {
    $resptime = 0;
    $totalresp = 0;
    while ($msg = Sql_Fetch_Array($msgs)) {
        $ls->addElement($msg["messageid"], PageURL2("message", $GLOBALS['I18N']->get('view'), "id=" . $msg["messageid"]));
        if (defined('CLICKTRACK') && CLICKTRACK) {
            $clicksreq = Sql_Fetch_Row_Query(sprintf('select sum(clicked) as numclicks from %s where userid = %s and messageid = %s', $GLOBALS['tables']['linktrack_uml_click'], $user['id'], $msg['messageid']));
            $clicks = sprintf('%d', $clicksreq[0]);
Example #25
0
 function isInitialised()
 {
     global $config;
     return Sql_Table_Exists($this->tables["list"]);
 }
Example #26
0
include dirname(__FILE__) . '/structure.php';
if (!defined('PHPLISTINIT')) {
    exit;
}
print '<h3>' . s('Database structure check') . '</h3>';
unset($_SESSION["dbtables"]);
$pass = true;
$ls = new WebblerListing(s('Database structure'));
while (list($table, $tablename) = each($GLOBALS["tables"])) {
    $createlink = '';
    $indexes = $uniques = $engine = $category = '';
    $ls->addElement($table);
    if ($table != $tablename) {
        $ls->addColumn($table, "real name", $tablename);
    }
    if (Sql_Table_Exists($tablename)) {
        $req = Sql_Query("show columns from {$tablename}", 0);
        $columns = array();
        if (!Sql_Affected_Rows()) {
            $ls->addColumn($table, "exist", $GLOBALS["img_cross"]);
        }
        while ($row = Sql_Fetch_Array($req)) {
            $columns[strtolower($row["Field"])] = $row["Type"];
        }
        $tls = new WebblerListing($table);
        if (isset($DBstruct[$table])) {
            $struct = $DBstruct[$table];
        } else {
            $struct = '';
        }
        $haserror = 0;
Example #27
0
function logEvent($msg) {
	global $tables;
  if (Sql_Table_Exists($tables["eventlog"]))
	Sql_Query(sprintf('insert into %s (entered,page,entry) values(now(),"%s","%s")',$tables["eventlog"],
  	$GLOBALS["page"],addslashes($msg)));
}