public function installLicense($path, $redirect = true, $includeExpired = true)
 {
     $application = new license_application($path, false, true, false, true, true);
     $results = $application->validate(false, false, "", "", "80", true);
     //if the result is ok then it is saved into DB
     $res = $results['RESULT'];
     if ($res == 'EMPTY') {
         return false;
     }
     if (!$includeExpired) {
         if ($res == 'EXPIRED') {
             return false;
         }
     }
     if ($res != 'OK' && $res != 'EXPIRED' && $res != 'TMINUS') {
         G::SendTemporalMessage('ID_ISNT_LICENSE', 'tmp-info', 'labels');
         return false;
     } else {
         G::LoadClass('serverConfiguration');
         $oServerConf =& serverConf::getSingleton();
         $oServerConf->setProperty('ACTIVE_LICENSE', array(SYS_SYS => $path));
         $this->saveDataLicense($results, $path, $redirect);
         if ($redirect) {
             G::Header('location: ../enterprise/addonsStore');
         } else {
             return true;
         }
     }
 }
예제 #2
0
include_once '../shared/class.license.lib.php';
include_once 'class.license.app.php';
# initialise the class with mcrypt off to maximise compatability with servers
$application = new license_application('license.supplied.dat', false, true, false, true);
# set the server vars
# note this doesn't have to be set, however if not all of your app files are encoded
# then there would be a possibility that the end user could modify the server vars
# to fit the key thus making it possible to use your app on any domain
# you should copy your server vars in the first line of your active script so you can
# use the unmodified copy of the vars
$application->set_server_vars($server_array);
# the key to be validated
# the key below contains the id used in the home server db. it was created like so
# $application->generate(array('_LICENSE_ID'=>1));
# validate the data from the key
$set_data = $application->validate(false, true, 'www.buggedcom.co.uk', 'http://www.buggedcom.co.uk/distributionlicense/files/server/demo.receive.license.php');
echo '<b>########################################################################</b><br />' . "\r\n";
echo '<b>Set License Key Validation Example</b><br />' . "\r\n";
echo 'The set key is validated to an id in my db on my server. It dials home to...<br />' . "\r\n";
echo '<b>########################################################################</b><br /><br />' . "\r\n";
echo '<b><span style="color: #F00">Supplied License is : ' . $set_data['RESULT'] . '</span></b><br />' . "\r\n";
if ($set_data['RESULT'] == 'OK') {
    echo '<span style="font-size: 10;color: #F00;">' . "\r\n";
    echo 'Key is valid untill : ' . $set_data['DATE']['HUMAN']['END'];
    echo '</span><br />' . "\r\n";
}
echo '<br /><b>License Key</b><br />' . "\r\n";
echo '<pre>' . file_get_contents($application->_LICENSE_PATH) . '</pre><br />' . "\r\n";
echo '<b>License Key Contents</b><br />' . "\r\n";
echo '<pre>';
# validate the key from my server
예제 #3
0
include_once '../shared/class.license.lib.php';
include_once 'class.license.app.php';
# initialise the class
# note for this demonstration script we will turn off mcrypt usage
# as some systems do not have it installed in their setup.
# the initial argument usually defaults to true (use mcrypt)
$application = new license_application('license.supplied.dat', false, true, true, true);
# set the server vars
# note this doesn't have to be set, however if not all of your app files are encoded
# then there would be a possibility that the end user could modify the server vars
# to fit the key thus making it possible to use your app on any domain
# you should copy your server vars in the first line of your active script so you can
# use the unmodified copy of the vars
$application->set_server_vars($server_array);
# the set key is the key validated for my server, when run on your box it will be illegal
$set_data = $application->validate();
echo '<b>########################################################################</b><br />' . "\r\n";
echo '<b>Set License Key Validation Example</b><br />' . "\r\n";
echo 'The <a href="license.supplied.dat" target="_blank" class="bodylink">license.supplied.dat</a> file is evaluated. If it is unwriteable the license returns with an error. It has also<br />' . "\r\n";
echo 'been validated for my server so when run on your box it will be return as illegal<br />' . "\r\n";
echo '<span style="font-size: 10;">' . "\r\n";
echo 'You should also note that even though the key is contains date restrictions the date binding<br />' . "\r\n";
echo 'was turned off when the class was inited.<br />' . "\r\n";
echo '</span>' . "\r\n";
echo '<b>########################################################################</b><br /><br />' . "\r\n";
echo '<span style="color: #F00"><b>Supplied License is : ' . $set_data['RESULT'] . '</b><br />';
if ($set_data['RESULT'] == 'OK') {
    echo '<span style="font-size: 10;">' . "\r\n";
    echo 'Key is valid untill : ' . $set_data['DATE']['HUMAN']['END'];
    echo '</span>' . "\r\n";
}
예제 #4
0
파일: demo.app.php 프로젝트: vienis/padl
include_once '../shared/class.license.lib.php';
include_once '../app/class.license.app.php';
# initialise the class
# note for this demonstration script we will turn off mcrypt usage
# as some systems do not have it installed in their setup.
# the initial argument usually defaults to true (use mcrypt)
$application = new license_application('license.dat', false, true, false, true);
# set the server vars
# note this doesn't have to be set, however if not all of your app files are encoded
# then there would be a possibility that the end user could modify the server vars
# to fit the key thus making it possible to use your app on any domain
# you should copy your server vars in the first line of your active script so you can
# use the unmodified copy of the vars
$application->set_server_vars($server_array);
# the set key is the key validated for my server, when run on your box it will be illegal
$results = $application->validate();
# make the application secure by running this function
# it also prevents any future reincarnations of the class calling any of the
# key generation and validation functions, it also deletes any class variables
# that may be set.
$application->make_secure();
# delete the $application object
# unset($application);
# import the language
include_once 'demo.app.lang.php';
# switch through the results
switch ($results['RESULT']) {
    case 'OK':
        $result = 'ok';
        $message = $LANG['LICENSE_OK'];
        break;