示例#1
0
 private function processIMLogin($key, $msg)
 {
     $text = Core_Text::__getInstance();
     $db = Core_Database::__getInstance();
     $commands = explode(' ', $msg);
     $command = array_shift($commands);
     switch ($command) {
         case 'login':
             if (count($commands) == 1) {
                 $email = array_shift($commands);
                 // Search in the database for this user
                 $user = $db->select('players', array('plid', 'realname', 'email'), "email = '" . $db->escape($email) . "'");
                 if (count($user) == 1) {
                     // Invent a new key
                     $passkey = substr(md5(rand(0, 100000)), 0, 6);
                     $db->insert('im_users', array('im_user' => $key, 'im_player' => $user[0]['plid'], 'im_key' => $passkey));
                     // Send the secret key to this user
                     Core_Tools::sendMail($text->get('subject', 'bot', 'main'), Core_Tools::output_text(Core_Tools::putIntoText($text->getFile('mails/bot_activation'), array('name' => $user[0]['realname'], 'key' => $passkey))), $user[0]['email']);
                     echo 'We have found your account. We have sent an email containing a secret key.<br />Please show me the key here.';
                 } else {
                     echo 'This user (' . $username . ') is not found. Please try again, or register at http://www.1brood.be/';
                 }
             } else {
                 echo '"Login" should be followed by your email and password.';
             }
             break;
         default:
             echo 'Please login in 1Brood by typing "Login your_email".<br />';
             echo 'We will start sending out reminders as soon as you are logged in.';
             break;
     }
 }
示例#2
0
 public function sendReminder($company)
 {
     $text = Core_Text::__getInstance();
     $text->setFile('account');
     $text->setSection('reminder');
     $email = $this->getEmail();
     // Get company owner
     $owner = $company->getOwner();
     // Check for negative poefboek
     $poefboek = $company->getMemberPoefboek($this);
     if ($poefboek > 0) {
         $txt = Core_Tools::output_text($text->getFile('mails/reminder'));
     } else {
         $txt = Core_Tools::output_text(Core_Tools::putIntoText($text->getFile('mails/angry_reminder'), array('poefboek' => $poefboek, 'admin' => Core_Tools::output_varchar($owner->getFullname()))));
     }
     if ($owner) {
         Core_Tools::sendMail($text->get('subject'), $txt, $email, $this->getFullname(), $owner->getFullname(), $owner->getEmail(), false);
     }
     // Notify members by message:
     $db = Core_Database::__getInstance();
     $accounts = $db->select('im_users', array('im_user'), "im_player = " . $this->getId() . " AND im_activated = 1");
     $url = 'https://www.imified.com/api/bot/';
     foreach ($accounts as $v) {
         $data = array('botkey' => '53881418-A97D-9713-415C46EA2843C806', 'apimethod' => 'send', 'userkey' => $v['im_user'], 'msg' => 'Tijd voor broodjes! Ga snel naar http://www.1brood.be/ !');
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_HEADER, 0);
         curl_setopt($ch, CURLOPT_USERPWD, 'daedelson@gmail.com:aukv0006');
         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_TIMEOUT, 100);
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
         $xml = curl_exec($ch);
         if (!$xml) {
             echo curl_error($ch);
         }
         curl_close($ch);
     }
 }
示例#3
0
 public function getOverview($shop)
 {
     /*
     $login = Core_Login::__getInstance ();
     $db = Core_Database::__getInstance ();
     
     $text = Core_Text::__getInstance ();
     $text->setFile ('shop');
     $text->setSection ('overview');
     
     $page = new Core_Template ();
     
     // Fetch the title
     $page->set
     (
     	'title',
     	Core_Tools::putIntoText
     	(
     		$text->get ('title'),
     		array
     		(
     			Core_Tools::output_varchar ($objShop->getName ())
     		)
     	)
     );
     
     $page->set ('products', $text->get ('products'));
     $page->set ('noProducts', $text->get ('noProducts'));
     
     // Loop products
     $products = $objShop->getProducts ();
     
     foreach ($products as $v)
     {
     	$page->addListValue
     	(
     		'products',
     		array
     		(
     			Core_Tools::output_varchar ($v['p_name']),
     			Core_Tools::output_varchar ($v['p_info']),
     			$v['p_price']
     		)
     	);
     }
     
     $page->set ('currency', Core_Tools::output_varchar ($objShop->getCurrency ()));
     
     return $page->parse ('shop_overview.tpl');
     */
     $text = Core_Text::__getInstance();
     $text->setFile('order');
     $text->setSection('products');
     $page = new Core_Template();
     if ($shop->canModerate(Profile_Member::getMyself())) {
         $page->set('manage_url', self::getUrl('page=shop&id=' . $shop->getId() . '&action=manage'));
         $page->set('moderator_url', self::getUrl('page=shop&id=' . $shop->getId() . '&action=moderator'));
     }
     $page->set('title', Core_Tools::putIntoText($text->get('title', 'overview', 'shop'), array(Core_Tools::output_varchar($shop->getName()))));
     if (isset($poefboek)) {
         $page->set('poefboek', Core_Tools::putIntoText($text->get('poefboek'), array($poefboek, $shop->getCurrency())));
         $page->set('poefboek_value', $poefboek);
     }
     $categories = $shop->getCategories(true);
     $page->set('order', $text->get('order', 'products', 'order'));
     $page->set('currency', $shop->getCurrency());
     $page->set('noProducts', $text->get('noProducts'));
     $page->set('products', $text->get('products'));
     $page->set('message', Core_Tools::output_text($shop->getMessage()));
     $products = $shop->getProducts();
     foreach ($products as $v) {
         if (!isset($catProducts[$v['c_id']])) {
             $catProducts[$v['c_id']] = array();
         }
         $catProducts[$v['c_id']][] = $v;
     }
     foreach ($categories as $category) {
         $orderUrl = array();
         $newProducts = array();
         if (isset($catProducts[$category['c_id']])) {
             foreach ($catProducts[$category['c_id']] as $v) {
                 $oUrls = array();
                 foreach ($orderUrl as $key => $url) {
                     $oUrls[$key] = self::getUrl($url . '&pid=' . $v['p_id']);
                 }
                 $newProducts[] = array(Core_Tools::output_varchar($v['p_name']), Core_Tools::output_varchar($v['p_info']), $v['prices'], $oUrls);
             }
         }
         $page->addListValue('categories', array('name' => $category['c_name'], 'products' => $newProducts, 'prices' => $category['prices']));
     }
     // Show all moderators
     foreach ($shop->getModerators() as $v) {
         $page->addListValue('moderators', array('name' => Core_Tools::output_varchar($v->getFullname()), 'url' => 'mailto:' . $v->getEmail()));
     }
     return $page->parse('shop_products.tpl');
 }
示例#4
0
 private function getChooseProduct($company, $shop)
 {
     $text = Core_Text::__getInstance();
     $text->setFile('order');
     $text->setSection('products');
     $page = new Core_Template();
     $this->setPageTitle($page, $company, $shop);
     // Fetch thze poefboek
     $myself = Profile_Member::getMyself();
     $poefboek = $company->getMemberPoefboek($myself);
     $page->set('poefboek', Core_Tools::putIntoText($text->get('poefboek'), array($poefboek, $shop->getCurrency())));
     $categories = $shop->getCategories(true);
     $page->set('poefboek_value', $poefboek);
     $page->set('order', $text->get('order', 'products', 'order'));
     $page->set('currency', $shop->getCurrency());
     $page->set('noProducts', $text->get('noProducts'));
     $page->set('products', $text->get('products'));
     $page->set('message', Core_Tools::output_text($shop->getMessage()));
     $products = $shop->getProducts();
     foreach ($products as $v) {
         if (!isset($catProducts[$v['c_id']])) {
             $catProducts[$v['c_id']] = array();
         }
         $catProducts[$v['c_id']][] = $v;
     }
     foreach ($categories as $category) {
         $orderUrl = array();
         foreach ($category['prices'] as $price) {
             $orderUrl[$price['p_id']] = 'page=order&cid=' . $company->getId() . '&sid=' . $shop->getId() . '&price=' . $price['p_id'];
         }
         $newProducts = array();
         if (isset($catProducts[$category['c_id']])) {
             foreach ($catProducts[$category['c_id']] as $v) {
                 $oUrls = array();
                 foreach ($orderUrl as $key => $url) {
                     $oUrls[$key] = self::getUrl($url . '&pid=' . $v['p_id']);
                 }
                 $newProducts[] = array(Core_Tools::output_varchar($v['p_name']), Core_Tools::output_varchar($v['p_info']), $v['prices'], $oUrls);
             }
         }
         $page->addListValue('categories', array('name' => $category['c_name'], 'products' => $newProducts, 'prices' => $category['prices']));
     }
     return $page->parse('order_products.tpl');
 }