Ejemplo n.º 1
0
 function crud($idproduct = null)
 {
     $dataSession = getSession();
     $dataMenu = array("user" => $dataSession);
     $dataMenu['selectMenu'] = "product";
     $dataMenu['title'] = "Productos";
     $data = array();
     $trademark = $this->trademark->findAll();
     $data['trademark'] = $trademark['rpta'] == true ? $trademark['array'] : array();
     $subcategory = $this->subcategory->findAll();
     $data['subcategory'] = $subcategory['rpta'] == true ? $subcategory['array'] : array();
     if (!is_null($idproduct)) {
         $product = $this->product->getbyId($idproduct);
         $data['product'] = $product['rpta'] == true ? $product['array'] : array();
         $arrSubcategory = $this->subcategory->findByProduct($idproduct);
         $aux = array(0);
         if ($arrSubcategory['rpta'] == true) {
             foreach ($arrSubcategory['array'] as $key => $value) {
                 array_push($aux, $value['subcategoryid']);
             }
         }
         $data['arrSubcategory'] = $aux;
     }
     $this->load->view("menu/menu_view", $dataMenu);
     $this->load->view("product/crud", $data);
 }
Ejemplo n.º 2
0
 function hospitalTimeSlot_post()
 {
     $this->bf_form_validation->set_rules('hospitalId', 'hospitalId', 'xss_clean|numeric|required|trim');
     if ($this->bf_form_validation->run($this) == FALSE) {
         $response = array('status' => FALSE, 'message' => $this->validation_post_warning());
         $this->response($response, 400);
     } else {
         $hospitalId = $this->input->post('hospitalId');
         $options = array('table' => 'qyura_hospitalTimeSlot', 'where' => array('qyura_hospitalTimeSlot.hospitalTimeSlot_deleted' => 0, 'qyura_hospitalTimeSlot.hospitalTimeSlot_hospitalId' => $hospitalId));
         $hospitalTimeSlot = $this->common_model->customGet($options);
         $response = array();
         if (isset($hospitalTimeSlot) && $hospitalTimeSlot != NULL) {
             foreach ($hospitalTimeSlot as $hospitalTime) {
                 $timeSlot = array();
                 $timeSlot[] = $hospitalTime->hospitalTimeSlot_id;
                 $timeSlot[] = $hospitalTime->hospitalTimeSlot_startTime;
                 $timeSlot[] = $hospitalTime->hospitalTimeSlot_endTime;
                 $timeSlot[] = getSession($hospitalTime->hospitalTimeSlot_sessionType);
                 $response[] = $timeSlot;
             }
         }
         $columns = array('h_timeSlotid', 'h_startTime', 'h_endTime', 'h_sessionType');
         if (!empty($response) && $response != NULL) {
             $response = array('status' => TRUE, 'message' => ' Time Slot!', 'data' => $response, 'columns' => $columns);
             $this->response($response, 200);
         } else {
             $response = array('status' => FALSE, 'message' => 'There is no time slot yet!');
             $this->response($response, 400);
         }
     }
 }
Ejemplo n.º 3
0
 public function testServices()
 {
     $ins = getAuth();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Auth\IAuth::class, $ins);
     $ins = getView();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\View\IView::class, $ins);
     $ins = getLog();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Log\ILog::class, $ins);
     //        $ins = getDB();
     //        $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Database\MedooDB::class, $ins);
     //        $ins = getRedis();
     //        $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Database\PRedis::class, $ins);
     //        $ins = getDataPool();
     //        $this->assertInstanceOf(\Wwtg99\DataPool\Common\IDataPool::class, $ins);
     $ins = getCache();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\Cache::class, $ins);
     $ins = getSession();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\SessionUtil::class, $ins);
     $ins = getCookie();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\CookieUtil::class, $ins);
     $ins = getOValue();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\OldValue::class, $ins);
     $ins = getAssets();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\View\AssetsManager::class, $ins);
     $ins = getMailer();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Utils\Mail::class, $ins);
     $ins = Flight::Express();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Utils\Express::class, $ins);
     $ins = getPlugin('php');
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Plugin\IPlugin::class, $ins);
 }
Ejemplo n.º 4
0
 public function actionIndex()
 {
     if (!getSession('username')) {
         return $this->redirect('index.php?r=login');
     }
     return $this->render('index');
 }
Ejemplo n.º 5
0
 public static function MyMethod()
 {
     $counter = (int) getSession()->get('counter');
     $counter++;
     getSession()->set('counter', $counter);
     echo '<h1>You have clicked ' . getSession()->get('counter') . ' times <a href="">Reload</a></h1>';
 }
Ejemplo n.º 6
0
 function diagnosticTimeSlot_post()
 {
     $this->bf_form_validation->set_rules('diagnosticId', 'diagnosticId', 'xss_clean|numeric|required|trim');
     if ($this->bf_form_validation->run($this) == FALSE) {
         $response = array('status' => FALSE, 'message' => $this->validation_post_warning());
         $this->response($response, 400);
     } else {
         $centerTimeSlot = $this->input->post('diagnosticId');
         $options = array('table' => 'qyura_diagnosticCenterTimeSlot', 'where' => array('qyura_diagnosticCenterTimeSlot.diagnosticCenterTimeSlot_deleted' => 0, 'qyura_diagnosticCenterTimeSlot.diagnosticCenterTimeSlot_diagnosticId' => $centerTimeSlot));
         $centerTimeSlotArray = $this->common_model->customGet($options);
         $response = array();
         if (isset($centerTimeSlotArray) && $centerTimeSlotArray != NULL) {
             foreach ($centerTimeSlotArray as $diagnosticTime) {
                 $timeSlot = array();
                 $timeSlot[] = $diagnosticTime->diagnosticCenterTimeSlot_id;
                 $timeSlot[] = $diagnosticTime->diagnosticCenterTimeSlot_startTime;
                 $timeSlot[] = $diagnosticTime->diagnosticCenterTimeSlot_endTime;
                 $timeSlot[] = getSession($diagnosticTime->diagnosticCenterTimeSlot_sessionType);
                 $response[] = $timeSlot;
             }
         }
         $columns = array('d_timeSlotid', 'd_startTime', 'd_endTime', 'd_sessionType');
         if (!empty($response) && $response != NULL) {
             $response = array('status' => TRUE, 'message' => 'success', 'data' => $response, 'columns' => $columns);
             $this->response($response, 200);
         } else {
             $response = array('status' => FALSE, 'message' => 'There is no time slot yet!');
             $this->response($response, 400);
         }
     }
 }
Ejemplo n.º 7
0
 public function changeConnectUser($connect)
 {
     $return = array("rpta" => false);
     $dataSession = getSession();
     $return['rpta'] = $this->chat->changeConnectUser($dataSession['userid'], $connect);
     echo json_encode($return);
 }
Ejemplo n.º 8
0
 /**
  * Create a new action by calling the model.
  *
  * @param string $targetId The ID of the target on which the action will be applied.
  * @param string $targetType The type of object this action is being added to - typically a photo.
  * @return string Standard JSON envelope
  */
 public function create($targetId, $targetType)
 {
     getAuthentication()->requireAuthentication(false);
     getAuthentication()->requireCrumb();
     $params = $_POST;
     $params['targetId'] = $targetId;
     $params['targetType'] = $targetType;
     $params['email'] = getSession()->get('email');
     if (isset($_POST['crumb'])) {
         unset($params['crumb']);
     }
     $id = $this->action->create($params);
     if ($id) {
         $action = $this->action->view($id);
         // get the target element for the action
         $apiResp = $this->api->invoke("/{$this->apiVersion}/{$targetType}/{$targetId}/view.json", EpiRoute::httpGet, array('_GET' => array('returnSizes' => '100x100xCR')));
         $target = $apiResp['result'];
         $this->plugin->setData('action', $action);
         $this->plugin->setData('type', $targetType);
         $this->plugin->setData('target', $target);
         $this->plugin->invoke('onAction');
         $activityParams = array('elementId' => $targetId, 'type' => 'action-create', 'data' => array('targetType' => $targetType, 'target' => $target, 'action' => $action), 'permission' => $target['permission']);
         $this->api->invoke("/{$this->apiVersion}/activity/create.json", EpiRoute::httpPost, array('_POST' => $activityParams));
         return $this->created("Action {$id} created on {$targetType} {$targetId}", $action);
     }
     return $this->error("Error creating action {$id} on {$targetType} {$targetId}", false);
 }
function downloadBackupsFromSalesforce($USERNAME, $PASSWORD)
{
    //get a session ID via the php toolkit API
    $sessionId = getSession($USERNAME, $PASSWORD);
    //build the cookie info out of session ID and org ID
    $sc = 'Cookie=';
    $sc .= 'oid=' . $ORGID . '; ';
    $sc .= 'sid=' . $sessionId . '; ';
    //request the data export page in the frontend UI
    $response = getExportPageRaw($sc);
    //print($response);
    $doc = new DOMDocument();
    $doc->loadHTML($response);
    $tags = $doc->getElementsByTagName('a');
    //get all the href's on the page
    $arrFilenames = array();
    foreach ($tags as $tag) {
        //filter to just the href's for the file downloads
        if (strpos($tag->getAttribute('href'), 'servlet.OrgExport?fileName=') !== false) {
            array_push($arrFilenames, 'https://ssl.salesforce.com' . $tag->getAttribute('href'));
        }
    }
    //print_r($arrFilenames);
    if (count($arrFilenames) > 0) {
        multiRequestBatched($arrFilenames, $sc, 5);
    }
    //locally, we only want to keep 2 weeks worth of files.  So delete anything other than the most recent 2 weeks.
    deleteOldLocalFiles();
}
Ejemplo n.º 10
0
function og_meta_get()
{
    if ($og_meta = getSession()->get('og_meta')) {
        getSession()->set('og_meta', null);
        return $og_meta;
    }
}
Ejemplo n.º 11
0
		public function prepareElementsToExport() {

			$objectId = getRequest('param0');

			$complete = false;
			$objects = umiObjectsCollection::getInstance();
			$object = $objects->getObject($objectId);
			$formatId = $object->format;
			$format = $objects->getObject($formatId);
			$suffix = $format->sid;
			if($suffix != 'YML') {
				$data = array(
					"attribute:complete" => (int) $complete,
					"attribute:preparation" => (int) !$complete,
				);

				baseModuleAdmin::setData($data);
				return baseModuleAdmin::doData();
			}

			$offset = (int) getSession("export_offset_" . $objectId);
			$blockSize = mainConfiguration::getInstance()->get("modules", "exchange.splitter.limit") ? mainConfiguration::getInstance()->get("modules", "exchange.splitter.limit") : 25;

			if(!file_exists(CURRENT_WORKING_DIR . "/sys-temp/yml/" . $objectId . 'el')) {
				throw new publicException('<a href="' . getLabel("label-errors-no-information") . '" target="blank">' . getLabel("label-errors-no-information") .'</a>');
			}

			$elementsToExport = unserialize(file_get_contents(CURRENT_WORKING_DIR . "/sys-temp/yml/" . $objectId . 'el'));
			$elements = umiHierarchy::getInstance();

			$errors = array();
			for ($i = $offset; $i <= $offset + $blockSize -1; $i++) {
				if(!array_key_exists($i, $elementsToExport)) {
					$complete = true;
					break;
				}
				$element = $elements->getElement($elementsToExport[$i]);
				if($element instanceof umiHierarchyElement) {
					try {
						$element->updateYML();
					} catch (Exception $e) {
						$errors[] = $e->getMessage() . " #{$elementsToExport[$i]}";
					}
				}
			}

			$_SESSION["export_offset_" . $objectId] = $offset + $blockSize;
			if ($complete) {
				unset($_SESSION["export_offset_" . $objectId]);
			}

			$data = array(
				"attribute:complete" => (int) $complete,
				"nodes:log" => $errors
			);

			baseModuleAdmin::setData($data);
			return baseModuleAdmin::doData();
		}
Ejemplo n.º 12
0
 public static function processLogin()
 {
     // Confirm the password is correct
     // * Assume it's all good for the time being * //
     // Redirect to the logged in home page
     getSession()->set(Constants::LOGGED_IN, true);
     getRoute()->redirect('/dashboard');
 }
 public function generateEmptyToken()
 {
     $token = unserialize(getSession('_security_secured_area'));
     if (!$token) {
         return $this->generateNewToken();
     }
     return $token;
 }
Ejemplo n.º 14
0
 public function groups()
 {
     $groupsResp = $this->api->invoke('/groups/list.json');
     $groups = $groupsResp['result'];
     $navigation = $this->getNavigation('groups');
     $bodyTemplate = sprintf('%s/manage-groups.php', $this->config->paths->templates);
     $body = $this->template->get($bodyTemplate, array('groups' => $groups, 'navigation' => $navigation, 'crumb' => getSession()->get('crumb')));
     $this->theme->display('template.php', array('body' => $body, 'page' => 'manage-groups'));
 }
Ejemplo n.º 15
0
 /**
  * Log a user in via BrowserID
  *
  * @return string Standard JSON envelope
  */
 public function login($provider = null)
 {
     $wasUserLoggedIn = $this->user->login($provider, $_POST);
     if ($wasUserLoggedIn) {
         return $this->success('User was logged in successfully', array('email' => getSession()->get('email')));
     } else {
         return $this->forbidden('User was not able to be logged in', false);
     }
 }
 protected function getDefaultLocale()
 {
     $userPreferences = getSession('userPreferences');
     if (!is_null($userPreferences) && array_key_exists('defaultLocale', $userPreferences)) {
         return $userPreferences['defaultLocale'];
     }
     $config = $this->httpRequest->getAttribute('defaultPreferences');
     return $config['default_locale'];
 }
Ejemplo n.º 17
0
 public static function isNeedCaptha()
 {
     if (cmsController::getInstance()->getModule('users')->is_auth()) {
         return false;
     }
     if (getCookie('umi_captcha') == md5(getCookie('user_captcha'))) {
         $_SESSION['is_human'] = 1;
     }
     return getSession('is_human') != 1;
 }
 /**
  * Automatic login user.
  *
  * @return boolean
  */
 public function autologin()
 {
     $this->session = getSession();
     $user_id = $this->authenticate();
     if ($user_id === false) {
         return false;
     }
     $this->session->set("user_id", $user_id);
     return true;
 }
Ejemplo n.º 19
0
 public function setDefaultLocale($locale)
 {
     $userPreferences = getSession('userPreferences');
     if (is_null($userPreferences) || !is_array($userPreferences)) {
         $userPreferences = array();
     }
     $locales = $this->httpRequest->getAttribute('locales');
     $userPreferences['defaultLocale'] = $locales[$locale];
     setSession('userPreferences', $userPreferences);
 }
Ejemplo n.º 20
0
 function formatMail($data)
 {
     $dataSession = getSession();
     $return = array();
     $subject = "Hola, hay una persona interesada en emparejar a " . $data['namepet'];
     $html = "<p> Hola " . $data['name'] . " " . $data['lastname'] . ".</p>" . "<p>" . $dataSession['name'] . " quiere contactarse contigo para emparejar a " . $data['namepet'] . "</p>" . "<p> Entra a <a href='http://lifeleg.com/'> Lifeleg.com</a> ahora mismo y contactalo ! </p>" . "<p>Suerte!</p>";
     $return['subject'] = $subject;
     $return['msg'] = $html;
     $return['to'] = $data['email'];
     return $return;
 }
Ejemplo n.º 21
0
 public function __construct()
 {
     $this->api = getApi();
     $this->config = getConfig()->get();
     $this->plugin = getPlugin();
     $this->route = getRoute();
     $this->session = getSession();
     $this->template = getTemplate();
     $this->utility = new Utility();
     $this->url = new Url();
     $this->apiVersion = Request::getApiVersion();
 }
Ejemplo n.º 22
0
 public function sendMail()
 {
     $dataPost = $this->input->post();
     $dataUser = getSession();
     $title = $dataPost['title'];
     $message = $dataPost['message'];
     $msg = "<p>" . $dataUser['name'] . " " . $dataUser['lastname'] . "</p>";
     $msg .= "<p> celular: " . $dataUser['mobile'] . "</p>";
     $msg .= "<p>" . $title . "</p> <p>" . $message . "</p>";
     send_email("Recomendación ", $msg, "*****@*****.**", true);
     echo json_encode(true);
 }
Ejemplo n.º 23
0
 function crud($areaid = null)
 {
     $dataSession = getSession();
     $dataMenu = array("user" => $dataSession);
     $dataMenu['selectMenu'] = "product";
     $dataMenu['title'] = "Productos";
     $data = array();
     if (!is_null($areaid)) {
         $area = $this->area->getById($areaid);
         $data['area'] = $area['rpta'] == true ? $area['array'] : array();
     }
     $this->load->view("menu/menu_view", $dataMenu);
     $this->load->view("area/area_view", $data);
 }
Ejemplo n.º 24
0
 public function getDataUser($userid)
 {
     $return = array("rpta" => false);
     $dataSession = getSession();
     $rpta = $this->user_suitor->getSuitorwithUser($dataSession['userid'], $userid);
     if ($rpta['rpta'] == true) {
         $return = $this->user->getById($userid);
         if ($return['rpta'] == true) {
             unset($return['array']['pass']);
         }
     }
     //var_dump("<pre>",$return);exit;
     echo json_encode($return);
 }
Ejemplo n.º 25
0
 public function __construct()
 {
     $this->api = getApi();
     $this->config = getConfig()->get();
     $this->logger = getLogger();
     $this->route = getRoute();
     $this->session = getSession();
     $this->cache = getCache();
     // really just for setup when the systems don't yet exist
     if (isset($this->config->systems)) {
         $this->db = getDb();
         $this->fs = getFs();
     }
 }
Ejemplo n.º 26
0
function isAdmin()
{
    getSession();
    if (isset($_SESSION['user'])) {
        if ($_SESSION['user']->isAdmin != 1) {
            setFlash('warning', 'Vous n\'avez pas les droits pour accéder à cette section.');
            header('location: vote.php');
            exit;
        }
    } else {
        setFlash('warning', 'Connectez vous pour accéder à cette section.');
        header('location: login.php');
        exit;
    }
}
Ejemplo n.º 27
0
 /**
  * User's settings page
  *
  * @return void
  */
 public function settings()
 {
     getAuthentication()->requireAuthentication();
     $userObj = new User();
     $credentials = $this->api->invoke('/oauth/list.json', EpiRoute::httpGet);
     $groups = $this->api->invoke('/groups/list.json', EpiRoute::httpGet);
     $webhooks = $this->api->invoke('/webhooks/list.json', EpiRoute::httpGet);
     $plugins = $this->api->invoke('/plugins/list.json', EpiRoute::httpGet);
     $mobilePassphrase = $userObj->getMobilePassphrase();
     if (!empty($mobilePassphrase)) {
         $mobilePassphrase['minutes'] = ceil(($mobilePassphrase['expiresAt'] - time()) / 60);
     }
     $template = sprintf('%s/settings.php', $this->config->paths->templates);
     $body = $this->template->get($template, array('crumb' => getSession()->get('crumb'), 'plugins' => $plugins['result'], 'credentials' => $credentials['result'], 'webhooks' => $webhooks['result'], 'groups' => $groups['result'], 'mobilePassphrase' => $mobilePassphrase));
     $this->theme->display('template.php', array('body' => $body, 'page' => 'settings'));
 }
Ejemplo n.º 28
0
 function crud($subcategoryid = null)
 {
     $dataSession = getSession();
     $dataMenu = array("user" => $dataSession);
     $dataMenu['selectMenu'] = "product";
     $dataMenu['title'] = "Sub categoria";
     $data = array();
     $category = $this->categories->findAll();
     $data['category'] = $category['rpta'] == true ? $category['array'] : array();
     if (!is_null($subcategoryid)) {
         $subcategory = $this->subcategory->getById($subcategoryid);
         $data['subcategory'] = $subcategory['rpta'] == true ? $subcategory['array'] : array();
     }
     $this->load->view("menu/menu_view", $dataMenu);
     $this->load->view("subcategory/subcategory_view", $data);
 }
Ejemplo n.º 29
0
 /**
  * Log a user in via mobilePassphrase
  *
  * @return string Standard JSON envelope
  */
 public function loginMobile()
 {
     $mobilePassphrase = $this->user->getMobilePassphrase();
     if (empty($mobilePassphrase) || !isset($_POST['passphrase']) || $mobilePassphrase['phrase'] != $_POST['passphrase']) {
         return $this->forbidden('Unable to authenticate', false);
     }
     $email = $this->config->user->email;
     $this->user->setEmail($email);
     $this->user->setMobilePassphrase(true);
     // unset
     if (isset($_POST['redirect'])) {
         $this->route->redirect($_POST['redirect'], null, true);
     } else {
         return $this->success('User was logged in successfully', array('email' => getSession()->get('email')));
     }
 }
Ejemplo n.º 30
0
 public function getCompareElements()
 {
     static $elements;
     if (is_array($elements)) {
         return $elements;
     }
     if (!is_array(getSession("compare_list"))) {
         $_SESSION['compare_list'] = array();
     }
     if (is_array(getRequest('compare_list'))) {
         $_SESSION['compare_list'] = getRequest('compare_list');
     }
     $elements = getSession("compare_list");
     $elements = array_unique($elements);
     return $elements;
 }