initial commit of file from CVS for smeserver-phplist on Sat Sep 7 20:52:04 AEST 2024

This commit is contained in:
Trevor Batley 2024-09-07 20:52:04 +10:00
parent 6c8bb59e2c
commit d3b55b4e65
42 changed files with 799 additions and 2 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.rpm
*.log
*spec-20*
*.tar.gz

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
# Makefile for source rpm: smeserver-phplist
# $Id: Makefile,v 1.1 2022/08/02 07:05:26 jpp Exp $
NAME := smeserver-phplist
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View File

@ -1,3 +1,15 @@
# smeserver-phplist
# <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> smeserver-phplist
SMEServer Koozali developed git repo for smeserver-phplist smecontribs
## Wiki
<br />https://wiki.koozali.org/Phplist
## Bugzilla
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-phplist&product=SME%20Contribs&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
## Description
<br />*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
*Once it has been checked, then this comment will be deleted*
<br />

View File

@ -0,0 +1,3 @@
the .tito/packages directory contains metadata files
named after their packages. Each file has the latest tagged
version and the project's relative directory.

View File

@ -0,0 +1 @@
0.2.1-1 ./

View File

@ -0,0 +1 @@
../../tito_libs/releasers.conf

View File

@ -0,0 +1,7 @@
[buildconfig]
builder = tito.builder.Builder
tagger = tito.tagger.VersionTagger
changelog_do_not_remove_cherrypick = 0
changelog_format = %s (%ae)
lib_dir = ../tito_libs

View File

@ -0,0 +1,87 @@
Summary: sme server integration of phplist
Name: smeserver-phplist
Version: 0.2.1
Release: 1%{?dist}
License: GNU GPL version 2
URL: http://www.phplist.com
Group: SMEserver/addon
Source: %{name}-%{version}.tar.gz
BuildArchitectures: noarch
BuildRequires: e-smith-devtools
BuildRoot: /var/tmp/%{name}-%{version}
Requires: e-smith-release >= 8.0
Requires: phplist >= 3.0.6
Requires: smeserver-webapps-common
AutoReqProv: no
%description
This rpm provides all the needed templates to get phplist
running on SME Server
%changelog
* Wed Mar 18 2020 Daniel Berteaud <daniel@firewall-services.com> 0.2.1-1
- new package built with tito
* Wed Jul 30 2014 Daniel Berteaud <daniel@firewall-services.com> 0.2.0-1
- Nearly complete rewrite
- Change the way bounces are processed
- Add a daemon to process the queue and the bounces
- Requires phplist 3.0.6
* Fri Dec 31 2010 Daniel Berteaud <daniel@firewall-services.com> 0.1-3
- Fix typo in BouncesPassword prop name
* Thu Dec 30 2010 Daniel Berteaud <daniel@firewall-services.com> 0.1-2
- Change the way mysql permissions are applied
- Rewrite URL to force SSL for /lists/admin
- Add LemonLDAP auth support (disable basic auth)
- Add AdminUsers prop (only for basic auth)
* Mon Dec 20 2010 Daniel Berteaud <daniel@firewall-services.com> 0.1-1
- Minor templates cleanup
* Mon Dec 20 2010 Pierre Bourdin <pierre@firewall-services.com> 0.1-0.beta9
- patch to restrict admin interface with SSL + login
- Separation of the main Alias for Apache in two parts, Admin and Subscibe part
* Mon Dec 20 2010 Pierre Bourdin <pierre@firewall-services.com> 0.1-0.beta8
- patch for force SSL connection and add access variable in DB configuration
* Thu Dec 09 2010 Pierre Bourdin <pierre@firewall-services.com> 0.1-0.beta2
- patch some forgotten parameters in configuration files and add DB configuration
* Wed Dec 08 2010 Pierre Bourdin <pierre@firewall-services.com> 0.1-0.beta0
- initial release
%prep
%setup
%build
perl ./createlinks
%{__mkdir_p} root/var/lib/phplist
%{__mkdir_p} root/var/log/phplist
%install
rm -rf $RPM_BUILD_ROOT
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
rm -f %{name}-%{version}-filelist
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
--dir /var/lib/phplist 'attr(0750,www,www)' \
--dir /var/log/phplist 'attr(0750,smelog,smelog)' \
--file /var/lib/phplist/bounces.mbox 'config(noreplace) %attr(0640,www,www)' \
--file /var/service/phplist/run 'attr(0750,root,root)' \
--file /var/service/phplist/log/run 'attr(0750,root,root)' \
> %{name}-%{version}-filelist
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)
%clean
rm -rf $RPM_BUILD_ROOT
%postun
true

1
contriborbase Normal file
View File

@ -0,0 +1 @@
contribs10

51
createlinks Normal file
View File

@ -0,0 +1,51 @@
#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
templates2events("/etc/e-smith/sql/init/phplistdb", qw/webapps-update bootstrap-console-save/);
templates2events("/etc/phplist/config.php", qw/webapps-update bootstrap-console-save/);
safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/webapps-update/S55phplist-qmail-assign");
foreach my $event (qw/webapps-update bootstrap-ldap-save/){
event_link("phplist-create-pseudo", "$event", "55");
}
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/etc/phplist/config.php/template-begin");
safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/etc/phplist/config.php/template-end");
safe_symlink("/var/qmail/alias/.qmail-phplistbounces", "root/var/qmail/alias/.qmail-phplistbounces-default");
safe_symlink("restart", "root/etc/e-smith/events/webapps-update/services2adjust/phplist");
safe_touch("root/var/lib/phplist/bounces.mbox");
my $event="smeserver-phplist-update";
event_templates($event, qw(
/etc/httpd/conf/httpd.conf
/etc/opt/remi/php80/php-fpm.d/www.conf
/etc/e-smith/sql/init/phplistdb
/etc/phplist/config.php
/etc/e-smith/sql/init/phplistdb
));
event_services($event, qw(
php80-php-fpm restart
httpd-e-smith restart
phplist restart
mysql.init restart
));
safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/$event/S93phplist-qmail-assign");
event_actions($event, qw(
phplist-initialise 92
phplist-create-pseudo 93
systemd-default 88
systemd-reload 89
));
use esmith::Build::Backup qw(:all);
backup_includes("smeserver-phplist-udpdate", qw(
/var/lib/phplist
/var/log/phplist
));

View File

@ -0,0 +1 @@
url

View File

@ -0,0 +1 @@
phplist

View File

@ -0,0 +1 @@
phplist

View File

@ -0,0 +1 @@
private

View File

@ -0,0 +1 @@
enabled

View File

@ -0,0 +1 @@
service

View File

@ -0,0 +1,52 @@
{
my $rec = $DB->get('phplist')
|| $DB->new_record('phplist', {type => 'webapp'});
my $pw = $rec->prop('DbPassword');
if (not $pw or length($pw) < 57){
use MIME::Base64 qw(encode_base64);
$pw = "not set due to error";
if ( open( RANDOM, "/dev/urandom" ) ){
my $buf;
# 57 bytes is a full line of Base64 coding, and contains
# 456 bits of randomness - given a perfectly random /dev/random
if ( read( RANDOM, $buf, 57 ) != 57 ){
warn("Short read from /dev/random: $!");
}
else{
$pw = encode_base64($buf);
chomp $pw;
}
close RANDOM;
}
else{
warn "Could not open /dev/urandom: $!";
}
$rec->set_prop('DbPassword', $pw);
}
my $apw = $rec->prop('AdminPass');
if (not $apw or length($apw) < 20){
use MIME::Base64 qw(encode_base64);
$apw = "not set due to error";
if ( open( RANDOM, "/dev/urandom" ) ){
my $buf;
# 57 bytes is a full line of Base64 coding, and contains
# 456 bits of randomness - given a perfectly random /dev/random
if ( read( RANDOM, $buf, 20 ) != 20 ){
warn("Short read from /dev/random: $!");
}
else{
$apw = encode_base64($buf);
chomp $apw;
}
close RANDOM;
}
else{
warn "Could not open /dev/urandom: $!";
}
$rec->set_prop('AdminPass', $apw);
}
my $type = $rec->prop("type");
$rec->set_prop("type","service") unless ($type eq "service");
}

View File

@ -0,0 +1,20 @@
#!/usr/bin/perl -w
use strict;
use warnings;
use esmith::AccountsDB;
my $a = esmith::AccountsDB->open or die "Couldn't open AccountsDB\n";
my $pseudo = $a->get('listreports');
if (!$pseudo){
$a->new_record('listreports',{
type => 'pseudonym',
Account => 'admin'
});
unless ( system("/sbin/e-smith/signal-event", "pseudonym-create", "listreports") == 0 ){
die "Failed to create pseudonym listreports\n";
}
}

View File

@ -0,0 +1,6 @@
#!/bin/bash
password=$(config getprop phplist AdminPass)
domain=$(config get DomainName)
ADMIN_PASSWORD=$password ADMIN_EMAIL=admin@$domain phplist -pinitialise
phplist -pdbcheck
phplist -pupgrade

View File

@ -0,0 +1 @@
PERMS=0750

View File

@ -0,0 +1,3 @@
PERMS=0640
UID="root"
GID="www"

View File

@ -0,0 +1,46 @@
{
my $db = ${'phplist'}{'DbName'} || 'phplist';
my $user = ${'phplist'}{'DbUser'} || 'phplist';
my $pass = ${'phplist'}{'DbPassword'} || 'secret';
$OUT .= <<"END";
#! /bin/sh
if [ ! -d /var/lib/mysql/$db ]; then
/usr/bin/mysql -e 'create database $db'
fi
/usr/bin/mysql <<EOF
USE mysql;
REPLACE INTO user (
host,
user,
password)
VALUES (
'localhost',
'${'phplist'}{DbUser}',
PASSWORD ('${'phplist'}{DbPassword}'));
REPLACE INTO db (
host,
db,
user,
select_priv, insert_priv, update_priv, delete_priv,
create_priv, alter_priv, index_priv, drop_priv, create_tmp_table_priv,
grant_priv, lock_tables_priv, references_priv)
VALUES (
'localhost',
'${'phplist'}{DbName}',
'${'phplist'}{DbUser}',
'Y', 'Y', 'Y', 'Y',
'Y', 'Y', 'Y', 'Y', 'Y',
'N', 'Y', 'Y');
FLUSH PRIVILEGES;
EOF
END
}

View File

@ -0,0 +1,71 @@
{
my $status = $phplist{'status'} || 'disabled';
my $access = $phplist{'access'} || 'private';
my $auth = $phplist{'Authentication'} || 'internal';
my $alias = $phplist{'AliasOnPrimary'} || 'enabled';
my $ver = $sysconfig{'ReleaseVersion'} || '8.1';
my $allow = ( $access eq 'public' ) ? 'all granted' : "ip $localAccess $externalSSLAccess";
$alias = ($alias ne 'enabled') ? '' : 'Alias /lists /usr/share/phplist/www/';
$auth = ( $auth eq 'http' ) ? 'AuthName "phplist"' . "\n" .
" AuthType Basic\n" .
" AuthBasicProvider external\n".
" AuthExternal pwauth\n".
" require valid-user\n" : '';
if ($status eq 'enabled') {
$OUT .=<<"EOF";
$alias
<Directory /usr/share/phplist/www/>
Options None +FollowSymLinks
AllowOverride None
DirectoryIndex index.php
AddType application/x-httpd-php .php
<FilesMatch "\\.(php|inc)\$">
Require all denied
</FilesMatch>
<FilesMatch "(index.php|dl.php|ut.php|lt.php|download.php|connector.php)\$">
Require all granted
SetHandler "proxy:unix:/var/run/php-fpm/php80-phplist.sock|fcgi://localhost"
</FilesMatch>
Require $allow
</Directory>
# Admin section
<Directory /usr/share/phplist/www/admin>
SSLRequireSSL on
<FilesMatch "\\.(php|inc)\$">
Require all denied
</FilesMatch>
<FilesMatch "(index.php|connector.php|upload.php)\$">
SetHandler "proxy:unix:/var/run/php-fpm/php80-phplist.sock|fcgi://localhost"
Require all granted
</FilesMatch>
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=\$1
<RequireAll>
Require $allow
$auth
</RequireAll>
</Directory>
<Directory /usr/share/phplist/www/admin/js>
<RequireAny>
Require $allow
</RequireAny>
</Directory>
<Directory /usr/share/phplist/www/admin/ui>
<RequireAny>
Require $allow
</RequireAny>
</Directory>
EOF
}
else{
$OUT .= "# PHPList is disabled\n";
}
}

View File

@ -0,0 +1,13 @@
{
my $sslport = $modSSL{'TCPPort'} || '443';
my $alias = $phplist{'AliasOnPrimary'} || 'enabled';
if ($port ne $sslport && $alias eq 'enabled'){
## Redirect Web Address to Secure Address
$OUT .= " RewriteEngine on\n";
$OUT .= " RewriteRule ^/lists/admin(/.*|\$) https://%{HTTP_HOST}/lists/admin\$1 \[L,R\]\n";
}
}

View File

@ -0,0 +1,66 @@
{
if ($PHP_VERSION eq '80'){
if (($phplist{'status'} || 'disabled') eq 'enabled'){
my $max_upload_size = ($phplist{MaxUploadSize} || '6M');
$max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/);
my $memory_limit = ($phplist{MemoryLimit} || '128M');
$memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/);
my $open_basedir= $phplist{PHPBaseDir} || '';
$open_basedir = "/usr/share/phplist:/var/lib/phplist:/tmp:/etc/phplist:/var/log/phplist:/usr/share/php/auth_translation.php:$open_basedir";
my $id = 'phplist';
my $max_children = $phplist{'PHPmaxChildren'} || 20;
my $min_spare_servers = $phplist{'PHPminServers'} || 4;
my $start_servers = $phplist{'PHPstartServers'} || 6;
my $max_spare_servers = $phplist{'PHPmaxServers'} || 8;
my $max_requests = $phplist{'PHPmaxRequests'} || 1000;
$min_spare_servers = ( $min_spare_servers > $max_spare_servers ) ? printf("%.0f",$max_spare_servers/2) : $min_spare_servers;
$start_servers = ( $start_servers > $max_spare_servers ) ? printf("%.0f", $max_spare_servers /2 + $min_spare_servers/2 ) : $start_servers;
$OUT .=<<_EOF;
[php$PHP_VERSION-$id]
user = www
group = www
listen.owner = root
listen.group = www
listen.mode = 0660
listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock
pm = dynamic
pm.max_children = $max_children
pm.start_servers = $start_servers
pm.min_spare_servers = $min_spare_servers
pm.max_spare_servers = $max_spare_servers
pm.max_requests = $max_requests
php_admin_value[auto_prepend_file] = /usr/share/php/auth_translation.php
php_admin_value[session.save_path] = /var/lib/php/$id/session
php_admin_value[session.gc_maxlifetime] = 86400
php_admin_value[opcache.file_cache] = /var/lib/php/$id/opcache
php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp
php_admin_value[error_log] = /var/log/php/$id/error.log
slowlog = /var/log/php/phplist/slow.log
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName }
php_admin_flag[display_errors] = off
php_admin_flag[log_errors] = on
php_admin_value[error_log] = syslog
php_admin_value[memory_limit] = $memory_limit
php_admin_value[max_execution_time] = 3600
php_admin_value[post_max_size] = $max_upload_size
php_admin_value[upload_max_filesize] = $max_upload_size
php_admin_value[disable_functions] = system, show_source, symlink, dl, passthru, phpinfo, escapeshellarg, escapeshellcmd
php_admin_value[open_basedir] = $open_basedir
php_admin_flag[allow_url_fopen] = on
php_admin_flag[file_uploads] = on
php_admin_flag[session.cookie_httponly] = on
php_admin_flag[allow_url_include] = off
php_admin_value[session.save_handler] = files
php_admin_flag[output_buffering] = off
_EOF
}
else{
$OUT .= '; phplist is disabled';
}
}
}

View File

@ -0,0 +1,15 @@
{
my $dbn = $phplist{'DbName'} || 'phplist';
my $dbu = $phplist{'DbUser'} || 'phplist';
my $dbp = $phplist{'DbPassword'} || 'secret';
$OUT .=<<"HERE";
\$database_host = "localhost";
\$database_name = "$dbn";
\$database_user = "$dbu";
\$database_password = '$dbp';
HERE
}

View File

@ -0,0 +1 @@
define("PHPMAILERHOST",'localhost');

View File

@ -0,0 +1 @@
define ("TEST",0);

View File

@ -0,0 +1,7 @@
$message_envelope = "phplistbounces@{$DomainName}";
$bounce_protocol = 'mbox';
define ("MANUALLY_PROCESS_BOUNCES",0);
$bounce_mailbox = '/var/lib/phplist/bounces.mbox';
$bounce_mailbox_purge = 1;
$bounce_mailbox_purge_unprocessed = 1;
$bounce_unsubscribe_threshold = 5;

View File

@ -0,0 +1 @@
$installation_name = 'phpList {$DomainName}';

View File

@ -0,0 +1,9 @@
$require_login = 1;
$admin_auth_module = '{(($phplist{'Authentication'} || 'internal') eq 'internal') ? 'phplist_auth.inc':'external_auth.inc'}';
define("REGISTER",0);
define("MANUALLY_PROCESS_QUEUE",0);
define('MAILQUEUE_THROTTLE',0.5);
define('USE_DOMAIN_THROTTLE',0);
define('DOMAIN_BATCH_SIZE',30);
define('DOMAIN_BATCH_PERIOD',300);
define('MAX_PROCESSQUEUE_TIME',900);

View File

@ -0,0 +1,12 @@
{
if (($phplist{'Tracking'} || 'disabled') eq 'enabled'){
$OUT .=<<"EOF";
define('CLICKTRACK',1);
define('CLICKTRACK_SHOWDETAIL',1);
EOF
}
else{
$OUT .= '# Tracking is disabled';
}
}
define("NOSTATSCOLLECTION",1);

View File

@ -0,0 +1,3 @@
define("MANUALLY_PROCESS_QUEUE",0);
define('MAILQUEUE_THROTTLE',0);
define('USE_DOMAIN_THROTTLE',0);

View File

@ -0,0 +1,15 @@
$attachment_repository = '/var/lib/phplist/tmp';
define("ALLOW_ATTACHMENTS",1);
define('USE_ADMIN_DETAILS_FOR_MESSAGES',1);
define("PLUGIN_ROOTDIR","/usr/share/phplist/www/admin/plugins");
define("FCKIMAGES_DIR","uploadimages");
define('UPLOADIMAGES_DIR','uploadimages');
define("FORWARD_PERSONAL_NOTE_SIZE",500);
$tmpdir = '/var/lib/phplist/tmp';
{
my $lang = $phplist{'Language'} || '';
$lang .= ($lang =~ m/\.inc$/) ? '' : '.inc';
if ($lang ne '' && -e '/usr/share/phplist/www/texts/' . $lang){
$OUT .= '$language_module = \'' . $lang . '\';';
}
}

View File

@ -0,0 +1,2 @@
=phplistbounces:www:102:102:/var/qmail/alias:-:phplistbounces:
+phplistbounces-:www:102:102:/var/qmail/alias:-:-phplistbounces-::

View File

@ -0,0 +1,3 @@
{
$OUT .= "phplistbounces\@$_\n" for (@domains);
}

View File

@ -0,0 +1,13 @@
[Unit]
Description=phplist process queues
After=network-online.target
[Service]
ExecStartPre=-/sbin/e-smith/service-status phplist
ExecStart=/usr/sbin/e-smith/systemd/phplist
Restart=always
Restartsec=10s
RemainAfterExit=yes
[Install]
WantedBy=sme-server.target

View File

@ -0,0 +1,2 @@
#!/bin/bash
/usr/bin/php80 /usr/share/phplist/www/admin/index.php -c /etc/phplist/config.php $*

View File

@ -0,0 +1,10 @@
#!/bin/sh
exec 2>&1
cd /usr/local/bin/
while true; do
/usr/local/bin/setuidgid www ./phplist -pprocessbounces
/usr/local/bin/setuidgid www ./phplist -pprocessqueue
sleep 120
done

View File

@ -0,0 +1,119 @@
<?php
require_once dirname(__FILE__).'/../accesscheck.php';
$_REQUEST["login"] = $_SERVER["REMOTE_USER"];
$_REQUEST["password"] = $_SERVER["REMOTE_USER"];
class admin_auth {
function validateLogin($login,$password) {
if (isset($_SERVER["REMOTE_USER"]) && $_SERVER["REMOTE_USER"] !== ""){
$query = ' select password, disabled, id' .
' from %s' .
' where loginname = ?';
$query = sprintf($query, $GLOBALS['tables']['admin']);
$req = Sql_Query_Params($query, array($login));
$admindata = Sql_Fetch_Assoc($req);
// Nothing in the database yet ? Reject login
if (!$admindata['id']){
return array(0,s("Login failed"));
}
elseif ($admindata["disabled"]) {
return array(0,s("your account has been disabled"));
}
else{
return array($admindata['id'],"OK");
}
}
else{
return array(0,s("Login failed"));
}
}
function getPassword($email) {
$email = preg_replace("/[;,\"\']/","",$email);
$query = sprintf('select email, password, loginname from %s where email = ?', $GLOBALS['tables']['admin']);
$req = Sql_Query_Params($query, array($email));
if (Sql_Num_Rows($req)) {
$row = Sql_Fetch_Row($req);
return $row[1];
}
}
function validateAccount($id) {
/* can only do this after upgrade, which means
* that the first login will always fail
$query
= ' select id, disabled,password,privileges'
. ' from %s'
. ' where id = ?';
*/
$query
= ' select id, disabled,password'
. ' from %s'
. ' where id = ?';
$query = sprintf($query, $GLOBALS['tables']['admin']);
$req = Sql_Query_Params($query, array($id));
$data = Sql_Fetch_Row($req);
if (!$data[0]) {
return array(0,s("No such account"));
} elseif ($data[1]) {
return array(0,s("your account has been disabled"));
}
## do this seperately from above, to avoid lock out when the DB hasn't been upgraded.
## so, ignore the error
$query
= ' select privileges'
. ' from %s'
. ' where id = ?';
$query = sprintf($query, $GLOBALS['tables']['admin']);
$req = Sql_Query_Params($query, array($id),1);
if ($req) {
$data = Sql_Fetch_Row($req);
} else {
$data = array();
}
if (!empty($data[0])) {
$_SESSION['privileges'] = unserialize($data[0]);
}
return array(1,"OK");
}
function adminName($id) {
$req = Sql_Fetch_Row_Query(sprintf('select loginname from %s where id = %d',$GLOBALS["tables"]["admin"],$id));
return $req[0] ? $req[0] : s("Nobody");
}
function adminEmail($id) {
$req = Sql_Fetch_Row_Query(sprintf('select email from %s where id = %d',$GLOBALS["tables"]["admin"],$id));
return $req[0] ? $req[0] : "";
}
function adminIdForEmail($email) { #Obtain admin Id from a given email address.
$req = Sql_Fetch_Row_Query(sprintf('select id from %s where email = "%s"',$GLOBALS["tables"]["admin"],sql_escape($email)));
return $req[0] ? $req[0] : "";
}
function isSuperUser($id) {
$req = Sql_Fetch_Row_Query(sprintf('select superuser from %s where id = %d',$GLOBALS["tables"]["admin"],$id));
return $req[0];
}
function listAdmins() {
$result = array();
$req = Sql_Query("select id,loginname from {$GLOBALS["tables"]["admin"]} order by loginname");
while ($row = Sql_Fetch_Array($req)) {
$result[$row["id"]] = $row["loginname"];
}
return $result;
}
}
?>

View File

@ -0,0 +1 @@
/var/lib/phplist/bounces.mbox

111
smeserver-phplist.spec Normal file
View File

@ -0,0 +1,111 @@
Summary: sme server integration of phplist
Name: smeserver-phplist
Version: 0.2.1
Release: 4%{?dist}
License: GNU GPL version 2
URL: http://www.phplist.com
Group: SMEserver/addon
Source: %{name}-%{version}.tar.xz
BuildArchitectures: noarch
BuildRequires: e-smith-devtools
BuildRoot: /var/tmp/%{name}-%{version}
Requires: e-smith-release >= 10.0
Requires: e-smith-apache >= 2.6.0-19
Requires: phplist >= 3.6.8
Requires: smeserver-webapps-common
Requires: php80-php php80-php-mysqli php80-php-mysqlnd php80-php-pecl-mysql php80-php-curl php80-php-gd php80-php-gettext php80-php-iconv php80-php-imap php80-php-mbstring php80-php-mysqli php80-php-session php80-php-xml php80-php-zlib php80-php-mbstring php80-php-gd
#php80-php-pear-HTTP_Request
AutoReqProv: no
%description
This rpm provides all the needed templates to get phplist
running on SME Server
%changelog
* Sat Sep 07 2024 cvs2git.sh aka Brian Read <brianr@koozali.org> 0.2.1-4.sme
- Roll up patches and move to git repo [SME: 12338]
* Sat Sep 07 2024 BogusDateBot
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
by assuming the date is correct and changing the weekday.
* Wed Aug 03 2022 Jean-Philippe Pialasse <tests@pialasse.com> 0.2.1-3.sme
- make http auth not the default.
* Tue Aug 02 2022 Jean-Philippe Pialasse <tests@pialasse.com> 0.2.1-2.sme
- ported to SME10
* Wed Mar 18 2020 Daniel Berteaud <daniel@firewall-services.com> 0.2.1-1
- new package built with tito
* Wed Jul 30 2014 Daniel Berteaud <daniel@firewall-services.com> 0.2.0-1
- Nearly complete rewrite
- Change the way bounces are processed
- Add a daemon to process the queue and the bounces
- Requires phplist 3.0.6
* Fri Dec 31 2010 Daniel Berteaud <daniel@firewall-services.com> 0.1-3
- Fix typo in BouncesPassword prop name
* Thu Dec 30 2010 Daniel Berteaud <daniel@firewall-services.com> 0.1-2
- Change the way mysql permissions are applied
- Rewrite URL to force SSL for /lists/admin
- Add LemonLDAP auth support (disable basic auth)
- Add AdminUsers prop (only for basic auth)
* Mon Dec 20 2010 Daniel Berteaud <daniel@firewall-services.com> 0.1-1
- Minor templates cleanup
* Mon Dec 20 2010 Pierre Bourdin <pierre@firewall-services.com> 0.1-0.beta9
- patch to restrict admin interface with SSL + login
- Separation of the main Alias for Apache in two parts, Admin and Subscibe part
* Mon Dec 20 2010 Pierre Bourdin <pierre@firewall-services.com> 0.1-0.beta8
- patch for force SSL connection and add access variable in DB configuration
* Thu Dec 09 2010 Pierre Bourdin <pierre@firewall-services.com> 0.1-0.beta2
- patch some forgotten parameters in configuration files and add DB configuration
* Wed Dec 08 2010 Pierre Bourdin <pierre@firewall-services.com> 0.1-0.beta0
- initial release
%prep
%setup
rm -rf root/var/service/
%build
perl ./createlinks
%{__mkdir_p} root/var/lib/php/phplist/{tmp,opcache,session}
%{__mkdir_p} root/var/log/phplist
%{__mkdir_p} root/var/log/php/phplist
%install
rm -rf $RPM_BUILD_ROOT
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
rm -f %{name}-%{version}-filelist
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
--dir /var/lib/phplist 'attr(0750,www,www)' \
--dir /var/log/phplist 'attr(0750,smelog,smelog)' \
--file /var/lib/phplist/bounces.mbox 'config(noreplace) %attr(0640,www,www)' \
--file /usr/sbin/e-smith/systemd/phplist 'attr(0750,root,root)' \
--dir /var/lib/php/phplist 'attr(0755,www,www)' \
--dir /var/lib/php/phplist/tmp 'attr(0755,www,www)' \
--dir /var/lib/php/phplist/opcache 'attr(0755,www,www)' \
--dir /var/lib/php/phplist/session 'attr(0755,www,www)' \
--ignoredir /var/qmail/alias --ignoredir /var/lib/phplist \
--file /usr/local/bin/phplist 'attr(0750,root,www)' \
> %{name}-%{version}-filelist
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)
%clean
rm -rf $RPM_BUILD_ROOT
%postun
true