Exemple #1
0
 function saveLicensesAction()
 {
     $translate = DevblocksPlatform::getTranslationService();
     $settings = DevblocksPlatform::getPluginSettingsService();
     $worker = CerberusApplication::getActiveWorker();
     if (!$worker || !$worker->is_superuser) {
         echo $translate->_('common.access_denied');
         return;
     }
     @($key = DevblocksPlatform::importGPC($_POST['key'], 'string', ''));
     @($email = DevblocksPlatform::importGPC($_POST['email'], 'string', ''));
     @($do_delete = DevblocksPlatform::importGPC($_POST['do_delete'], 'integer', 0));
     if (DEMO_MODE) {
         DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'settings')));
         return;
     }
     if (!empty($do_delete)) {
         $settings->set('cerberusweb.core', CerberusSettings::LICENSE, '');
         DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'settings')));
         return;
     }
     if (empty($key) || empty($email)) {
         DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'settings', 'empty')));
         return;
     }
     if (null == ($valid = CerberusLicense::validate($key, $email)) || 5 != count($valid)) {
         DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'settings', 'invalid')));
         return;
     }
     /*
      * [IMPORTANT -- Yes, this is simply a line in the sand.]
      * You're welcome to modify the code to meet your needs, but please respect 
      * our licensing.  Buy a legitimate copy to help support the project!
      * http://www.cerberusweb.com/
      */
     $license = $valid;
     $settings->set('cerberusweb.core', CerberusSettings::LICENSE, serialize($license));
     DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'settings')));
 }