Beispiel #1
0
 function run()
 {
     global $_out, $_sec;
     if (ap::isCurrentModule($this)) {
         ap::addMessage($this->getMessage());
         if ($form = $this->getForm()) {
             $form->replaceURI(array('ID' => $_sec->getId(), 'MD' => $this->getId(), 'PARENT' => $this->getSection()->GetParent()->getId()));
             switch ($action = param('action')) {
                 case 'save':
                     $values = $this->initImages($form, true);
                     $values = array_merge($_REQUEST, $values);
                     $form->save($values);
                     $this->updateImagesSize($form);
                     $this->redirect('save_ok');
                     break;
                 case 'fileinfo':
                     if (($path = urldecode(param('path'))) && ($f = ap::getFileInfo($_SERVER['DOCUMENT_ROOT'] . $path))) {
                         $f['path'] = $path;
                         $xml = new xml(null, 'file', false);
                         foreach ($f as $tagName => $value) {
                             $xml->de()->appendChild($xml->createElement($tagName, null, $value));
                         }
                         ap::ajaxResponse($xml);
                     }
                     vdump('Error file not found ' . $path);
                     break;
             }
             $this->initImages($form, false);
             $form->load();
             $_out->elementIncludeTo($form->getRootElement(), '/page/section');
         } else {
             throw new Exception('Form not found', EXCEPTION_XML);
         }
     }
 }
Beispiel #2
0
 function wait()
 {
     $this->log("Waiting...");
     $r = array();
     $w = array();
     foreach ($this->queue as $q) {
         $r[] &= $q->obj;
         if ($q->has_outgoing()) {
             $w[] &= $q->obj;
         }
     }
     foreach ($this->listeners as $s) {
         $r[] = $s;
     }
     //if(!count($w)) $w = NULL;
     //if(!count($r)) $r = NULL;
     //if(is_null($r) and is_null($w)) return FALSE;
     $this->log("Readers: " . vdump($r));
     $this->log("Writers: " . vdump($w));
     $v = socket_select($r, $w, $e = NULL, 120);
     $this->log("v = {$v}");
     if ($v == 0) {
         $this->terminate();
     }
     if ($w) {
         $this->do_queue_writes($w);
     }
     if ($r) {
         foreach ($r as $s) {
             $this->log("Event on {$s}");
             if ($this->listeners[(string) $s]) {
                 $this->log("Accepting client on {$s}");
                 $this->accept($s);
             } elseif (isset($this->queue[(string) $s])) {
                 $in = socket_read($s, 1024);
                 $this->log("Read {$in} from {$s}");
                 if ($in) {
                     $this->queue[(string) $s]->recv($in);
                     $this->event('socket', $this->queue[(string) $s]);
                 } else {
                     switch (socket_last_error()) {
                         case 11:
                             continue;
                         default:
                             $this->error($s, socket_strerror(socket_last_error()));
                         case 0:
                         case 32:
                         case 107:
                             if ($in === FALSE) {
                                 $this->removesocket($s);
                             }
                             $this->signal($s, 'Closed Connection');
                     }
                 }
             } else {
                 $this->log("Bogus socket: {$s}");
             }
         }
     }
 }
Beispiel #3
0
 public function __toString()
 {
     try {
         return $this->process();
     } catch (\Exception $e) {
         vdump($e);
     }
 }
Beispiel #4
0
 function getConf($name, $required = false)
 {
     $v = $this->evaluate('string(config/@' . $name . ')');
     if (!$v && $required) {
         vdump('No ' . $name . ' has been chosen');
     }
     return $v;
 }
Beispiel #5
0
 function getConf($name, $required = false)
 {
     $xml = new xml(PATH_ROOT . ABS_PATH_DATA_CLIENT . ap::id($this->getSection()->getId()) . '.xml');
     $v = $xml->evaluate('string(/section/modules/module[@id="' . $this->getId() . '"]/config/@' . $name . ')');
     if (!$v && $required) {
         vdump('No ' . $name . ' has been chosen');
     }
     return $v;
 }
Beispiel #6
0
 function run()
 {
     if (ap::isCurrentModule($this)) {
         switch ($this->getAction()) {
             case 'bannersize':
                 if (($path = urldecode(param('path'))) && is_file($path)) {
                     list($width, $height) = getimagesize($path);
                     $xml = new xml(null, 'size', false);
                     $xml->de()->setAttribute('width', $width);
                     $xml->de()->setAttribute('height', $height);
                     ap::ajaxResponse($xml);
                 }
                 vdump('Error file not found ' . $path);
                 break;
         }
     }
     parent::run();
 }
Beispiel #7
0
 public function __construct($path, $vars = array())
 {
     $this->pipeline = Pipeline::getCurrentInstance();
     $this->locator = $this->pipeline->getLocator();
     $this->path = trim(trim($path, '/'), '\\');
     $this->directory = '.' === ($dirname = dirname($path)) ? '' : $dirname;
     $this->vars = $vars;
     $this->file = basename($path);
     list($this->name, $this->type, $i) = $this->locator->getNameAndExtension($this->file);
     $this->path_with_simple_filename = ('' === $this->directory ? '' : $this->directory . '/') . $this->name;
     $this->filepath = $this->locator->getFile($this->path_with_simple_filename, $this->type);
     $this->full_filename = basename($this->filepath);
     if (!$this->type) {
         vdump($this->type, $path, 'no type');
     }
     $full_filename_parts = explode('.', $this->full_filename);
     $this->filters = array_reverse(array_slice($full_filename_parts, $i + 1));
     //['less', 'php'] => ['php', 'less']
     if (in_array($this->type, array('html', 'css', 'js'))) {
         $this->pipeline->addDependency($this->type, $this->filepath);
     }
 }
Beispiel #8
0
 public function request($method, $paramsArray = array())
 {
     $returnUrl = BASE_URL . 'payment/?success&lg=' . $this->doorGets->myLanguage;
     $cancelUrl = BASE_URL . 'payment/?cancel&lg=' . $this->doorGets->myLanguage;
     $paramsArray = array_merge($paramsArray, array('METHOD' => $method, 'VERSION' => '124.0', 'USER' => $this->doorGets->configWeb['paypal_user'], 'SIGNATURE' => $this->doorGets->configWeb['paypal_signature'], 'PWD' => $this->doorGets->configWeb['paypal_password'], 'RETURNURL' => $returnUrl, 'CANCELURL' => $cancelUrl));
     $paramsArray['PAYMENTREQUEST_0_AMT'] = number_format($this->subscription->data['amount_total'], 2);
     $paramsArray['PAYMENTREQUEST_0_CURRENCYCODE'] = strtoupper($this->subscription->data['currency']);
     $paramsArray['PAYMENTREQUEST_0_SHIPPINGAMT'] = number_format(0, 2);
     $paramsArray['PAYMENTREQUEST_0_ITEMAMT'] = number_format($this->subscription->data['amount_total'], 2);
     $paramsArray['L_PAYMENTREQUEST_0_NAME0'] = $this->subscription->data['title'];
     $paramsArray['L_PAYMENTREQUEST_0_DESC0'] = 'desc';
     $paramsArray['L_PAYMENTREQUEST_0_AMT0'] = number_format($this->subscription->data['amount_month'], 2);
     $paramsArray['L_PAYMENTREQUEST_0_QTY0'] = (int) $this->subscription->data['tranche'];
     //vdump($paramsArray);
     $params = http_build_query($paramsArray);
     //echo $params;
     $curl = curl_init();
     curl_setopt_array($curl, array(CURLOPT_URL => $this->endpoint, CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $params, CURLOPT_RETURNTRANSFER => 1, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_VERBOSE => 1));
     $response = curl_exec($curl);
     $responseArray = array();
     parse_str($response, $responseArray);
     if (curl_errno($curl)) {
         //vdump(curl_errno($curl));
         curl_close($curl);
         return false;
     } else {
         if ($responseArray['ACK'] == 'Success') {
             //vdump($responseArray);
         } else {
             vdump($responseArray);
             curl_close($curl);
             return false;
         }
     }
     curl_close($curl);
     return $responseArray;
 }
Beispiel #9
0
 /**
  * active user
  */
 public function activeaccountAction()
 {
     /** @var \Zend\Http\Request $request */
     $request = $this->getRequest();
     $email = $request->getQuery('u');
     $activeKey = $request->getQuery('c');
     if (!$email || !$activeKey) {
         $this->redirect()->toUrl('/');
     }
     $form = new ActiveAccount();
     /* @var $userMapper \User\Model\UserMapper */
     $userMapper = $this->getServiceLocator()->get('User\\Model\\UserMapper');
     /** @var \User\Model\User $user */
     $user = new User();
     $translator = $this->getServiceLocator()->get('translator');
     $user->setActiveKey($activeKey);
     $user->setEmail($email);
     $user = $userMapper->getUserNotActive($user);
     $viewModel = new ViewModel();
     if (!$user) {
         return $viewModel->setTemplate('error/404');
     }
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $form->setData($data);
         if ($form->isValid()) {
             $user->exchangeArray((array) $data);
             $user->setActiveKey(null);
             /** @var \User\Service\User $userService */
             $userService = $this->getServiceLocator()->get('User\\Service\\User');
             $userService->signup($user);
             vdump($user);
             die;
             if ($userService->authenticate($user->getEmail(), $data['password'])) {
                 return $this->forward()->dispatch('Home\\Controller\\Index', ['action' => 'index', 'user' => $user]);
             }
         }
     }
     $viewModel->setVariables(['email' => $email]);
     $viewModel->setVariables(['form' => $form]);
     return $viewModel;
 }
Beispiel #10
0
 function run()
 {
     global $_out;
     if (ap::isCurrentModule($this)) {
         switch ($action = param('action')) {
             case 'fileinfo':
                 if (($path = urldecode(param('path'))) && ($f = $this->getFileInfo($_SERVER['DOCUMENT_ROOT'] . $path))) {
                     $f['path'] = $path;
                     $xml = new xml(null, 'file', false);
                     foreach ($f as $tagName => $value) {
                         $xml->de()->appendChild($xml->createElement($tagName, null, $value));
                     }
                     ap::ajaxResponse($xml);
                 }
                 vdump('Error file not found ' . $path);
                 break;
         }
         parent::run();
     }
 }
Beispiel #11
0
 public function doAction()
 {
     $out = '';
     $groupes = $this->doorGets->loadGroupes();
     $cName = $this->doorGets->controllerNameNow();
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (array_key_exists('id', $params['GET'])) {
         $id = $params['GET']['id'];
         $isContent = $this->doorGets->dbQS($id, '_users_info');
         if (empty($isContent)) {
             return null;
         }
         $LogineExistInfoGroupe = $this->doorGets->dbQS($isContent['network'], '_users_groupes');
         if (!empty($LogineExistInfoGroupe)) {
             $LogineExistInfoGroupe['attributes'] = @unserialize(base64_decode($LogineExistInfoGroupe['attributes']));
         }
     }
     switch ($this->Action) {
         case 'index':
             // to do
             break;
         case 'add':
             // Champs du formulaire non obligatoire
             $noObligatoire = array('last_name', 'first_name', 'description', 'region');
             if (!empty($this->doorGets->Form->i)) {
                 $this->doorGets->checkMode();
                 foreach ($this->doorGets->Form->i as $k => $v) {
                     if (empty($v) && !in_array($k, $noObligatoire)) {
                         $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_' . $k] = 'ok';
                     }
                 }
                 if (!in_array($this->doorGets->Form->i['network'], $this->doorGets->user['liste_enfant_modo'])) {
                     $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_network'] = 'ok';
                 }
                 $var = $this->doorGets->Form->i['login'];
                 $isEmail = filter_var($var, FILTER_VALIDATE_EMAIL);
                 $isEmailExist = $this->doorGets->dbQS($var, '_users', 'login');
                 if (empty($isEmail)) {
                     $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_login'] = '******';
                 }
                 if (!empty($isEmailExist)) {
                     $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_login'] = '******';
                 }
                 // verification du pseudo
                 if (empty($this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_pseudo'])) {
                     if (strlen($this->doorGets->Form->i['pseudo']) < 3) {
                         $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_pseudo'] = 'Pseudo trop court';
                     }
                     if (empty($this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_pseudo'])) {
                         $pseudo = trim(strtolower($this->doorGets->Form->i['pseudo']));
                         $checkPseudo = ctype_alnum($pseudo);
                         if (empty($checkPseudo)) {
                             $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_pseudo'] = 'Format invalid';
                         }
                         $isPseudo = $this->doorGets->dbQS($this->doorGets->Form->i['login'], '_users_info', 'pseudo');
                         if (!empty($isPseudo)) {
                             $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_pseudo'] = 'Pseudo deja ulisise';
                         }
                     }
                 }
                 if (empty($this->doorGets->Form->e)) {
                     $avatar = $this->doorGets->copyGravatar($this->doorGets->Form->i['login']);
                     $crypto = $this->doorGets->_cryptMe($this->doorGets->Form->i['password']);
                     $dataLogin['login'] = $this->doorGets->Form->i['login'];
                     $dataLogin['salt'] = $crypto['salt'];
                     $dataLogin['password'] = $crypto['password'];
                     $email = $this->doorGets->Form->i['login'];
                     $idUser = $this->doorGets->dbQI($dataLogin, '_users');
                     unset($this->doorGets->Form->i['login']);
                     unset($this->doorGets->Form->i['password']);
                     $d['last_name'] = $this->doorGets->Form->i['last_name'];
                     $d['first_name'] = $this->doorGets->Form->i['first_name'];
                     $d['description'] = $this->doorGets->Form->i['description'];
                     $d['network'] = $this->doorGets->Form->i['network'];
                     $d['active'] = $this->doorGets->Form->i['active'];
                     $d['langue'] = $this->doorGets->Form->i['langue'];
                     $d['horaire'] = $this->doorGets->Form->i['horaire'];
                     $d['pseudo'] = $pseudo;
                     $d['avatar'] = $avatar;
                     $d['id_user'] = $idUser;
                     $d['email'] = $email;
                     $d['editor_html'] = '';
                     $d['notification_mail'] = 1;
                     $d['date_creation'] = time();
                     $idUserInfo = $this->doorGets->dbQI($d, '_users_info');
                     $this->doorGets->createFolderUser($d['pseudo'], $d['id_user']);
                     $redirect = './?controller=users&action=edit&id=' . $idUserInfo;
                     FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour"));
                     header('Location:' . $redirect);
                     exit;
                 }
                 FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error");
             }
             break;
         case 'edit':
             // Champs du formulaire non obligatoire
             $noObligatoire = array('last_name', 'first_name', 'description', 'gender', 'birthday_jour', 'birthday_mois', 'birthday_annee', 'website', 'id_facebook', 'id_twitter', 'id_youtube', 'id_google', 'id_pinterest', 'id_linkedin', 'id_myspace', 'password', 'country', 'city', 'zipcode', 'adresse', 'tel_fix', 'tel_mobil', 'tel_fax', 'region', 'notification_newsletter', 'notification_mail');
             if (!empty($this->doorGets->Form->i) && in_array($isContent['network'], $this->doorGets->user['liste_enfant_modo'])) {
                 $this->doorGets->checkMode();
                 if (!array_key_exists('notification_mail', $this->doorGets->Form->i)) {
                     $this->doorGets->Form->i['notification_mail'] = 0;
                 }
                 if (!array_key_exists('notification_newsletter', $this->doorGets->Form->i)) {
                     $this->doorGets->Form->i['notification_newsletter'] = 0;
                 }
                 // gestion des champs vide
                 foreach ($this->doorGets->Form->i as $k => $v) {
                     $strAttribute = 'attribute';
                     $isStrAttribute = substr($k, 0, strlen($strAttribute));
                     if (empty($v) && !in_array($k, $noObligatoire) && $strAttribute !== $isStrAttribute) {
                         $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_edit_' . $k] = 'ok';
                     }
                 }
                 $var = $this->doorGets->Form->i['email'];
                 $isEmail = filter_var($var, FILTER_VALIDATE_EMAIL);
                 if (empty($isEmail)) {
                     $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_edit_email'] = 'ok';
                 }
                 $isEmailExist = $this->doorGets->dbQS($var, '_users_info', 'email', " AND id_user != '" . $isContent['id_user'] . "' LIMIT 1 ");
                 if (!empty($isEmailExist)) {
                     $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_login'] = '******';
                 }
                 if (empty($this->doorGets->Form->e)) {
                     $Attributes = $this->doorGets->loadUserAttributesWithValues($isContent['id'], $LogineExistInfoGroupe['attributes']);
                     foreach ($Attributes as $idAttribute => $value) {
                         switch ($value['type']) {
                             case 'file':
                                 $sizeMax = 8192000;
                                 $typeFile["application/msword"] = "data/_form/";
                                 $typeFile["application/vnd.openxmlformats-officedocument.wordprocessingml.document"] = "data/_form/";
                                 $typeFile["image/png"] = "data/_form/";
                                 $typeFile["image/jpeg"] = "data/_form/";
                                 $typeFile["image/gif"] = "data/_form/";
                                 $typeFile["application/zip"] = "data/_form/";
                                 $typeFile["application/x-zip-compressed"] = "data/_form/";
                                 $typeFile["application/pdf"] = "data/_form/";
                                 $typeFile["application/x-shockwave-flash"] = "data/_form/";
                                 $typeExtension = Constant::$extensions;
                                 $strAttribute = $this->doorGets->Form->name . '_attribute_' . $idAttribute;
                                 if (isset($_FILES[$strAttribute]) && $_FILES[$strAttribute]['error'] != 0 && empty($value['value'])) {
                                     $this->doorGets->Form->e[$strAttribute] = 'ok';
                                 }
                                 if (isset($_FILES[$strAttribute]) && empty($this->doorGets->Form->e) && $_FILES[$strAttribute]['error'] != 4) {
                                     if (!array_key_exists($_FILES[$strAttribute]["type"], $typeFile)) {
                                         $this->doorGets->Form->e[$strAttribute] = 'okcc';
                                     } else {
                                         $extension = $typeExtension[$_FILES[$strAttribute]["type"]];
                                         if ($value['params']['filter_file_zip'] === 0 && $extension === 'zip') {
                                             $this->doorGets->Form->e[$strAttribute] = 'ok1';
                                         }
                                         if ($value['params']['filter_file_png'] === 0 && $extension === 'png') {
                                             $this->doorGets->Form->e[$strAttribute] = 'ok22';
                                         }
                                         if ($value['params']['filter_file_jpg'] === 0 && $extension === 'jpg') {
                                             $this->doorGets->Form->e[$strAttribute] = 'ok3';
                                         }
                                         if ($value['params']['filter_file_gif'] === 0 && $extension === 'gif') {
                                             $this->doorGets->Form->e[$strAttribute] = 'ok4';
                                         }
                                         if ($value['params']['filter_file_swf'] === 0 && $extension === 'swf') {
                                             $this->doorGets->Form->e[$strAttribute] = 'ok5';
                                         }
                                         if ($value['params']['filter_file_pdf'] === 0 && $extension === 'pdf') {
                                             $this->doorGets->Form->e[$strAttribute] = 'ok6';
                                         }
                                         if ($value['params']['filter_file_doc'] === 0 && $extension === 'doc') {
                                             $this->doorGets->Form->e[$strAttribute] = 'ok7';
                                         }
                                     }
                                     if ($_FILES[$strAttribute]["size"] > $sizeMax) {
                                         $this->doorGets->Form->e[$strAttribute] = 'ok';
                                     }
                                 }
                                 if (isset($_FILES[$strAttribute]) && empty($this->doorGets->Form->e)) {
                                     $uni = time() . '-' . uniqid('doorgets') . '';
                                     $nameFile = $uni . '-user' . $extension;
                                     $this->doorGets->Form->i['attribute_' . $idAttribute] = $nameFile;
                                     if (move_uploaded_file($_FILES[$strAttribute]['tmp_name'], BASE_DATA . 'users/' . $nameFile)) {
                                         $dataAttribute = array('value' => $nameFile, 'date_modification' => time());
                                         $this->doorGets->dbQU($this->doorGets->user['id'], $dataAttribute, '_users_groupes_attributes_values', 'id_user', " AND id_attribute = '{$idAttribute}' LIMIT 1");
                                     }
                                 }
                                 break;
                             case 'checkbox':
                                 $checkboxValues = '';
                                 foreach ($value['params']['filter_select'] as $key => $value) {
                                     $strAttribute = 'attribute_' . $idAttribute . '_' . $key;
                                     if (array_key_exists($strAttribute, $this->doorGets->Form->i)) {
                                         $checkboxValues .= $key . ',';
                                     }
                                 }
                                 $dataAttribute = array('value' => $checkboxValues, 'date_modification' => time());
                                 $this->doorGets->dbQU($this->doorGets->user['id'], $dataAttribute, '_users_groupes_attributes_values', 'id_user', " AND id_attribute = '{$idAttribute}' LIMIT 1");
                                 break;
                             default:
                                 $strAttribute = 'attribute_' . $idAttribute;
                                 if (array_key_exists($strAttribute, $this->doorGets->Form->i)) {
                                     $dataAttribute = array('value' => $this->doorGets->Form->i[$strAttribute], 'date_modification' => time());
                                     $this->doorGets->dbQU($this->doorGets->user['id'], $dataAttribute, '_users_groupes_attributes_values', 'id_user', " AND id_attribute = '{$idAttribute}' LIMIT 1");
                                 }
                                 break;
                         }
                     }
                 }
                 if (!in_array($this->doorGets->Form->i['network'], $this->doorGets->user['liste_enfant_modo'])) {
                     $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_network'] = 'ok';
                 }
                 // Gestion de l'avatar
                 $extension = '.png';
                 if (isset($_FILES[$cName . '_edit_avatar']) && ($_FILES[$cName . '_edit_avatar']["type"] == "image/jpeg" || $_FILES[$cName . '_edit_avatar']["type"] == "image/png") && $_FILES[$cName . '_edit_avatar']["error"] === 0) {
                     if ($_FILES[$cName . '_edit_avatar']["type"] == "image/jpeg") {
                         $extension = '.jpg';
                     }
                 }
                 if (empty($this->doorGets->Form->e) && $_FILES[$cName . '_edit_avatar']['size'] !== 0) {
                     $uni = time() . '-' . uniqid('doorgets') . '';
                     $nameFileAvatar = $uni . '-user' . $extension;
                     $this->doorGets->Form->i['avatar'] = $nameFileAvatar;
                     move_uploaded_file($_FILES[$cName . '_edit_avatar']['tmp_name'], BASE_DATA . 'users/' . $nameFileAvatar);
                 }
                 if ($_FILES[$cName . '_edit_avatar']['size'] === 0) {
                     unset($this->doorGets->Form->i['avatar']);
                 }
                 if (empty($this->doorGets->Form->e)) {
                     $dataUser['login'] = $this->doorGets->Form->i['email'];
                     if (!empty($this->doorGets->Form->i['password'])) {
                         $crypto = $this->doorGets->_cryptMe($this->doorGets->Form->i['password']);
                         $dataUser['salt'] = $crypto['salt'];
                         $dataUser['password'] = $crypto['password'];
                         $dataUser['token'] = '';
                     }
                     $d['last_name'] = $this->doorGets->Form->i['last_name'];
                     $d['email'] = $this->doorGets->Form->i['email'];
                     $d['first_name'] = $this->doorGets->Form->i['first_name'];
                     $d['description'] = $this->doorGets->Form->i['description'];
                     $d['network'] = $this->doorGets->Form->i['network'];
                     $d['website'] = $this->doorGets->Form->i['website'];
                     $d['id_facebook'] = $this->doorGets->Form->i['id_facebook'];
                     $d['id_twitter'] = $this->doorGets->Form->i['id_twitter'];
                     $d['id_youtube'] = $this->doorGets->Form->i['id_youtube'];
                     $d['id_google'] = $this->doorGets->Form->i['id_google'];
                     $d['id_pinterest'] = $this->doorGets->Form->i['id_pinterest'];
                     $d['id_linkedin'] = $this->doorGets->Form->i['id_linkedin'];
                     $d['id_myspace'] = $this->doorGets->Form->i['id_myspace'];
                     $d['country'] = $this->doorGets->Form->i['country'];
                     $d['region'] = $this->doorGets->Form->i['region'];
                     $d['city'] = $this->doorGets->Form->i['city'];
                     $d['zipcode'] = $this->doorGets->Form->i['zipcode'];
                     $d['adresse'] = $this->doorGets->Form->i['adresse'];
                     $d['tel_fix'] = $this->doorGets->Form->i['tel_fix'];
                     $d['tel_mobil'] = $this->doorGets->Form->i['tel_mobil'];
                     $d['tel_fax'] = $this->doorGets->Form->i['tel_fax'];
                     $d['active'] = $this->doorGets->Form->i['active'];
                     $d['langue'] = $this->doorGets->Form->i['langue'];
                     $d['horaire'] = $this->doorGets->Form->i['horaire'];
                     $d['profile_type'] = $this->doorGets->Form->i['profile_type'];
                     $d['notification_mail'] = $this->doorGets->Form->i['notification_mail'];
                     $d['notification_newsletter'] = $this->doorGets->Form->i['notification_newsletter'];
                     if (array_key_exists('avatar', $this->doorGets->Form->i)) {
                         $d['avatar'] = $this->doorGets->Form->i['avatar'];
                     }
                     $this->doorGets->dbQU($isContent['id_user'], $dataUser, '_users');
                     $this->doorGets->dbQU($isContent['id_user'], $d, '_users_info', 'id_user');
                     $this->changeUserGroupe($isContent['id_user'], $isContent['network'], $d['network']);
                     FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour"));
                     //$this->doorGets->clearDBCache();
                     $redirectUrl = './?controller=users&action=edit&id=' . $isContent['id'];
                     header('Location:' . $redirectUrl);
                     exit;
                 }
                 vdump($this->doorGets->Form);
                 FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error");
             }
             break;
         case 'delete':
             if (!empty($this->doorGets->Form->i) && empty($this->doorGets->Form->e) && in_array($isContent['network'], $this->doorGets->user['liste_enfant_modo']) && $this->doorGets->user['id'] !== $isContent['id']) {
                 $this->doorGets->checkMode();
                 $this->removeUserFromAll($isContent['id_user']);
                 $this->doorGets->dbQD($isContent['id_user'], '_users', 'id');
                 $this->doorGets->dbQD($isContent['id_user'], '_users_info', 'id_user');
                 $this->doorGets->dbQD($isContent['id_user'], '_user_google', 'id_user');
                 $this->doorGets->dbQD($isContent['id_user'], '_user_facebook', 'id_user');
                 //$this->doorGets->clearDBCache();
                 if (is_dir(BASE . 'u/' . $isContent['pseudo'])) {
                     $this->rrmdir(BASE . 'u/' . $isContent['pseudo']);
                 }
                 FlashInfo::set($this->doorGets->__("Vos informations sont bien supprimées"));
                 header('Location:./?controller=users');
                 exit;
             }
             break;
     }
     return $out;
 }
Beispiel #12
0
 /**
  * /vomit
  */
 public function getFilesUnder($name, $ext, $depth = -1)
 {
     $files = array();
     $name = trim($name, './') . '/';
     $type = $this->getTypeForExt($ext);
     $directories = $canonical_directories = array();
     foreach ($this->paths as $path) {
         $prefixes = isset($path['prefixes']) ? $path['prefixes'] : array();
         $prefix = isset($prefixes[$type]) ? $prefixes[$type] . '/' : '';
         foreach ($path['directories'] as $directory) {
             $len = strlen($directory . $prefix);
             $directory_content = glob($directory . $prefix . $name . '*');
             if (!$directory_content) {
                 continue;
             }
             // MAY return false under unknown circumstances (...)
             foreach ($directory_content as $p) {
                 //file or dir
                 if (isset($this->processed_files[$p])) {
                     continue;
                 }
                 $canonical_path = trim(substr($p, $len), '/\\');
                 if ($canonical_path[0] == '.') {
                     continue;
                 }
                 //hidden file/dir
                 if (is_dir($p)) {
                     if ($depth < 2 && $depth != -1) {
                         continue;
                     }
                     //we reached depth limit
                     $directories[] = $p;
                     //not the canonical one, we want to list only this one
                     $canonical_directories[] = $canonical_path;
                 } else {
                     //@todo refactor
                     if (false === strpos($canonical_path, '.')) {
                         continue;
                     }
                     //ie LICENSE files (rofl)
                     list($canonical, $extension) = explode('.', basename($canonical_path));
                     if ($extension != $ext) {
                         continue;
                     }
                     $canonical_dir = trim(dirname($canonical_path), '/' . DIRECTORY_SEPARATOR);
                     $canonical = trim($canonical, '/' . DIRECTORY_SEPARATOR);
                     $full_path = $canonical_dir . '/' . $canonical;
                     if (isset($this->processed_files[$full_path])) {
                         continue;
                     }
                     $this->processed_files[$full_path] = true;
                     $files[] = $full_path;
                 }
             }
         }
     }
     if ($directories) {
         foreach ($directories as $i => $d) {
             $canonical_dir = $canonical_directories[$i];
             $len = strlen($d);
             $directory_content = glob($e = $d . '/*');
             foreach ($directory_content as $file) {
                 $canonical = $canonical_dir . substr($file, $len);
                 //$len + 1 to remove prefix "/"
                 if (isset($this->processed_files[$canonical])) {
                     continue;
                 }
                 if ($canonical[0] == '.') {
                     continue;
                 }
                 if (is_dir($file)) {
                     //not yet working :( - too lazy to refactor this part
                     //basically all you need is to extract this to a separate function
                     vdump($directories, $e, $directory_content, $file);
                 } else {
                     list($canonical, $extension) = explode('.', basename($canonical));
                     if ($extension != $ext) {
                         continue;
                     }
                     $canonical = trim($canonical, '/' . DIRECTORY_SEPARATOR);
                     $full_path = $canonical_dir . '/' . $canonical;
                     if (isset($this->processed_files[$full_path])) {
                         continue;
                     }
                     $this->processed_files[$full_path] = true;
                     $files[] = $full_path;
                 }
             }
         }
     }
     return $files;
 }
Beispiel #13
0
 public function initProductByUri()
 {
     $realUri = $this->doorGets->getRealUri($this->moduleUri);
     $uriModule = '_m_' . $realUri;
     $uriModuleTraduction = $uriModule . '_traduction';
     $isContentTraduction = $this->doorGets->dbQS($this->uri, $uriModuleTraduction, 'uri');
     if (!empty($isContentTraduction)) {
         $isContent = $this->doorGets->dbQS($isContentTraduction['id_content'], $uriModule);
         if (!empty($isContent)) {
             $isContent = array_merge($isContent, $isContentTraduction);
             $isContent = $this->formatData($isContent);
             vdump($isContent);
         }
     }
 }
 public function testAction()
 {
     list($officeAdapter, $officeSql) = $this->createOfficeBNCAdapter();
     $dbAdapter = $this->getServiceLocator()->get('dbAdapter');
     $dbSql = $this->getServiceLocator()->get('dbSql');
     $rows = $officeAdapter->query('SELECT * FROM `position_titles`', Adapter::QUERY_MODE_EXECUTE);
     vdump($rows->toArray());
     die;
 }
Beispiel #15
0
 public function run($err = false)
 {
     try {
         $call = new \ReflectionMethod($this->classname, $this->method);
         if ($err) {
             $call->invokeArgs($this->class, $this->args);
             return;
         }
         $numOfReqPara = $call->getNumberOfRequiredParameters();
         $numOfOptPara = $call->getNumberOfParameters() - $numOfReqPara;
         $remainparas = count($this->args) - $numOfReqPara;
         if ($numOfReqPara == 0 || $remainparas >= 0 && $remainparas <= $numOfOptPara) {
             $call->invokeArgs($this->class, $this->args);
         } else {
             $this->load404Controller();
             $this->run(true);
         }
     } catch (\ReflectionException $e) {
         if (strstr($e->getMessage(), "does not exist") !== false) {
             $this->load404Controller();
         } else {
             $this->load500Controller();
         }
         $this->run(true);
         if ($this->config["DEBUG"]) {
             echo vdump($e, $this);
         } else {
             $this->mail_admins("[Exception - " . $this->config["SITE_NAME"] . "]", vdump($e, $this), true);
         }
     } catch (\Exception $e) {
         $this->load500Controller();
         $this->run(true);
         if ($this->config["DEBUG"]) {
             echo vdump($e, $this);
         } else {
             $this->mail_admins("[Exception - " . $this->config["SITE_NAME"] . "]", vdump($e, $this), true);
         }
     }
 }
 function DoExpressCheckoutPayment()
 {
     if (!empty(_SESSION('ppl_products')) && !empty(_SESSION('ppl_charges'))) {
         $products = _SESSION('ppl_products');
         $charges = _SESSION('ppl_charges');
         $padata = '&TOKEN=' . urlencode(_GET('token'));
         $padata .= '&PAYERID=' . urlencode(_GET('PayerID'));
         $padata .= '&PAYMENTREQUEST_0_PAYMENTACTION=' . urlencode("SALE");
         //set item info here, otherwise we won't see product details later
         foreach ($products as $p => $item) {
             $padata .= '&L_PAYMENTREQUEST_0_NAME' . $p . '=' . urlencode($item['ItemName']);
             $padata .= '&L_PAYMENTREQUEST_0_NUMBER' . $p . '=' . urlencode($item['ItemNumber']);
             $padata .= '&L_PAYMENTREQUEST_0_DESC' . $p . '=' . urlencode($item['ItemDesc']);
             $padata .= '&L_PAYMENTREQUEST_0_AMT' . $p . '=' . urlencode($item['ItemPrice']);
             $padata .= '&L_PAYMENTREQUEST_0_QTY' . $p . '=' . urlencode($item['ItemQty']);
         }
         $padata .= '&PAYMENTREQUEST_0_ITEMAMT=' . urlencode($this->GetProductsTotalAmount($products));
         $padata .= '&PAYMENTREQUEST_0_TAXAMT=' . urlencode($charges['TotalTaxAmount']);
         $padata .= '&PAYMENTREQUEST_0_SHIPPINGAMT=' . urlencode($charges['ShippinCost']);
         $padata .= '&PAYMENTREQUEST_0_HANDLINGAMT=' . urlencode($charges['HandalingCost']);
         $padata .= '&PAYMENTREQUEST_0_SHIPDISCAMT=' . urlencode($charges['ShippinDiscount']);
         $padata .= '&PAYMENTREQUEST_0_INSURANCEAMT=' . urlencode($charges['InsuranceCost']);
         $padata .= '&PAYMENTREQUEST_0_AMT=' . urlencode($this->GetGrandTotal($products, $charges));
         $padata .= '&PAYMENTREQUEST_0_CURRENCYCODE=' . urlencode(PPL_CURRENCY_CODE);
         //We need to execute the "DoExpressCheckoutPayment" at this point to Receive payment from user.
         $httpParsedResponseAr = $this->PPHttpPost('DoExpressCheckoutPayment', $padata);
         vdump($httpParsedResponseAr);
         //Check if everything went ok..
         if ("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
             echo '<h2>Success</h2>';
             echo 'Your Transaction ID : ' . urldecode($httpParsedResponseAr["PAYMENTINFO_0_TRANSACTIONID"]);
             /*
             //Sometimes Payment are kept pending even when transaction is complete. 
             //hence we need to notify user about it and ask him manually approve the transiction
             */
             if ('Completed' == $httpParsedResponseAr["PAYMENTINFO_0_PAYMENTSTATUS"]) {
                 echo '<div style="color:green">Payment Received! Your product will be sent to you very soon!</div>';
             } elseif ('Pending' == $httpParsedResponseAr["PAYMENTINFO_0_PAYMENTSTATUS"]) {
                 echo '<div style="color:red">Transaction Complete, but payment is still pending! ' . 'You need to manually authorize this payment in your <a target="_new" href="http://www.paypal.com">Paypal Account</a></div>';
             }
             $this->GetTransactionDetails();
         } else {
             echo '<div style="color:red"><b>Error : </b>' . urldecode($httpParsedResponseAr["L_LONGMESSAGE0"]) . '</div>';
             echo '<pre>';
             print_r($httpParsedResponseAr);
             echo '</pre>';
         }
     } else {
         // Request Transaction Details
         $this->GetTransactionDetails();
     }
 }