コード例 #1
0
ファイル: editors.php プロジェクト: ejailesb/repo_empr
 function save_settings()
 {
     $result = parent::_save_settings('editors');
     if ($result) {
         $this->Session->setFlash('success', l_('SAVE_SUCCESS'));
     } else {
         $this->Session->setFlash('error', l_('SAVE_ERROR'));
     }
     $this->redirect('index.php?ext=editors&act=settings');
 }
コード例 #2
0
 function validateinstall()
 {
     $domain = str_replace(array('http://', 'https://'), '', \GCore\Libs\Url::domain());
     $this->set('domain', $domain);
     if (!empty($this->data['license_key'])) {
         $session = \GCore\Libs\Base::getSession();
         $fields = '';
         $update_fld = 'validated';
         if ($this->data['pid'] == 18) {
             $update_fld = 'validated_paypal';
         }
         if ($this->data['pid'] == 7) {
             $update_fld = 'validated_authorize';
         }
         if ($this->data['pid'] == 31) {
             $update_fld = 'validated_2checkout';
         }
         //$postfields = array();
         unset($this->data['option']);
         unset($this->data['act']);
         foreach ($this->data as $key => $value) {
             $fields .= "{$key}=" . urlencode($value) . "&";
         }
         $target_url = 'http://www.chronoengine.com/index.php?option=com_chronocontact&task=extra&chronoformname=validateLicense';
         $output = '-';
         if (ini_get('allow_url_fopen')) {
             $output = file_get_contents($target_url . '&' . rtrim($fields, "& "));
         } else {
             if (function_exists('curl_version')) {
                 $ch = curl_init();
                 curl_setopt($ch, CURLOPT_URL, $target_url);
                 curl_setopt($ch, CURLOPT_HEADER, 0);
                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                 curl_setopt($ch, CURLOPT_TIMEOUT, 10);
                 curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim($fields, "& "));
                 $output = curl_exec($ch);
                 curl_close($ch);
             }
         }
         if ($output == '-') {
             $session->setFlash('error', 'Validation error, Could not connect to the remote server, your host does not have neither the CURL nor the allow_url_fopen.');
             $this->redirect(r_('index.php?ext=chronoforms'));
         }
         $validstatus = $output;
         if ($validstatus == 'valid') {
             parent::_settings('chronoforms');
             $this->data['Chronoforms'][$update_fld] = 1;
             $result = parent::_save_settings('chronoforms');
             if ($result) {
                 $session->setFlash('success', 'Validated successfully.');
                 $this->redirect(r_('index.php?ext=chronoforms'));
             } else {
                 $session->setFlash('error', 'Validation error.');
             }
         } else {
             if ($validstatus == 'invalid') {
                 parent::_settings('chronoforms');
                 $this->data['Chronoforms'][$update_fld] = 0;
                 $result = parent::_save_settings('chronoforms');
                 $session->setFlash('error', 'Validation error, you have provided incorrect data.');
                 $this->redirect(r_('index.php?ext=chronoforms'));
             } else {
                 if (!empty($this->data['instantcode'])) {
                     $step1 = base64_decode(trim($this->data['instantcode']));
                     $step2 = str_replace(substr(md5(str_replace('www.', '', strtolower($matches[2]))), 0, 7), '', $step1);
                     $step3 = str_replace(substr(md5(str_replace('www.', '', strtolower($matches[2]))), -strlen(md5(str_replace('www.', '', strtolower($matches[2])))) + 7), '', $step2);
                     $step4 = str_replace(substr($this->data['license_key'], 0, 10), '', $step3);
                     $step5 = str_replace(substr($this->data['license_key'], -strlen($this->data['license_key']) + 10), '', $step4);
                     //echo (int)$step5;return;
                     //if((((int)$step5 + (24 * 60 * 60)) > strtotime(date('d-m-Y H:i:s')))||(((int)$step5 - (24 * 60 * 60)) < strtotime(date('d-m-Y H:i:s')))){
                     if ((int) $step5 < strtotime("now") + 24 * 60 * 60 and (int) $step5 > strtotime("now") - 24 * 60 * 60) {
                         parent::_settings('chronoforms');
                         $this->data['Chronoforms'][$update_fld] = 1;
                         $result = parent::_save_settings('chronoforms');
                         if ($result) {
                             $session->setFlash('success', 'Validated successfully.');
                             $this->redirect(r_('index.php?ext=chronoforms'));
                         } else {
                             $session->setFlash('error', 'Validation error.');
                         }
                     } else {
                         $session->setFlash('error', 'Validation error, Invalid instant code provided.');
                         $this->redirect(r_('index.php?ext=chronoforms'));
                     }
                 } else {
                     if (!empty($this->data['serial_number'])) {
                         $blocks = explode("-", trim($this->data['serial_number']));
                         $hash = md5($this->data['pid'] . $this->data['license_key'] . str_replace('www.', '', $domain) . $blocks[3]);
                         if (substr($hash, 0, 7) == $blocks[4]) {
                             parent::_settings('chronoforms');
                             $this->data['Chronoforms'][$update_fld] = 1;
                             $result = parent::_save_settings('chronoforms');
                             if ($result) {
                                 $session->setFlash('success', 'Validated successfully.');
                                 $this->redirect(r_('index.php?ext=chronoforms'));
                             } else {
                                 $session->setFlash('error', 'Validation error.');
                             }
                         } else {
                             $session->setFlash('error', 'Serial number invalid!');
                         }
                     }
                     $session->setFlash('error', 'Validation error, please try again using the Instant Code, or please contact us on www.chronoengine.com');
                     $this->redirect(r_('index.php?ext=chronoforms'));
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: lists.php プロジェクト: BillVGN/PortalPRP
 function delete()
 {
     $this->delete_model = $this->pmodel;
     parent::_delete();
     $this->redirect(r_('index.php?ext=chronoconnectivity&cont=lists&act=index&ccname=' . $this->connection['Connection']['title']));
 }