Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
whmcs-coza-epp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
awit-whmcs
whmcs-coza-epp
Commits
6f5080d3
Commit
6f5080d3
authored
9 years ago
by
Liam
Browse files
Options
Downloads
Patches
Plain Diff
The module requires consistant account passwords
parent
36e6c5f0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!30
The module requires that account passwords be consistent across all SLD servers
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/cozaepp-cli
+159
-0
159 additions, 0 deletions
contrib/cozaepp-cli
with
159 additions
and
0 deletions
contrib/cozaepp-cli
0 → 100755
+
159
−
0
View file @
6f5080d3
#!/usr/bin/env php
<?php
# Copyright (c) 2012-2013, AllWorldIT
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Official Website:
# http://devlabs.linuxassist.net/projects/whmcs-coza-epp
# Lead developer:
# Nigel Kukard <nkukard@lbsd.net>
# ! ! P L E A S E N O T E ! !
# * If you make changes to this file, please consider contributing
# anything useful back to the community. Don't be a sour prick.
# * If you find this module useful please consider making a
# donation to support modules like this.
# WHMCS hosting, theming, module development, payment gateway
# integration, customizations and consulting all available from
# http://allworldit.com
# ! ! CONFIGURATION REQUIRED ! !
# Set the path below to the dbconnect.php file of your WHMCS installation.
$dbconnpath
=
dirname
(
__FILE__
)
.
'/../dbconnect.php'
;
# Internals
$_help
=
<<<EOD
usage: {$argv[0]} [--help|-h] <command> [<args>]
Available commands are:
changepassword Change ZACR account password.
EOD;
$_setup
=
<<<EOD
This script requires you to specify the path to the dbconnect.php file in your WHMCS installation.
Open the file and change the variable \$dbconnpath to suit your environment.
{$_help}
EOD;
// Validate dbconnpath
if
(
!
file_exists
(
$dbconnpath
))
{
die
(
$_setup
);
}
// This file brings in a few constants we need
require_once
$dbconnpath
;
// Setup include dir
$include_path
=
ROOTDIR
.
'/modules/registrars/cozaepp'
;
set_include_path
(
$include_path
.
PATH_SEPARATOR
.
get_include_path
());
// Include EPP stuff we need
require_once
'cozaepp.php'
;
if
(
!
function_exists
(
'_cozaepp_Client'
))
{
die
(
$_setup
);
}
// Additional functions we need
require_once
ROOTDIR
.
'/includes/functions.php'
;
// Include registrar functions aswell
require_once
ROOTDIR
.
'/includes/registrarfunctions.php'
;
function
changePassword
(
$sld
,
$current_password
,
$new_password
)
{
// Grab module parameters
$params
=
getregistrarconfigoptions
(
'cozaepp'
);
try
{
$client
=
_cozaepp_Client
(
$sld
);
$result
=
$client
->
request
(
'
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<login>
<clID>'
.
$params
[
'Username'
]
.
'</clID>
<pw>'
.
$current_password
.
'</pw>
<newPW>'
.
$new_password
.
'</newPW>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
</svcs>
</login>
</command>
</epp>'
);
$doc
=
new
DOMDocument
();
$doc
->
loadXML
(
$result
);
$coderes
=
$doc
->
getElementsByTagName
(
'result'
)
->
item
(
0
)
->
getAttribute
(
'code'
);
$msg
=
$doc
->
getElementsByTagName
(
'msg'
)
->
item
(
0
)
->
nodeValue
;
if
(
$coderes
!=
'1000'
)
{
$values
[
"error"
]
=
"ChangePassword(
$sld
): Code (
$coderes
)
$msg
"
;
return
$values
;
}
$values
[
'status'
]
=
$msg
;
}
catch
(
Exception
$e
)
{
$values
[
"error"
]
=
'changePassword/EPP: '
.
$e
->
getMessage
();
return
$values
;
}
return
$values
;
}
$_command
=
strtolower
(
$argv
[
1
]);
switch
(
$_command
)
{
case
'changepassword'
:
if
(
empty
(
$argv
[
'2'
])
||
empty
(
$argv
[
'3'
])
||
empty
(
$argv
[
'4'
]))
{
echo
"
\033
[1;31mError: changepassword expects 3 arguments.
\033
[1;0m
\n\n
"
;
echo
"
{
$argv
[
0
]
}
changepassword <sld> <current password> <new password>
\n\n
"
;
exit
(
1
);
}
$res
=
changePassword
(
$argv
[
'2'
],
$argv
[
'3'
],
$argv
[
'4'
]);
break
;
case
'-h'
:
case
'--help'
:
case
'help'
:
default
:
echo
$_help
;
break
;
}
if
(
is_array
(
$res
))
{
if
(
array_key_exists
(
'error'
,
$res
))
{
echo
$res
[
'error'
];
exit
(
2
);
}
elseif
(
array_key_exists
(
'status'
,
$res
))
{
echo
$res
[
'status'
];
exit
(
0
);
}
}
else
{
echo
"
\033
[1;31mError: Unexpected result from command call
\033
[1;0m
\n\n
"
;
var_dump
(
$res
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment