Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Philipp
phplib_mystic
Commits
bdab66b9
Commit
bdab66b9
authored
Mar 12, 2019
by
Philipp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Mystic 1.12 compatibility as default (1.11 via parameter)
parent
f2b70698
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
196 additions
and
62 deletions
+196
-62
mystic_library.php
mystic_library.php
+196
-62
No files found.
mystic_library.php
View file @
bdab66b9
...
...
@@ -7,8 +7,8 @@
* @author $Author: stimpy $
* @originalauthor $Originalauthor: frank $
* @copyright $Copyright 2011 Frank Linhares/netsurge%demonic%bbs-scene.org$
* @version $Revision: 1
0
$
* @lastrevision $Date: 201
7
-12
-
11
15:40
:17 +0100 (
Mon, 11 Dec
201
7
) $
* @version $Revision: 1
1
$
* @lastrevision $Date: 201
9-03
-12
11
:37
:17 +0100 (
Tue, 12 Mar
201
9
) $
* @modifiedby $LastChangedBy: stimpy $
* @filesource $URL: http://miserybbs.com/svn/miserybbs/scripts/mystic_library.php $
* @modifiedsource $URL: https://gitlab.ambhost.net/stimpy/phplib_mystic $
...
...
@@ -26,7 +26,8 @@
*
* This library was originaly written for MysticBBS v1.09 by Frank Linhares
* in 2011 and updated to MysticBBS 1.11 and object oriented by
* Philipp Giebel in 2017.
* Philipp Giebel in 2017, finally updated to MysticBBS v1.12 in 2019 by
* Philipp Giebel again.
* This is still work in progres - all the functions are at various states of
* decay - some are pretty foolproof and up-to-date, some are barely running
* at all.. Just try it out yourself and don't blame me, if your cat blows up..
...
...
@@ -36,7 +37,11 @@
* include 'inc/mystic_library.php';
*
* Initialize class like this:
* $mystic = new mystic('/path/to/your/datafiles/');
* $mystic = new mystic('/path/to/your/datafiles/', <mystic version>);
* eg:
* $mystic = new mystic('/mystic/data/', 1.12);
*
* supported mystic versions: 1.11 and 1.12
*
* Official support for mystic_php_library could once be found at the official
* support bbs, miserybbs.com
...
...
@@ -50,14 +55,22 @@
class
mystic
{
private
$data_path
=
'./'
;
function
__construct
(
$data_path
)
{
private
$version
=
1.12
;
function
__construct
(
$data_path
,
$version
=
1.12
)
{
$this
->
setDatapath
(
$data_path
);
$this
->
setVersion
(
$version
);
}
function
__destruct
()
{
}
function
setDatapath
(
$data_path
)
{
$this
->
data_path
=
$data_path
;
}
function
setVersion
(
$version
)
{
$this
->
version
=
$version
;
}
function
getVersion
()
{
return
$this
->
version
;
}
/**
* read and parse last 10 callers from Mystic
...
...
@@ -324,7 +337,77 @@
$bases
=
NULL
;
if
(
$number
>
10
)
$number
=
10
;
$record_length
=
495
;
if
(
$this
->
version
>=
1.12
)
{
$record_length
=
640
;
$data_format
=
'Sindex/'
.
'Cnamelen/'
.
'A60name/'
.
'Cftpnamelen/'
.
'A60ftpname/'
.
'Cfilenamelen/'
.
'A40filename/'
.
'Cdispfilelen/'
.
'A20dispfile/'
.
'Ctemplatelen/'
.
'A20template/'
.
'Clistacslen/'
.
'A30listacs/'
.
'Cftpacslen/'
.
'A30ftpacs/'
.
'Cdlacslen/'
.
'A30dlacs/'
.
'Culacslen/'
.
'A30ulacs/'
.
'Chatchacslen/'
.
'A30hatchacs/'
.
'Csysopacslen/'
.
'A30sysopacs/'
.
'Cpasseacslen/'
.
'A30passeacs/'
.
'Cpathlen/'
.
'A80path/'
.
'Cdefscan/'
.
'lflags/'
.
'lcreated/'
.
'C1netaddr/'
.
'C1echotaglen/'
.
'A30echotag/'
.
'Clisteacslen/'
.
'A30listeacs/'
;
}
else
{
$record_length
=
495
;
$data_format
=
'Sindex/'
.
'Cnamelen/'
.
'A40name/'
.
'Cftpnamelen/'
.
'A60ftpname/'
.
'Cfilenamelen/'
.
'A40filename/'
.
'Cdispfilelen/'
.
'A20dispfile/'
.
'Ctemplatelen/'
.
'A20template/'
.
'Clistacslen/'
.
'A30listacs/'
.
'Cftpacslen/'
.
'A30ftpacs/'
.
'Cdlacslen/'
.
'A30dlacs/'
.
'Culacslen/'
.
'A30ulacs/'
.
'Ccommentacslen/'
.
'A30commentacs/'
.
'Csysopacslen/'
.
'A30sysopacs/'
.
'Cpathlen/'
.
'A80path/'
.
'Cdefscan/'
.
'lflags/'
.
'lcreated/'
.
'C1netaddr/'
.
'C1echotaglen/'
.
'A30echotag/'
;
}
$fp
=
fopen
(
$this
->
data_path
.
'fbases.dat'
,
'r'
);
if
(
$start
>
0
)
{
...
...
@@ -335,40 +418,6 @@
for
(
$i
=
0
;
$i
<
$number
;
$i
++
)
{
$data
=
fread
(
$fp
,
$record_length
);
if
(
$data
!=
false
)
{
// Create a data structure
$data_format
=
'Sindex/'
.
'Cnamelen/'
.
'A40name/'
.
'Cftpnamelen/'
.
'A60ftpname/'
.
'Cfilenamelen/'
.
'A40filename/'
.
'Cdispfilelen/'
.
'A20dispfile/'
.
'Ctemplatelen/'
.
'A20template/'
.
'Clistacslen/'
.
'A30listacs/'
.
'Cftpacslen/'
.
'A30ftpacs/'
.
'Cdlacslen/'
.
'A30dlacs/'
.
'Culacslen/'
.
'A30ulacs/'
.
'Ccommentacslen/'
.
'A30commentacs/'
.
'Csysopacslen/'
.
'A30sysopacs/'
.
'Cpathlen/'
.
'A80path/'
.
'Cdefscan/'
.
'lflags/'
.
'lcreated/'
.
'C1netaddr/'
.
'C1echotaglen/'
.
'A30echotag/'
;
// Unpack the data structure
$bases
[]
=
unpack
(
$data_format
,
$data
);
}
}
...
...
@@ -638,27 +687,95 @@
// get file size in order to determine how many records are stored
$filesize
=
filesize
(
$this
->
data_path
.
'users.dat'
);
$record_length
=
1536
;
// divide file size by record length to determine number of records stored
$record_number
=
$filesize
/
$record_length
;
if
(
$start
>
$record_number
)
return
false
;
if
(
$start
+
$number
>
$record_number
)
$number
=
$record_number
-
$start
;
// Open the mystic BBS data file in binary mode
$fp
=
fopen
(
$this
->
data_path
.
'users.dat'
,
'rb'
);
if
(
$start
>
0
)
{
if
(
$start
*
$record_length
>
filesize
(
$this
->
data_path
.
'users.dat'
)
)
return
false
;
fseek
(
$fp
,
$start
*
$record_length
);
}
for
(
$i
=
0
;
$i
<
$number
;
$i
++
)
{
$data
=
fread
(
$fp
,
$record_length
);
/* Create a data structure */
if
(
$this
->
version
>=
1.12
)
{
$record_length
=
1536
;
$data_format
=
'lpermidx/'
.
# Get the permission index
'lflags/'
.
# Get the flags (longint)
'Cpasswordlen/'
.
# Get the length of the password field
'A100password/'
.
# Get the password (100)
'Chandlelen/'
.
# Get the length of the handle field
'A30handle/'
.
# Get the handle (30) padded with null
'Crealnamelen/'
.
# Get the length of the realname field
'A30realname/'
.
# Get the real name (30) padded with null
'Caddresslen/'
.
# Get the length of the address field
'A30address/'
.
# Get the address (30) padded with null
'Ccitylen/'
.
# Get the length of the city field
'A25city/'
.
# Get the city (25) padded with null
'Czipcodelen/'
.
# Get the length of the zipcode field
'A9zipcode/'
.
# Get the zipcode (9) padded with null
'Chomephonelen/'
.
# Get the length of the homephone field
'A15homephone/'
.
# Get the home phone (15) padded with null
'Cdataphonelen/'
.
# Get the length of the dataphone field
'A15dataphone/'
.
# Get the dataphone (15) padded with null
'lbdate/'
.
# Get the birth date
'Agender/'
.
# Get the gender (m for male f for female)
'Cemaillen/'
.
# Get the length of the email field
'A60email/'
.
# Get the email address (60) padded with null
'Copt1len/'
.
# Get the length of the opt1 field
'A60opt1/'
.
# Get the opt1 field (60) padded with null
'Copt2len/'
.
# Get the length of the opt2 field
'A60opt2/'
.
# Get the opt2 field (60) padded with null
'Copt3len/'
.
# Get the length of the opt3 field
'A60opt3/'
.
# Get the opt3 field (60) padded with null
'Copt4len/'
.
# Get the length of the opt3 field
'A60opt4/'
.
# Get the opt4 field (60) padded with null
'Copt5len/'
.
# Get the length of the opt3 field
'A60opt5/'
.
# Get the opt5 field (60) padded with null
'Copt6len/'
.
# Get the length of the opt3 field
'A60opt6/'
.
# Get the opt6 field (60) padded with null
'Copt7len/'
.
# Get the length of the opt3 field
'A60opt7/'
.
# Get the opt7 field (60) padded with null
'Copt8len/'
.
# Get the length of the opt3 field
'A60opt8/'
.
# Get the opt8 field (60) padded with null
'Copt9len/'
.
# Get the length of the opt3 field
'A60opt9/'
.
# Get the opt9 field (60) padded with null
'Copt10len/'
.
# Get the length of the opt3 field
'A60opt10/'
.
# Get the opt10 field (60) padded with null
'Cinfolen/'
.
# Get the length of the info field
'A30info/'
.
# Get the usernote (30) padded with null
'Cthemelen/'
.
'A20theme/'
.
'A8foo/'
.
'Csecurity/'
.
'lexpires/'
.
'Cexpiresto/'
.
'Clastpwchangelen/'
.
'llastpwchange/'
.
'Cstartmenulen/'
.
'A20startmenu/'
.
'Carchivelen/'
.
'A4archive/'
.
'Cqwkfiles/'
.
'Cdatetype/'
.
'Cscreensize/'
.
'Cscreencols/'
.
'Cpeeriplen/'
.
'A45peerip/'
.
'Cpeerhostlen/'
.
'A80peerhost/'
.
'Cpeercountrylen/'
.
'A60peercountry/'
.
'lfirston/'
.
# Get the first on date
'llaston/'
.
# Get the last on date
'lcalls/'
.
# Get the number of calls
'scallstoday/'
.
# Get the # of calls today
'sdls/'
.
# Get the # of downloads
'sdlstoday/'
.
# Get the # of downloads today
'ldlk/'
.
# Get the total downloads in k
'ldlktoday/'
.
# Get the total downloads in k today
'luls/'
.
# Get the total # of uploads
'lulk/'
.
# Get the total uploads in k
'lposts/'
.
# Get the total posts
'lemails/'
.
# Get the total sent emails
'ltimeleft/'
.
# Get the amount of time left today
'stimebank/'
.
'Clastfbase/'
.
'Clastmbase/'
.
'Clastmgroup/'
.
'Clastfgroup/'
;
}
else
{
$record_length
=
1536
;
$data_format
=
'lpermidx/'
.
# Get the permission index
'lvalidated/'
.
# Get the flags (longint)
'Chandlelen/'
.
# Get the length of the handle field
...
...
@@ -740,8 +857,25 @@
'Clastfgroup/'
.
'Clastmbase/'
.
'Clastmgroup/'
;
}
// divide file size by record length to determine number of records stored
$record_number
=
$filesize
/
$record_length
;
if
(
$start
>
$record_number
)
return
false
;
if
(
$start
+
$number
>
$record_number
)
$number
=
$record_number
-
$start
;
// Open the mystic BBS data file in binary mode
$fp
=
fopen
(
$this
->
data_path
.
'users.dat'
,
'rb'
);
/* Unpack the data structure */
if
(
$start
>
0
)
{
if
(
$start
*
$record_length
>
filesize
(
$this
->
data_path
.
'users.dat'
)
)
return
false
;
fseek
(
$fp
,
$start
*
$record_length
);
}
for
(
$i
=
0
;
$i
<
$number
;
$i
++
)
{
$data
=
fread
(
$fp
,
$record_length
);
$users
[]
=
unpack
(
$data_format
,
$data
);
}
...
...
@@ -847,4 +981,4 @@
return
$input
;
}
}
?>
\ No newline at end of file
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment