Skip to content

Commit 4be65fc

Browse files
committed
ZendTo 6.0.1
0 parents  commit 4be65fc

File tree

1,113 files changed

+176747
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,113 files changed

+176747
-0
lines changed

ChangeLog

Lines changed: 1858 additions & 0 deletions
Large diffs are not rendered by default.

GPL.txt

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

README

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Welcome to ZendTo (C) Julian Field 2020 [email protected]
2+
3+
Please start at the web site http://Zend.To/ as it contains all the
4+
documentation you need to get started. However, other documentation is
5+
included in the package you downloaded.
6+
7+
There is now an installer available from the ZendTo website which
8+
will automate the entire process of installing ZendTo onto an otherwise
9+
basically blank/minimal server running any of
10+
CentOS 6, 7 or 8
11+
RedHat Enterprise 6, 7 or 8
12+
Ubuntu 14, 16, 18 or 19
13+
Debian Server 8, 9 or 10
14+
SUSE Enterprise 12sp3 or 15
15+
openSUSE Leap 15
16+
FreeBSD 11.2 or 12
17+
It will install and configure everything it needs.
18+
I strongly advise you to use that where possible.
19+
Otherwise there are rpm, deb and tgz packages available too.
20+
21+
The configuration files are in /opt/zendto/config.
22+
23+
If you are upgrading from a previous version, run
24+
/opt/zendto/bin/upgrade
25+
as it automatea the process of upgrading your configuration.
26+
To see what it is going to do first, run it as
27+
/opt/zendto/bin/upgrade --dry-run
28+
29+
If you need to use MySQL instead of SQLite, then you will need to setup
30+
the database first, so look in the /opt/zendto/sql/ directory for help.
31+
I strongly advise you use SQLite, it is self-configuring.
32+
33+
*** NOTE ***
34+
/var/zendto and its subdirectories must be writeable by the user and
35+
group that your web server is running as!
36+
The rpm and deb packages, and the ZendTo Installer, will set it for you.
37+
*** NOTE ***
38+
39+
Please see http://Zend.To for all the other documentation, as well as
40+
all the documentation you will find in this package.
41+
42+
--
43+
Jules
44+

bin/README.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
These are various utilities for ZendTo, some of which are for
2+
maintaining the local SQL-based authentication table of users and passwords.
3+
4+
*Also* - Run the "upgrade" command to automatically upgrade your
5+
preferences.php and zendto.conf files, archiving the old and the
6+
supplied ones.
7+
8+
You can get the usage details of each script by just running it with no
9+
parameters on the command-line.
10+
11+
adduser - Add a new user to the table
12+
deleteuser - Remove a user from the table
13+
listusers - List all the details of the users (except their passwords)
14+
Run with "--help" to describe the output format
15+
setpassword - Change the password for a user
16+
unlockuser - Unlock a user who has had too many failed logins
17+
18+
addlanguage - Add a new language and its directories within ZendTo.
19+
makelanguages - Rebuild and recompile the language translations.
20+
This is needed after any change to any zendto.po files.
21+
22+
extractdropoff - Given a claim ID, extract all the files from it to the
23+
current directory. Will prompt for passphrase if needed.
24+
25+
To save you having to put the full location of the ZendTo preferences.php
26+
file in every command, you can set the shell environment variable
27+
ZENDTOPREFS instead, like this for example:
28+
export ZENDTOPREFS=/opt/zendto/config/preferences.php
29+
Then the commands will automatically find the preferences.php file.

bin/addlanguage

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
#!/usr/bin/env bash
2+
3+
# Find ZendTo top directory.
4+
# It's either set in $ZENDTOPREFS, or else it's /opt/zendto, or else
5+
# we can't find it so bail out.
6+
if [ "x$ZENDTOPREFS" != "x" ]; then
7+
ZENDTO=$( echo "$ZENDTOPREFS" | sed -e 's/\/[^\/]*$//; s/\/[^/]*$//;' )
8+
else
9+
ZENDTO=/opt/zendto
10+
fi
11+
if [ "x$ZENDTO" = "/" ] || [ "x$ZENDTO" = "/opt" ] || [ ! -d "$ZENDTO" ]; then
12+
echo "I cannot find the ZendTo directory!"
13+
exit 1
14+
fi
15+
16+
BIN="$ZENDTO/bin"
17+
CONFIG="$ZENDTO/config"
18+
LOCALE="$ZENDTO/config/locale"
19+
20+
###################################################
21+
# Work out the OS name ($OS) and version ($OSVER).
22+
# Taken from my ZendTo installer
23+
###################################################
24+
OS=unknown
25+
OSRELEASE=/etc/redhat-release
26+
if [ -f $OSRELEASE ]; then
27+
if grep -q 'Red *Hat' $OSRELEASE; then
28+
OS=redhat
29+
elif grep -q 'CentOS' $OSRELEASE; then
30+
OS=centos
31+
fi
32+
if [ -x /bin/yum -o -x /usr/bin/yum ]; then
33+
rpm -q --quiet perl || {
34+
shout Just going to install Perl...
35+
yum -y install perl
36+
}
37+
fi
38+
OSVERFULL="$( perl -pe 's/^[^\d]+([\d.]+).*?$/$1/' < $OSRELEASE )"
39+
OSVER="$( echo "$OSVERFULL" | cut -d. -f1 )"
40+
fi
41+
if [ "$OS" = "unknown" ]; then
42+
OSRELEASE=/etc/debian_version
43+
if [ -f $OSRELEASE -a -x /usr/bin/lsb_release ]; then
44+
# Should give me the string "ubuntu" or "debian"
45+
OS="$( lsb_release --id | sed -e 's/^.*:\s*//' | tr '[:upper:]' '[:lower:]' )"
46+
OSVER="$( lsb_release --release | sed -e 's/^.*:\s*\([0-9]*\)\..*$/\1/' )"
47+
fi
48+
fi
49+
if [ "$OS" = "unknown" ]; then
50+
if [ -x /usr/bin/lsb_release ]; then
51+
# Should give me the string "suse" or similar
52+
OS="$( lsb_release --id | sed -e 's/^.*:\s*//' | tr '[:upper:]' '[:lower:]' )"
53+
OSVER="$( lsb_release --release | sed -e 's/^.*:\s*\([0-9]*\)\..*$/\1/' )"
54+
# But we need to tell between suse (i.e. sles) and opensuse
55+
if [ "x$OS" = "xsuse" ]; then
56+
OS='sles'
57+
fi
58+
elif [ -f /etc/os-release ]; then
59+
# I can just source that file, but that's dangerous
60+
OSID="$( grep '^ID=' /etc/os-release | head -1 | sed -e 's/#.*$//; s/ *$//; s/^ID="*\([^"]*\)"*/\1/;' )"
61+
if [[ $OSID =~ sles ]]; then
62+
OS='sles'
63+
elif [[ $OSID =~ opensuse ]]; then
64+
OS='opensuse'
65+
elif [[ $OSID =~ debian ]]; then
66+
OS='debian'
67+
fi
68+
OSVER="$( grep '^VERSION_ID=' /etc/os-release | head -1 | sed -e 's/#.*$//; s/ *$//; s/^VERSION_ID="*\([^"]*\)"*/\1/; s/\..*$//;' )"
69+
fi
70+
fi
71+
72+
OS="$(echo "$OS" | tr '[:upper:]' '[:lower:]')" # Lower-case it
73+
74+
###################################################
75+
76+
L="$1"
77+
BAILOUT="$2"
78+
79+
if [ "x$L" = "x" ]; then
80+
echo
81+
echo You need to supply a valid language code on the command-line,
82+
echo such as en_US or fr_FR or similar.
83+
echo "Do not put anything like '.utf-8' on the end,"
84+
echo as everything is done in utf-8 anyway.
85+
echo
86+
if [ "x$OS" = "xredhat" ] || [ "x$OS" = "xcentos" ]; then
87+
echo To see the codes valid on your system, run the command
88+
echo ' locale -a'
89+
echo
90+
fi
91+
exit 1
92+
fi
93+
94+
if echo "$L" | fgrep -q .; then
95+
echo 'Do you *really* need the "." and whatever is after it?'
96+
echo "I'm going to wait for 10 seconds so you can press Ctrl-C"
97+
echo "and try again without it."
98+
sleep 10
99+
echo
100+
fi
101+
102+
echo
103+
if locale -a | grep -q '^'"$L"'$'; then
104+
echo Adding $L as a valid language code.
105+
elif [ "x$OS" = "xubuntu" ] || [ "x$OS" = "xdebian" ]; then
106+
echo Adding the locale for you.
107+
if [ "x$OS" = "xdebian" -a "$OSVER" -ge "9" ]; then
108+
# On Debian 9 we have to __manually edit__ /etc/locale.gen,
109+
# then run locale-gen with no command-line parameters!!!
110+
# WTF ???
111+
if grep -q '^'$L' ' /etc/locale.gen; then
112+
# It's already there, no need to tweak locale-gen
113+
:
114+
else
115+
# Uncomment the line in locale.gen that is the code we want
116+
# Create lots of backups!
117+
sed -i.bak."$L" -e 's/^# *\('"$L"' .*\)$/\1/' /etc/locale.gen
118+
fi
119+
locale-gen
120+
else
121+
locale-gen "$L"
122+
fi
123+
else
124+
echo Sorry, that is not a valid language code on your system.
125+
echo To see the codes valid on your system, run the command
126+
echo ' locale -a'
127+
echo On some operating systems, you may need to install additional
128+
echo software packages to add extra languages.
129+
echo
130+
exit 1
131+
fi
132+
133+
if [ ! -f "$LOCALE/$L/LC_MESSAGES/zendto.po" ]; then
134+
mkdir -p "$LOCALE/$L"
135+
echo And now about to copy the translation source into
136+
echo "$LOCALE/$L/LC_MESSAGES/zendto.po"
137+
echo so you can start adding your own translations.
138+
echo
139+
echo Pausing for 10 secs...
140+
sleep 10
141+
fi
142+
143+
# Only do the makelanguages if they have *not* put a 2nd arg on the command.
144+
# The deb postinst file calls this with NO en the end to save duplicating
145+
# this code.
146+
[ "x$BAILOUT" = "x" ] && "$BIN"/makelanguages
147+
148+
exit 0

bin/adduser

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/usr/bin/env php
2+
<?PHP
3+
4+
if (count($argv)==5 && getenv('ZENDTOPREFS')) {
5+
array_splice($argv, 1, 0, getenv('ZENDTOPREFS'));
6+
}
7+
8+
if ( count($argv) != 6 ) {
9+
$prefs=getenv('ZENDTOPREFS');
10+
if ($prefs=='') {
11+
printf("
12+
usage:
13+
14+
%s <ZendTo preferences.php file> '<username>' '<email>' '<realname>' '<organization>'
15+
16+
The ZendTo preferences.php file path should be canonical, not relative.
17+
(It must start with a \"/\")
18+
Alternatively, do
19+
export ZENDTOPREFS=<full file path of preferences.php>
20+
%s '<username>' '<email>' '<realname>' '<organization>'
21+
22+
",$argv[0],$argv[0]);
23+
} else {
24+
printf("
25+
usage:
26+
27+
%s '<username>' '<email>' '<realname>' '<organization>'
28+
29+
The ZendTo preferences.php file path is pointed to by the environment
30+
variable ZENDTOPREFS, which is currently set to
31+
%s
32+
33+
",$argv[0],$prefs);
34+
}
35+
return 0;
36+
}
37+
38+
if ( ! preg_match('/^\/.+/',$argv[1]) ) {
39+
echo "ERROR: You must provide a canonical path to the preference file.\n";
40+
return 1;
41+
}
42+
43+
include $argv[1];
44+
require_once(NSSDROPBOX_LIB_DIR."Smartyconf.php");
45+
include_once(NSSDROPBOX_LIB_DIR."NSSDropoff.php");
46+
47+
if ( $theDropbox = new NSSDropbox($NSSDROPBOX_PREFS, TRUE) ) {
48+
49+
$username = strtolower($argv[2]);
50+
$email = $argv[3];
51+
$realname = $argv[4];
52+
$org = $argv[5];
53+
//$quota = $argv[6];
54+
55+
$password = readPassword('Enter password for new user: ');
56+
$confirm = readPassword('And again to confirm: ');
57+
if ($password !== $confirm) {
58+
echo "\nERROR: Entered passwords did not match.\n";
59+
return 1;
60+
}
61+
62+
if (!strpos($email, '@')) {
63+
echo "\nWARNING: You supplied an email address that did not contain an '@'.\n";
64+
echo "WARNING: Note the new syntax where the password is not on the command-line.\n";
65+
}
66+
67+
$result = $theDropbox->database->DBAddLocalUser($username, $password,
68+
$email, $realname, $org);
69+
70+
// To save newbies trouble, if they are using SQLite (any version)
71+
// then force the ownership of the SQLite database back to that of
72+
// the web server if it has become owned by root.
73+
// This happens when people create a new local user, before they
74+
// forced the web server to create the database file by displaying
75+
// the app's home page in a browser.
76+
if (preg_match('/^SQLite/', SqlBackend)) {
77+
$sqlite = $NSSDROPBOX_PREFS['SQLiteDatabase'];
78+
$oldowner = fileowner($sqlite);
79+
$oldgroup = filegroup($sqlite);
80+
if ($oldowner == 0 || $oldgroup == 0) {
81+
$newowner = fileowner($NSSDROPBOX_PREFS['dropboxDirectory']);
82+
$newgroup = filegroup($NSSDROPBOX_PREFS['dropboxDirectory']);
83+
chown($sqlite, $newowner);
84+
chgrp($sqlite, $newgroup);
85+
}
86+
}
87+
88+
if ($result == '') {
89+
$passprint = 'secret';
90+
if ($password == '') {
91+
$passprint = 'WARNING: No password!';
92+
}
93+
printf("Created user:\n");
94+
printf("Username: $username\n");
95+
printf("Password: ($passprint)\n");
96+
printf("Email: $email\n");
97+
printf("Real name: $realname\n");
98+
printf("Organization: $org\n");
99+
//if (preg_match('/^[yYtT1]/', MYZENDTO)) {
100+
// printf("Quota: $quota\n");
101+
//}
102+
return 0;
103+
} else {
104+
printf("Failed: $result\n");
105+
return 1;
106+
}
107+
}
108+
109+
?>

0 commit comments

Comments
 (0)