function __construct($config, $parameters)
 {
     parent::__construct($config, $parameters);
     $this->auth();
     if (!$this->user->isAdmin()) {
         throw new Exception('You do not have access to this page.');
     }
     $this->template = new SimpleSAML_XHTML_Template($this->config, 'accountmapping-prepare.php', 'foodle_foodle');
     $this->prepare();
     $limit = TRUE;
     if (!empty($_REQUEST['showall'])) {
         $limit = FALSE;
     }
     $realmFrom = 'hio.no';
     if (!empty($_REQUEST['realmFrom'])) {
         $realmFrom = $_REQUEST['realmFrom'];
     }
     $realmTo = 'hioa.no';
     if (!empty($_REQUEST['realmTo'])) {
         $realmTo = $_REQUEST['realmTo'];
     }
     $this->template->data['realmFrom'] = $realmFrom;
     $this->template->data['realmTo'] = $realmTo;
     $this->allusers = $this->fdb->searchUsersRealm($realmFrom);
     foreach ($this->allusers as $k => $u) {
         $this->allusers[$k]['stats'] = $this->fdb->getUserStats($u['userid']);
     }
 }
Example #2
0
 function __construct($config, $parameters)
 {
     parent::__construct($config, $parameters);
     $this->template = new SimpleSAML_XHTML_Template($this->config, 'attributecheck.php', 'foodle_foodle');
     $this->setLocale();
     $this->auth();
     $this->timezone = new TimeZone($this->fdb, null, $this->user);
 }
Example #3
0
 function __construct($config, $parameters)
 {
     parent::__construct($config, $parameters);
     if (count($parameters) < 1) {
         throw new Exception('Missing [foodleid] parameter in URL.');
     }
     Data_Foodle::requireValidIdentifier($parameters[0]);
     $this->foodleid = $parameters[0];
     $this->foodlepath = '/foodle/' . $this->foodleid;
     $this->foodle = $this->fdb->readFoodle($this->foodleid);
 }
Example #4
0
 function __construct($config, $parameters)
 {
     parent::__construct($config, $parameters);
     $this->template = new SimpleSAML_XHTML_Template($this->config, 'user.php', 'foodle_foodle');
     //$this->setLocale();
     $this->auth();
     if (count($parameters) !== 1) {
         throw new Exception('Wrong number of parameters to User Profile page. You should never be sent to this URL.');
     }
     $this->showuser = $this->fdb->readUser($parameters[0]);
     if (empty($this->showuser)) {
         throw new Exception('Could not find user with ID ' . $parameters[0]);
     }
     $this->timezone = new TimeZone($this->fdb, null, $this->showuser);
     $this->checkToken();
 }
Example #5
0
 function __construct($config, $parameters)
 {
     parent::__construct($config, $parameters);
     $this->template = new SimpleSAML_XHTML_Template($this->config, 'accountmapping.php', 'foodle_foodle');
     $this->auth();
     #		$this->timezone = new TimeZone(null, $this->user);
     if (!$this->user->isAdmin()) {
         throw new Exception('You do not have access to this page.');
     }
     $this->prepare();
     $limit = TRUE;
     if (!empty($_REQUEST['showall'])) {
         $limit = FALSE;
     }
     $this->allusers = $this->fdb->getAllUsers($limit);
     // foreach($this->allusers AS $k => $u) {
     // 	$this->allusers[$k]['stats'] = $this->fdb->getUserStats($u['userid']);
     // }
 }
Example #6
0
 function __construct($config, $parameters)
 {
     parent::__construct($config, $parameters);
     if (count($parameters) < 1) {
         throw new Exception('Missing [foodleid] parameter in URL.');
     }
     $this->template = new SimpleSAML_XHTML_Template($this->config, 'foodleresponse.php', 'foodle_foodle');
     $this->setLocale();
     Data_Foodle::requireValidIdentifier($parameters[0]);
     $this->foodleid = $parameters[0];
     $this->foodlepath = '/foodle/' . $this->foodleid;
     #Timer::tick('Preparation started');
     $this->foodle = $this->fdb->readFoodle($this->foodleid);
     #Timer::tick('Foodle read');
     // $this->foodle->getColumnDates();
     // $this->calendarEnabled = $this->foodle->calendarEnabled();
     // $this->timezoneEnable = $this->foodle->timeZoneEnabled();
     // $this->datesonly = $this->foodle->datesOnly();
     #Timer::tick('Timezone preparations');
     $this->auth();
 }
Example #7
0
 private function getRegistrationForm()
 {
     $db = Core_Database::__getInstance();
     $login = Core_Login::__getInstance();
     $text = Core_Text::__getInstance();
     $text->setFile('account');
     $text->setSection('register');
     // Check for input
     $firstname = Core_Tools::getInput('_POST', 'firstname', 'varchar');
     $name = Core_Tools::getInput('_POST', 'name', 'varchar');
     $email = Core_Tools::getInput('_POST', 'email', 'varchar');
     $pass1 = Core_Tools::getInput('_POST', 'password1', 'varchar');
     $pass2 = Core_Tools::getInput('_POST', 'password2', 'varchar');
     $showform = true;
     if ($firstname && $name && $email && $pass1 && $pass2) {
         // Second check: E-mail
         $chk = $db->select('players', array('plid'), "email = '" . $db->escape($email) . "'");
         if (count($chk) == 1) {
             $warning = $text->get('emailFound');
         } else {
             // Seems to be alright... let's continue the quest.
             if ($pass1 != $pass2) {
                 $warning = $text->get('passFault');
             } else {
                 $login->registerAccount($firstname, $email, $pass1, $firstname, $name);
                 $showform = false;
                 if ($login->isLogin()) {
                     // Post a redirect, just to be sure ;-)
                     header('Location: ' . Pages_Page::getUrl('page=register'));
                     return $this->getChooseCompany();
                 } else {
                     return '<p>' . $text->get('done') . '</p>';
                 }
             }
         }
     } elseif ($firstname || $name || $email || $pass1 || $pass2) {
         $warning = $text->get('complete');
     }
     if ($showform) {
         $page = new Core_Template();
         $page->set('form_action', self::getUrl('page=register'));
         $page->set('title', $text->get('title'));
         $page->set('about', $text->get('about'));
         $page->set('contactDetails', $text->get('contactDetails'));
         if (isset($warning)) {
             $page->set('warning', $warning);
         }
         // Form fields
         $page->set('name', $text->get('name'));
         $page->set('firstname', $text->get('firstname'));
         $page->set('email', $text->get('email'));
         $page->set('password1', $text->get('password1'));
         $page->set('password2', $text->get('password2'));
         $page->set('submit', $text->get('submit'));
         // Form field values
         $page->set('name_value', Core_Tools::getInput('_POST', 'name', 'varchar', null));
         $page->set('firstname_value', Core_Tools::getInput('_POST', 'firstname', 'varchar', null));
         $page->set('email_value', Core_Tools::getInput('_POST', 'email', 'varchar', null));
         return $page->parse('register.tpl');
     }
 }
Example #8
0
 function __construct($config, $parameters)
 {
     parent::__construct($config, $parameters);
     $this->auth();
     $this->timezone = new TimeZone($this->fdb, NULL, $this->user);
 }
Example #9
0
 function __construct($config, $parameters)
 {
     parent::__construct($config, $parameters);
 }
Example #10
0
 function __construct($config, $parameters)
 {
     parent::__construct($config, $parameters);
     // error_log('Foodle /login ');
     $this->auth();
 }
Example #11
0
 function __construct($config, $parameters)
 {
     parent::__construct($config, $parameters);
     $this->auth();
 }
Example #12
0
 public function getManageCategories($objShop)
 {
     $login = Core_Login::__getInstance();
     $db = Core_Database::__getInstance();
     $text = Core_Text::__getInstance();
     $text->setFile('shop');
     $text->setSection('categories');
     // Insert new category
     $newcat = Core_Tools::getInput('_POST', 'catname', 'username', false);
     if ($newcat) {
         $db->insert('categories', array('s_id' => $objShop->getId(), 'c_name' => $newcat));
     }
     // Check for remove
     $remove = Core_Tools::getInput('_GET', 'remove', 'int');
     if ($remove > 0) {
         $chk = $db->remove('categories', "c_id = '" . $remove . "' AND s_id = '" . $objShop->getId() . "'");
         if ($chk == 1) {
             $db->remove('categories_prices', "c_id = '" . $remove . "'");
         }
     }
     // Initialize page
     $page = new Core_Template();
     $page->set('title', Core_Tools::putIntoText($text->get('title'), array(Core_Tools::output_varchar($objShop->getName()))));
     // Get a list of categories
     $l = $db->select('categories', array('*'), "s_id = '" . $objShop->getId() . "'");
     foreach ($l as $v) {
         // Check for input prices
         $okay = true;
         $i = 0;
         $updates = array();
         while ($okay && $i < 10) {
             $input = Core_Tools::getInput('_POST', 'price_' . $v['c_id'] . '_' . $i, 'varchar');
             if (!empty($input)) {
                 $updates[$i] = $input;
             }
             $okay = !empty($input);
             $i++;
         }
         // Only process this if true
         if (count($updates) > 0) {
             $db->remove('categories_prices', "c_id = '" . $v['c_id'] . "'");
             foreach ($updates as $catId => $catName) {
                 $db->insert('categories_prices', array('c_id' => $v['c_id'], 'p_id' => $catId, 'c_name' => $catName));
             }
         }
         // Check for new price
         $input = Core_Tools::getInput('_POST', 'price_' . $v['c_id'] . '_' . $i, 'varchar');
         if ($input) {
             $db->insert('categories_prices', array('c_id' => $v['c_id'], 'p_id' => $i - 1, 'c_name' => $input));
         }
         // Fetch the prices
         $prices = array();
         $p = $db->select('categories_prices', array('*'), "c_id = '" . $v['c_id'] . "'");
         $maxi = 0;
         foreach ($p as $vv) {
             $prices[] = array('id' => $v['c_id'], 'name' => Core_Tools::output_varchar($vv['c_name']));
         }
         $page->addListValue('cats', array('name' => Core_Tools::output_varchar($v['c_name']), 'id' => $v['c_id'], 'prices' => $prices, 'remUrl' => Pages_Page::getUrl('page=shop&id=' . $objShop->getId() . '&action=categories&remove=' . $v['c_id'])));
     }
     $page->set('addcat', $text->get('addcat'));
     $page->set('addcat_url', self::getUrl('page=shop&id=' . $objShop->getId() . '&action=categories'));
     $page->set('catname', $text->get('catname'));
     $page->set('addsubmit', $text->get('addsubmit'));
     $page->set('cats', $text->get('cats'));
     $page->set('nocats', $text->get('nocats'));
     $page->set('prices', $text->get('prices'));
     $page->set('newPrice', $text->get('newPrice'));
     $page->set('savePrices', $text->get('savePrices'));
     $page->set('remove', $text->get('remove'));
     $page->set('youSure', addslashes($text->get('youSure')));
     $page->set('about', $text->get('about'));
     return $page->parse('shop_categories.tpl');
 }
Example #13
0
 public function getPoefboekLog($objUser, $bShowDetails = false)
 {
     $db = Core_Database::__getInstance();
     $bShowDetails = $bShowDetails ? true : false;
     $logs = $db->getDataFromQuery($db->customQuery("\n\t\t\t\tSELECT\n\t\t\t\t\t*,\n\t\t\t\t\tUNIX_TIMESTAMP(p.l_date) AS date\n\t\t\t\tFROM\n\t\t\t\t\tplayers_poefboeklog p\n\t\t\t\tLEFT JOIN\n\t\t\t\t\torder_prods o ON p.l_action = 'order' AND p.l_actor = o.o_id AND o.plid = p.plid\n\t\t\t\tLEFT JOIN\n\t\t\t\t\tproducts prod ON o.p_id = prod.p_id\n\t\t\t\tWHERE\n\t\t\t\t\tp.c_id = {$this->getId()} AND \n\t\t\t\t\tp.plid = {$objUser->getId()} \n\t\t\t\t" . (!$bShowDetails ? 'GROUP BY p.l_id ' : null) . "\n\t\t\t\tORDER BY\n\t\t\t\t\tp.l_date DESC\n\t\t\t"));
     $out = array();
     $text = Core_Text::__getInstance();
     foreach ($logs as $v) {
         // Check if there are details available
         if ($bShowDetails && isset($v['p_name']) && isset($v['op_price']) && isset($v['op_amount'])) {
             $details = array('amount' => $v['op_amount'], 'price' => $v['op_price'], 'name' => $v['p_name']);
         } else {
             $details = false;
         }
         // Are we still processing the same unit?
         if (isset($latest) && $latest['id'] == $v['l_id']) {
             if ($details) {
                 $latest['details'][] = $details;
             }
         } else {
             switch ($v['l_action']) {
                 case 'order':
                     $actor_name = $text->get('order', 'poeflog', 'company') . ' #' . $v['l_actor'];
                     $actor_url = Pages_Page::getUrl('page=order&oid=' . $v['l_actor']);
                     break;
                 default:
                     $user = Profile_Member::getMember($v['l_actor']);
                     if ($user->isFound()) {
                         $actor_name = $user->getUsername();
                         $actor_url = 'mailto:' . $user->getEmail();
                     } else {
                         $actor_name = 'user_not_found';
                         $actor_url = '#';
                     }
                     break;
             }
             $aDetails = array();
             if ($details) {
                 $aDetails[] = $details;
             }
             $out[] = array('id' => $v['l_id'], 'date' => $v['date'], 'amount' => $v['l_amount'], 'actor_name' => $actor_name, 'actor_url' => $actor_url, 'newpoef' => $v['l_newpoef'], 'comment' => $v['l_description'], 'details' => $aDetails);
             $latest =& $out[count($out) - 1];
         }
     }
     return $out;
 }
Example #14
0
 private function getOrderOverview($order, $showOnlineVersion = true, $showSended = false, $showNames = true)
 {
     $db = Core_Database::__getInstance();
     $text = Core_Text::__getInstance();
     $text->setFile('order');
     $text->setSection('submit');
     $page = new Core_Template();
     $company = Profile_Company::getCompany($order['c_id']);
     $company->setData($order);
     $shop = Profile_Shop::getShop($order['s_id']);
     $page->set('company', $text->get('company'));
     $page->set('shop', $text->get('shop'));
     $page->set('listProducts', $text->get('listProducts'));
     $page->set('orderId', $order['o_id']);
     $page->set('company_adres', $company->getAdress());
     $page->set('shop_adres', $shop->getAdress());
     $page->set('currency', Core_Tools::output_varchar($shop->getCurrency()));
     $page->set('date', new DateTime($order['o_orderDate']));
     $page->set('thanks', $text->get('thanks'));
     if ($showOnlineVersion && $order['o_isDone'] == 1) {
         $page->set('sendMail', $text->get('sendMail'));
         $page->set('email', $text->get('email'));
         $page->set('sendIt', $text->get('sendIt'));
         $page->set('printIt', $text->get('printIt'));
         if ($showSended) {
             $page->set('sended', $text->get('sended'));
         }
         $page->set('mail_action', Pages_Page::getUrl('page=order&oid=' . $order['o_id']));
     }
     $products = $this->getOrderedProducts($order['o_id']);
     $page->set('table_cols', $showOnlineVersion ? 3 : 2);
     // Fetch the categories for this shop
     $categories = $shop->getCategories();
     foreach ($products as $v) {
         if ($v['op_amount'] > 1) {
             $name = $v['op_amount'] . ' x ' . Core_Tools::output_varchar($v['p_name']);
         } else {
             $name = Core_Tools::output_varchar($v['p_name']);
         }
         // Fetch price name
         $catname = '';
         if (isset($categories[$v['c_id']]) && count($categories[$v['c_id']]['prices']) > 1) {
             if (isset($categories[$v['c_id']]['prices'][$v['p_pid']])) {
                 $catname = ' (' . $categories[$v['c_id']]['prices'][$v['p_pid']]['c_name'] . ')';
             }
         }
         $page->addListValue('products', array($name, $showNames ? Core_Tools::output_varchar($v['realname']) : null, Core_Tools::convert_price($v['op_amount'] * $v['op_price']), $v['op_message'], $catname));
     }
     return $page->parse('order_view.tpl');
 }
Example #15
0
 private function getCompanyOverview($objCompany)
 {
     $text = Core_Text::__getInstance();
     $text->setFile('company');
     $text->setSection('overview');
     $db = Core_Database::__getInstance();
     $login = Core_Login::__getInstance();
     $page = new Core_Template();
     if ($objCompany->isFound()) {
         // Everything okay, let's just continue our path to destruction.
         $page->set('title', Core_Tools::putIntoText($text->get('title'), array(Core_Tools::output_varchar($objCompany->getName()))));
         // Let's go for the other data
         $data = $objCompany->getData();
         foreach ($data as $k => $v) {
             $page->set($k, Core_Tools::output_varchar($v));
         }
         $page->set('adres', $text->get('adres'));
         $page->set('naam', $text->get('naam'));
         $page->set('users', $text->get('users'));
         $page->set('noUsers', $text->get('noUsers'));
         $page->set('listusers', $text->get('listusers'));
         $page->set('shops', $text->get('shops'));
         $page->set('listshops', $text->get('listshops'));
         $page->set('noShops', $text->get('noShops'));
         $page->set('moderate', $text->get('moderate'));
         $users = $objCompany->getUsers();
         $page->set('userAmount', count($users));
         // Get my status in here
         $myself = Profile_Member::getMyself();
         if ($myself) {
             $myStatus = $objCompany->getUserStatus($myself);
             if ($myStatus == 'administrator') {
                 $page->set('admin_user_link', self::getUrl('page=company&id=' . $objCompany->getId() . '&action=userman'));
                 $page->set('admin_user', $text->get('useradmin'));
                 $page->set('admin_edit_link', self::getUrl('page=company&id=' . $objCompany->getId() . '&action=edit'));
                 $page->set('admin_edit', $text->get('edit'));
             }
             if ($myStatus == 'moderator' || $myStatus == 'administrator') {
                 $page->set('admin_shops_link', self::getUrl('page=company&id=' . $objCompany->getId() . '&action=shopman'));
                 $page->set('admin_shops', $text->get('shopadmin'));
                 $page->set('admin_poefboek_link', self::getUrl('page=company&id=' . $objCompany->getId() . '&action=poefboek'));
                 $page->set('admin_poefboek', $text->get('poefboek'));
                 // Poefboek content
                 $page->set('poeftotal', $text->get('poeftotal'));
                 $page->set('poeftotal_value', '&euro; ' . Core_Tools::convert_price($objCompany->getPoefboekTotal()));
             }
             $showPoefboek = true;
         } else {
             $showPoefboek = false;
         }
         foreach ($users as $v) {
             $page->addListValue('users', array(Core_Tools::output_varchar($v[0]->getFullname()), $text->get($v[1], 'userstatus', 'company', $v[1]), $showPoefboek ? Core_Tools::convert_price($v[2]) : null, Pages_Page::getUrl('page=company&id=' . $objCompany->getId() . '&action=poeflog&uid=' . $v[0]->getId())));
         }
         // Broodjeswinkels
         $shops = $objCompany->getShops();
         $page->set('shopAmount', count($shops));
         foreach ($shops as $v) {
             $page->addListValue('shops', array(Core_Tools::output_varchar($v->getName()), $v->canModerate($myself) ? self::getUrl('page=shop&id=' . $v->getId() . '&action=manage') : null, self::getUrl('page=shop&id=' . $v->getId())));
         }
     } else {
         $page->set('title', $text->get('notFound'));
         $page->set('notFound', $text->get('notFoundA'));
     }
     return $page->parse('company_overview.tpl');
 }