示例#1
0
 /**
  * @desc Конструктор
  */
 public function __construct()
 {
     parent::__construct();
     if (cmsController::getInstance()->getCurrentMode() == "admin") {
         $regedit = regedit::getInstance();
         $systemEdition = $regedit->getVal("//modules/autoupdate/system_edition");
         $patches_disabled = false;
         if (strpos($systemEdition, 'trial') !== false || strpos($systemEdition, 'commerce_enc') !== false || strpos($systemEdition, 'start') !== false) {
             $patches_disabled = true;
         }
         if ($patches_disabled) {
             $regedit->setVar("//modules/autoupdate/disable_patches", "1");
         } else {
             $regedit->setVar("//modules/autoupdate/disable_patches", "0");
         }
         $commonTabs = $this->getCommonTabs();
         if ($commonTabs && !$patches_disabled) {
             $commonTabs->add('versions');
             $commonTabs->add('patches');
         }
         $this->__loadLib("__admin.php");
         $this->__implement("__autoupdate");
         $this->__loadLib("__json.php");
         $this->__implement("__json_autoupdate");
     }
 }
 public function tagsCloud($template = "default", $limit = 50, $max_font_size = 16)
 {
     list($template_block, $template_line, $template_separator) = def_module::loadTemplates("stat/" . $template, "tags_block", "tags_block_line", "tags_separator");
     $factory = new statisticFactory(dirname(__FILE__) . '/classes');
     $factory->isValid('allTags');
     $report = $factory->get('allTags');
     $report->setStart(0);
     $report->setFinish(strtotime("+1 day", time()));
     $result = $report->get();
     $max = $result['max'];
     $lines = array();
     $i = 0;
     $sz = sizeof($result['labels']);
     for ($i = 0; $i < min($sz, $limit); $i++) {
         $label = $result['labels'][$i];
         $line_arr = array();
         $tag = $label['tag'];
         $cnt = $label['cnt'];
         $fontSize = ceil($max_font_size * ($cnt / $max));
         $line_arr['node:tag'] = $tag;
         $line_arr['attribute:cnt'] = $cnt;
         $line_arr['attribute:font-size'] = $fontSize;
         $line_arr['void:separator'] = $i < $sz - 1 ? $template_separator : "";
         $line_arr['void:font_size'] = $fontSize;
         $lines[] = def_module::parseTemplate($template_line, $line_arr);
     }
     $block_arr = array();
     $block_arr['subnodes:lines'] = $lines;
     $block_arr['total'] = $sz;
     $block_arr['per_page'] = $limit;
     return def_module::parseTemplate($template_block, $block_arr);
 }
示例#3
0
 public function getGuideList($id, $template = 'guidelist', $arrayOnly = false)
 {
     if (!$id) {
         return null;
     }
     //id справочника
     $o = umiObjectsCollection::getInstance();
     $items = $o->getGuidedItems($id);
     if (!sizeof($items)) {
         return null;
     }
     if ($arrayOnly) {
         return $items;
     }
     list($guide_block, $guide_item) = def_module::loadTemplates("catalog/{$template}.tpl", "guide_block", "guide_item");
     $s = '';
     $block_array = array();
     foreach ($items as $k => $v) {
         $line_array = array();
         $line_array['id'] = $k;
         $line_array['name'] = $items[$k];
         $s .= def_module::parseTemplate($guide_item, $line_array);
     }
     $block_array['lines'] = $s;
     unset($items);
     $s = def_module::parseTemplate($guide_block, $block_array);
     return $s;
 }
示例#4
0
 public function process($template = null)
 {
     $this->order->order();
     $currency = strtoupper(mainConfiguration::getInstance()->get('system', 'default-currency'));
     // NB! Possible values for PayOnline are RUB (not RUR!), EUR and USD
     if (!in_array($currency, array('RUB', 'EUR', 'USD'))) {
         $currency = 'RUB';
     }
     $merchantId = $this->object->merchant_id;
     $privateKey = $this->object->private_key;
     $orderId = $this->order->getId();
     $amount = number_format($this->order->getActualPrice(), 2, '.', '');
     $keyString = "MerchantId={$merchantId}&OrderId={$orderId}&Amount={$amount}&Currency={$currency}&PrivateSecurityKey={$privateKey}";
     $securityKey = md5($keyString);
     $formAction = "?MerchantId={$merchantId}&OrderId={$orderId}&Amount={$amount}&Currency={$currency}&SecurityKey={$securityKey}&order-id={$orderId}";
     $formAction = "https://secure.payonlinesystem.com/ru/payment/" . $formAction;
     $param = array();
     $param['formAction'] = $formAction;
     $param['MerchantId'] = $merchantId;
     $param['OrderId'] = $orderId;
     $param['Amount'] = $amount;
     $param['Currency'] = $currency;
     $param['SecurityKey'] = $securityKey;
     $param['orderId'] = $orderId;
     $param['ReturnUrl'] = 'http://' . cmsController::getInstance()->getCurrentDomain()->getHost();
     $this->order->setPaymentStatus('initialized');
     list($templateString) = def_module::loadTemplates("emarket/payment/payonline/" . $template, "form_block");
     return def_module::parseTemplate($templateString, $param);
 }
示例#5
0
 public function process($template = null)
 {
     $this->order->order();
     $currency = strtoupper(mainConfiguration::getInstance()->get('system', 'default-currency'));
     if ($currency == 'RUR') {
         $currency = 'RUB';
     }
     $amount = number_format($this->order->getActualPrice(), 2, '.', '');
     $orderId = $this->order->getId() . '.' . time();
     $merchantId = $this->object->mnt_id;
     $dataIntegrityCode = $this->object->mnt_data_integrity_code;
     $successUrl = $this->object->mnt_success_url;
     $failUrl = $this->object->mnt_fail_url;
     $testMode = $this->object->mnt_test_mode;
     $systemUrl = $this->object->mnt_system_url;
     if (empty($testMode)) {
         $testMode = 0;
     }
     $signature = md5("{$merchantId}{$orderId}{$amount}{$currency}{$testMode}{$dataIntegrityCode}");
     $param = array();
     $param['formAction'] = "https://{$systemUrl}/assistant.htm";
     $param['mntId'] = $merchantId;
     $param['mnTransactionId'] = $orderId;
     $param['mntCurrencyCode'] = $currency;
     $param['mntAmount'] = $amount;
     $param['mntTestMode'] = $testMode;
     $param['mntSignature'] = $signature;
     $param['mntSuccessUrl'] = $successUrl;
     $param['mntFailUrl'] = $failUrl;
     $this->order->setPaymentStatus('initialized');
     list($templateString) = def_module::loadTemplates("emarket/payment/payanyway/" . $template, "form_block");
     return def_module::parseTemplate($templateString, $param);
 }
示例#6
0
 public function versions()
 {
     $regedit = regedit::getInstance();
     $systemEdition = $regedit->getVal("//modules/autoupdate/system_edition");
     $systemEditionStatus = "%autoupdate_edition_" . $systemEdition . "%";
     if ($systemEdition == "commerce_trial" && $_SERVER['HTTP_HOST'] != 'localhost' && $_SERVER['HTTP_HOST'] != 'subdomain.localhost' && $_SERVER['SERVER_ADDR'] != '127.0.0.1') {
         $daysLeft = $regedit->getDaysLeft();
         $systemEditionStatus .= " ({$daysLeft} " . getLabel('label-days-left') . ")";
     }
     $systemEditionStatus = def_module::parseTPLMacroses($systemEditionStatus);
     $params = array("autoupdate" => array("status:system-edition" => NULL, "status:last-updated" => NULL, "status:system-version" => NULL, "status:system-build" => NULL, "status:db-driver" => NULL, "boolean:disabled" => NULL, "boolean:patches-disabled" => NULL));
     $params['autoupdate']['status:system-version'] = $regedit->getVal("//modules/autoupdate/system_version");
     $params['autoupdate']['status:system-build'] = $regedit->getVal("//modules/autoupdate/system_build");
     $params['autoupdate']['boolean:patches-disabled'] = (int) ($patches_disabled = $regedit->getVal("//modules/autoupdate/disable_patches"));
     $params['autoupdate']['status:system-edition'] = $systemEditionStatus;
     $params['autoupdate']['status:last-updated'] = date("Y-m-d H:i:s", $regedit->getVal("//modules/autoupdate/last_updated"));
     $db_driver = "mysql";
     if (defined("DB_DRIVER")) {
         $db_driver = DB_DRIVER;
     }
     $params['autoupdate']['status:db-driver'] = $db_driver;
     $autoupdates_disabled = false;
     if (defined("CURRENT_VERSION_LINE")) {
         if (in_array(CURRENT_VERSION_LINE, array("start", "demo"))) {
             $autoupdates_disabled = true;
         }
     }
     $params['autoupdate']['boolean:disabled'] = (int) $autoupdates_disabled;
     $this->setDataType("settings");
     $this->setActionType("view");
     $data = $this->prepareData($params, "settings");
     $this->setData($data);
     return $this->doData();
 }
示例#7
0
 public function __admin()
 {
     parent::__admin();
     if (cmsController::getInstance()->getCurrentMode() == "admin" && !class_exists("__imp__" . get_class($this))) {
         $this->__loadLib("__config.php");
         $this->__implement("__config_" . get_class($this));
         $this->__loadLib("__messages.php");
         $this->__implement("__messages_users");
         $this->__loadLib("__custom_adm.php");
         $this->__implement("__custom_adm_users");
     } else {
         $this->__loadLib("__register.php");
         $this->__implement("__register_users");
         $this->__loadLib("__forget.php");
         $this->__implement("__forget_users");
         $this->__loadLib("__profile.php");
         $this->__implement("__profile_users");
         $this->__loadLib("__list.php");
         $this->__implement("__list_users");
         $this->__loadLib("__custom.php");
         $this->__implement("__custom_users");
     }
     $this->__loadLib("__loginza.php");
     $this->__implement("__loginza_" . get_class($this));
     $this->__loadLib("__import.php");
     $this->__implement("__imp__" . get_class($this));
     $this->__loadLib("__author.php");
     $this->__implement("__author_users");
     $this->__loadLib("__settings.php");
     $this->__implement("__settings_users");
 }
示例#8
0
 public function process($template = null)
 {
     list($tpl_block, $tpl_item) = def_module::loadTemplates("emarket/payment/invoice/" . $template, 'legal_person_block', 'legal_person_item');
     $collection = umiObjectsCollection::getInstance();
     $types = umiObjectTypesCollection::getInstance();
     $typeId = $types->getBaseType("emarket", "legal_person");
     $customer = customer::get();
     $order = $this->order;
     $mode = getRequest('param2');
     if ($mode == 'do') {
         $personId = getRequest('legal-person');
         $isNew = $personId == null || $personId == 'new';
         if ($isNew) {
             $typeId = $types->getBaseType("emarket", "legal_person");
             $personId = $collection->addObject("", $typeId);
             $controller = cmsController::getInstance();
             $data = getRequest('data');
             if ($data && ($dataModule = $controller->getModule("data"))) {
                 $person = $collection->getObject($personId);
                 $person->setName($data['new']['name']);
                 $dataModule->saveEditedObject($personId, $isNew, true);
             }
             if ($collection->getObject($personId) instanceof umiObject) {
                 $customer = customer::get();
                 $customer->legal_persons = array_merge($customer->legal_persons, array($personId));
             }
         }
         $order->legal_person = $personId;
         $order->order();
         $order->payment_document_num = $order->id;
         $result = $this->printInvoice($order);
         $buffer = outputBuffer::current();
         $buffer->charset('utf-8');
         $buffer->contentType('text/html');
         $buffer->clear();
         $buffer->push($result);
         $buffer->end();
         return true;
     } else {
         if ($mode == 'delete') {
             $personId = (int) getRequest('person-id');
             if ($collection->isExists($personId)) {
                 $customer = customer::get();
                 $customer->legal_persons = array_diff($customer->legal_persons, array($personId));
                 $collection->delObject($personId);
             }
         }
     }
     $items = array();
     $persons = $customer->legal_persons;
     if (is_array($persons)) {
         foreach ($persons as $personId) {
             $person = $collection->getObject($personId);
             $item_arr = array('attribute:id' => $personId, 'attribute:name' => $person->name);
             $items[] = def_module::parseTemplate($tpl_item, $item_arr, false, $personId);
         }
     }
     $block_arr = array('attribute:type-id' => $typeId, 'attribute:type_id' => $typeId, 'xlink:href' => 'udata://data/getCreateForm/' . $typeId, 'subnodes:items' => $items);
     return def_module::parseTemplate($tpl_block, $block_arr);
 }
 public function __construct($v78e731027d8fd50ed642340b7c9a63b3, $vc13367945d5d4c91047b3b50234aa7ab = 0, $vd6ccd2379d1965a49b998d0f4207337d = "")
 {
     baseException::$catchedExceptions[$this->getId()] = $this;
     $this->strcode = $vd6ccd2379d1965a49b998d0f4207337d;
     $v78e731027d8fd50ed642340b7c9a63b3 = def_module::parseTPLMacroses($v78e731027d8fd50ed642340b7c9a63b3);
     parent::__construct($v78e731027d8fd50ed642340b7c9a63b3, $vc13367945d5d4c91047b3b50234aa7ab);
 }
示例#10
0
 public function profile($template = "default", $user_id = false)
 {
     if (!$template) {
         $template = "default";
     }
     list($template_block, $template_bad_user_block) = def_module::loadTemplates("users/profile/" . $template, "profile_block", "bad_user_block");
     $block_arr = array();
     if (!$user_id) {
         $user_id = (int) getRequest('param0');
     }
     if (!$user_id) {
         $permissions = permissionsCollection::getInstance();
         if ($permissions->isAuth()) {
             $user_id = $permissions->getUserId();
         }
     }
     if ($user = selector::get('object')->id($user_id)) {
         $this->validateEntityByTypes($user, array('module' => 'users', 'method' => 'user'));
         $block_arr['xlink:href'] = "uobject://" . $user_id;
         $userTypeId = $user->getTypeId();
         if ($userType = umiObjectTypesCollection::getInstance()->getType($userTypeId)) {
             $userHierarchyTypeId = $userType->getHierarchyTypeId();
             if ($userHierarchyType = umiHierarchyTypesCollection::getInstance()->getType($userHierarchyTypeId)) {
                 if ($userHierarchyType->getName() == "users" && $userHierarchyType->getExt() == "user") {
                     $block_arr['id'] = $user_id;
                     return def_module::parseTemplate($template_block, $block_arr, false, $user_id);
                 }
             }
         }
     } else {
         throw new publicException(getLabel('error-object-does-not-exist', null, $user_id));
     }
     return def_module::parseTemplate($template_bad_user_block, $block_arr);
 }
示例#11
0
		public function __construct () {
			parent::__construct ();

			$commonTabs = $this->getCommonTabs();
			if($commonTabs) {
				$commonTabs->add('import');
				$commonTabs->add('export');
			}

			if(cmsController::getInstance()->getCurrentMode() == "admin") {
				$this->__loadLib("__admin.php");
				$this->__implement("__exchange");

				$this->__loadLib("__import.php");
				$this->__implement("__exchange_import");
			}

			$this->__loadLib("__custom.php");
			$this->__implement("__custom_exchange");

			$this->__loadLib("__export.php");
			$this->__implement("__exchange_export");

			// 1C Auto integration
			$this->__loadLib("__auto.php");
			$this->__implement("__exchange_auto");
		}
示例#12
0
 public function list_users($template = "default", $per_page = 10)
 {
     list($template_block, $template_block_item) = $this->loadTemplates("users/list_users/" . $template, "block", "block_item");
     $block_arr = array();
     $curr_page = (int) getRequest('p');
     $type_id = umiObjectTypesCollection::getInstance()->getBaseType("users", "user");
     $type = umiObjectTypesCollection::getInstance()->getType($type_id);
     $is_active_field_id = $type->getFieldId('is_activated');
     $sel = new umiSelection();
     $sel->addLimit($per_page, $curr_page);
     $sel->addObjectType($type_id);
     $sel->addPropertyFilterEqual($is_active_field_id, true);
     $this->autoDetectOrders($sel, $type_id);
     $this->autoDetectFilters($sel, $type_id);
     $result = umiSelectionsParser::runSelection($sel);
     $total = umiSelectionsParser::runSelectionCounts($sel);
     $items = array();
     foreach ($result as $user_id) {
         $item_arr = array();
         $item_arr['void:user_id'] = $user_id;
         $item_arr['attribute:id'] = $user_id;
         $item_arr['xlink:href'] = "uobject://" . $user_id;
         $items[] = def_module::parseTemplate($template_block_item, $item_arr, false, $user_id);
     }
     $block_arr['subnodes:items'] = $items;
     $block_arr['per_page'] = $per_page;
     $block_arr['total'] = $total;
     return def_module::parseTemplate($template_block, $block_arr);
 }
示例#13
0
 public function __construct()
 {
     parent::__construct();
     if (cmsController::getInstance()->getCurrentMode() == "admin") {
         $commonTabs = $this->getCommonTabs();
         if ($commonTabs) {
             $commonTabs->add('lists', array('confs_list'));
             $commonTabs->add('last_messages');
         }
         // admin mode methods
         $this->__loadLib("__admin.php");
         $this->__implement("__forum");
         // custom admin methods
         $this->__loadLib("__custom_adm.php");
         $this->__implement("__custom_adm_forum");
     } else {
         // front-end events handlers methods
         $this->__loadLib("__sysevents.php");
         $this->__implement("__sysevents_forum");
         // front-end custom methods
         $this->__loadLib("__custom.php");
         $this->__implement("__custom_forum");
     }
     // common (admin and front-end) events handlers methods
     $this->__loadLib("__events_handlers.php");
     $this->__implement("__events_handlers_forum");
     if ($per_page = (int) regedit::getInstance()->getVal("//modules/forum/per_page")) {
         $this->per_page = $per_page;
     }
 }
示例#14
0
 public function process($template = null)
 {
     $productId = $this->object->product_id;
     $siteId = $this->object->site_id;
     $productName = $this->order->getId();
     $cmsController = cmsController::getInstance();
     $language = strtolower($cmsController->getCurrentLang()->getPrefix());
     switch ($language) {
         case 'ru':
             $language = 'ru';
             break;
         default:
             $language = 'en';
             break;
     }
     $this->order->order();
     $productPrice = $this->order->getActualPrice();
     $secretCode = $this->object->secret;
     $priceString = number_format($productPrice, 2, '.', '');
     $sign = md5($productId . '-' . $priceString . '-' . $secretCode);
     $answerUrl = $cmsController->getCurrentDomain()->getHost() . "/emarket/gateway/" . $this->order->getId() . "/";
     $param = array();
     $param["formAction"] = "https://payments.chronopay.com/index.php";
     $param["product_id"] = $productId;
     $param["product_price"] = $productPrice;
     $param["language"] = $language;
     $param["order_id"] = $this->order->getId();
     $param["cb_type"] = "P";
     $param["cb_url"] = $answerUrl;
     $param["decline_url"] = $cmsController->getCurrentDomain()->getHost();
     $param["sign"] = $sign;
     $this->order->setPaymentStatus('initialized');
     list($templateString) = def_module::loadTemplates("emarket/payment/chronopay/" . $template, "form_block");
     return def_module::parseTemplate($templateString, $param);
 }
示例#15
0
		public function shared_file($template = "default", $element_path = false) {
			if(!$template) $template = "default";
			list($s_download_file, $s_broken_file, $s_upload_file) = def_module::loadTemplates("filemanager/".$template, "shared_file", "broken_file", "upload_file");

			$element_id = $this->analyzeRequiredPath($element_path);

			$element = umiHierarchy::getInstance()->getElement($element_id);

			$block_arr = Array();
			$template_block = $s_broken_file;
			if ($element) {
				// upload file if allowed
				$iUserId = cmsController::getInstance()->getModule('users')->user_id;
				list($bAllowRead, $bAllowWrite) = permissionsCollection::getInstance()->isAllowedObject($iUserId, $element_id);
				$block_arr['upload_file'] = "";
				if ($bAllowWrite) {
					$block_arr['upload_file'] = $s_upload_file;
					// upload first file in $_FILES
					if (count($_FILES)) {
						$oUploadedFile = umiFile::upload("shared_files", "upload", "./files/");
						if ($oUploadedFile instanceof umiFile) {
							$element->setValue("fs_file", $oUploadedFile);
							$element->commit();
						}
					}
				}

				$block_arr['id'] = $element_id;
				$block_arr['descr'] = ($descr = $element->getValue("descr")) ? $descr : $element->getValue("content");
				$block_arr['alt_name'] = $element->getAltName();
				$block_arr['link'] = umiHierarchy::getInstance()->getPathById($element_id);
				// file
				$block_arr['download_link'] = "";
				$block_arr['file_name'] = "";
				$block_arr['file_size'] = 0;

				$o_file = $element->getValue("fs_file");

				if ($o_file instanceof umiFile) {
					if (!$o_file->getIsBroken()) {
						$template_block = $s_download_file;
						$block_arr['download_link'] = $this->pre_lang."/filemanager/download/".$element_id;
						$block_arr['file_name'] = $o_file->getFileName();
						$block_arr['file_size'] = round($o_file->getSize()/1024, 2);
					}
				}
			} else {
				return cmsController::getInstance()->getModule("users")->auth();
			}

			$this->pushEditable("filemanager", "shared_file", $element_id);

			return self::parseTemplate($template_block, $block_arr);
		}
示例#16
0
		public function onDispatchChanges(iUmiEventPoint $oEvent) {
			$sTemplate = "default";

			try {
				list($sTemplateSubject, $sTemplateMessage) = def_module::loadTemplatesForMail("forum/mails/".$sTemplate, "mail_subject", "mail_message");
			} catch (publicException $e) {
				return false;
			}

			$iTopicId = $oEvent->getParam("topic_id");
			$iMessageId = $oEvent->getParam("message_id");
			$message = umiHierarchy::getInstance()->getElement($iMessageId);

			$sel = new selector('objects');
			$sel->types('object-type')->name("users", "user");
			$sel->where('subscribed_pages')->equals($iTopicId);
			
			if (!$sel->length()) return false;

			$hierarchy = umiHierarchy::getInstance();

			$block_arr = Array();

			$sTemplateSubject = def_module::parseTemplateForMail($sTemplateSubject, $block_arr, $iMessageId);
			
			$sFromEmail = regedit::getInstance()->getVal("//settings/email_from");
			$sFromFio = regedit::getInstance()->getVal("//settings/fio_from");

			$oMail = new umiMail();
			$oMail->setFrom($sFromEmail, $sFromFio);
			$oMail->setSubject($sTemplateSubject);

			foreach($sel->result() as $oUser) {
				$oMailUser = clone $oMail;
				$sUserMail = $oUser->getValue('e-mail');
				$block_arr['h1'] = $message->getValue('h1');
				$block_arr['message'] = $message->getValue('message');

				$hierarchy->forceAbsolutePath(true);
				$block_arr['unsubscribe_link'] = $hierarchy->getPathById($iTopicId) . "?unsubscribe=" . base64_encode($iUserId);
				$sTemplateMessageUser = def_module::parseTemplateForMail($sTemplateMessage, $block_arr, $iMessageId);
				$oMailUser->setContent($sTemplateMessageUser);
				$hierarchy->forceAbsolutePath(false);

				if (umiMail::checkEmail($sUserMail)) {
					$sUserFio = $oUser->getValue('lname') . " ". $oUser->getValue('fname') . " " . $oUser->getValue('father_name');
					$oMailUser->addRecipient($sUserMail, $sUserFio);
					$oMailUser->commit();
					$oMailUser->send();
				}
				else continue;
			}
			return true;
		}
示例#17
0
 public function __construct()
 {
     parent::__construct();
     if (cmsController::getInstance()->getCurrentMode() == "admin") {
         $this->__loadLib("__admin.php");
         $this->__implement("__search");
     } else {
         $this->__loadLib("__custom.php");
         $this->__implement("__custom_search");
         $this->per_page = regedit::getInstance()->getVal("//modules/search/per_page");
     }
 }
示例#18
0
 public function process($template = null)
 {
     $this->order->order();
     $currency = strtoupper(mainConfiguration::getInstance()->get('system', 'default-currency'));
     $amount = number_format($this->order->getActualPrice(), 2, '.', '');
     $orderId = $this->order->getId();
     $mnt_ubrir_id = $this->object->mnt_ubrir_id;
     $mnt_secret_key = $this->object->mnt_secret_key;
     $mnt_uni_id = $this->object->mnt_uni_id;
     $mnt_uni_login = $this->object->mnt_uni_login;
     $mnt_uni_pass = $this->object->mnt_uni_pass;
     $mnt_uni_emp = $this->object->mnt_uni_emp;
     $mnt_two = $this->object->mnt_two;
     $cmsController = cmsController::getInstance();
     $answerUrl = 'http://' . $cmsController->getCurrentDomain()->getHost() . "/emarket/gateway/" . $this->order->getId() . '/';
     $failUrl = 'http://' . $cmsController->getCurrentDomain()->getHost() . '/emarket/purchase/result/fail/';
     $successUrl = 'http://' . $cmsController->getCurrentDomain()->getHost() . '/emarket/purchase/result/successful/';
     if (is_array($mnt_ubrir_id)) {
         $mnt_ubrir_id = $mnt_ubrir_id[0];
     }
     if (is_array($mnt_secret_key)) {
         $mnt_secret_key = $mnt_secret_key[0];
     }
     $bankHandler = new Ubrir(array('shopId' => $mnt_ubrir_id, 'order_id' => $orderId, 'sert' => $mnt_secret_key, 'amount' => $amount, 'approve_url' => $answerUrl, 'cancel_url' => $failUrl, 'decline_url' => $failUrl));
     $response_order = $bankHandler->prepare_to_pay();
     $new_order_twpg = l_mysql_query('INSERT INTO `umi_twpg` (`umi_id`, `twpg_id`, `session_id`) VALUES ("' . $orderId . '", "' . $response_order->OrderID[0] . '", "' . $response_order->SessionID[0] . '")');
     $param = array();
     if (is_array($mnt_uni_id)) {
         $mnt_uni_id = $mnt_uni_id[0];
     }
     //if(is_array($mnt_uni_login))
     if (is_array($mnt_uni_pass)) {
         $mnt_uni_pass = $mnt_uni_pass[0];
     }
     //var_dump($mnt_uni_login); die;
     $param['sign'] = strtoupper(md5(md5($mnt_uni_id) . '&' . md5($mnt_uni_login) . '&' . md5($mnt_uni_pass) . '&' . md5($orderId) . '&' . md5($amount)));
     $param['twpg_url'] = $response_order->URL[0] . '?orderid=' . $response_order->OrderID[0] . '&sessionid=' . $response_order->SessionID[0];
     $param['uni_id'] = $mnt_uni_id;
     $param['uni_login'] = $mnt_uni_login;
     $param['amount'] = $amount;
     $param['order_id'] = $orderId;
     $param['urlno'] = $failUrl;
     $param['urlok'] = $successUrl;
     if ($mnt_two == 1) {
         $param['uni_submit'] = ' <INPUT TYPE="button" onclick="document.forms.uniteller.submit()" value="Оплатить MasterCard">';
     } else {
         $param['uni_submit'] = '';
     }
     $this->order->setPaymentStatus('initialized');
     list($templateString) = def_module::loadTemplates("tpls/emarket/payment/ubrir/ubrir.tpl", "form_block");
     return def_module::parseTemplate($templateString, $param);
 }
示例#19
0
 public function view($elementPath = "", $template = "default")
 {
     if ($this->breakMe()) {
         return;
     }
     $hierarchy = umiHierarchy::getInstance();
     list($template_block) = def_module::loadTemplates("tpls/modulelements/{$template}.tpl", "view");
     $elementId = $this->analyzeRequiredPath($elementPath);
     //echo $elementId;
     $element = $hierarchy->getElement($elementId);
     templater::pushEditable("modulelements", "item_element", $element->id);
     return self::parseTemplate($template_block, array('id' => $element->id), $element->id);
 }
 public function confirmUserAnswer($oElement)
 {
     $bConfirmUserAnswer = (bool) regedit::getInstance()->getVal("//modules/faq/confirm_user_answer");
     if (!$bConfirmUserAnswer) {
         return true;
     }
     if ($oElement instanceof umiHierarchyElement && $oElement->getIsActive()) {
         $iAuthorId = $oElement->getValue("author_id");
         $author_name = "";
         $author_email = "";
         $oAuthor = umiObjectsCollection::getInstance()->getObject($iAuthorId);
         if ($oAuthor instanceof umiObject) {
             $author_user = null;
             if ($oAuthor->getValue("is_registrated")) {
                 $user_id = $oAuthor->getValue("user_id");
                 $author_user = umiObjectsCollection::getInstance()->getObject($user_id);
             }
             if ($author_user instanceof umiObject) {
                 // author user
                 $author_name = $author_user->getValue("lname") . " " . $author_user->getValue("fname");
                 $author_email = $author_user->getValue("e-mail");
             } else {
                 // author guest
                 $author_name = $oAuthor->getValue("nickname");
                 $author_email = $oAuthor->getValue("email");
             }
         }
         if (umiMail::checkEmail($author_email)) {
             list($sMailSubject, $sMailBody) = def_module::loadTemplatesForMail("faq/default", "answer_mail_subj", "answer_mail");
             $block_arr = array();
             $block_arr['domain'] = $sDomain = $_SERVER['HTTP_HOST'];
             $block_arr['element_id'] = $iElementId = $oElement->getId();
             $block_arr['author_id'] = $oElement->getValue("author_id");
             $bOldFHStatus = umiHierarchy::getInstance()->forceAbsolutePath(true);
             $block_arr['question_link'] = umiHierarchy::getInstance()->getPathById($iElementId);
             umiHierarchy::getInstance()->forceAbsolutePath($bOldFHStatus);
             $block_arr['ticket'] = $iElementId;
             $sSubject = def_module::parseTemplateForMail($sMailSubject, $block_arr, $iElementId);
             $sBody = def_module::parseTemplateForMail($sMailBody, $block_arr, $iElementId);
             $from = regedit::getInstance()->getVal("//settings/fio_from");
             $from_email = regedit::getInstance()->getVal("//settings/email_from");
             $oMail = new umiMail();
             $oMail->addRecipient($author_email);
             $oMail->setFrom($from_email, $from);
             $oMail->setSubject($sSubject);
             $oMail->setContent($sBody);
             $oMail->commit();
         }
     }
     return true;
 }
示例#21
0
 public function __construct()
 {
     parent::__construct();
     if (cmsController::getInstance()->getCurrentModule() == __CLASS__ && cmsController::getInstance()->getCurrentMode() == "admin") {
         $this->__loadLib("__admin.php");
         $this->__implement("__social_networks");
         $networks = social_network::getList();
         $tabs = $this->getCommonTabs();
         foreach ($networks as $id) {
             $network = social_network::get($id);
             $tabs->add($network->getCodeName());
         }
     }
 }
示例#22
0
 public function getLoginzaProvider()
 {
     $loginzaAPI = new loginzaAPI();
     $result = array();
     foreach ($loginzaAPI->getProvider() as $k => $v) {
         $result['providers']['nodes:provider'][] = array('attribute:name' => $k, 'attribute:title' => $v);
     }
     $result['widget_url'] = $loginzaAPI->getWidgetUrl() . "&providers_set=google,yandex,mailru,vkontakte,facebook,twitter,loginza,rambler,lastfm,myopenid,openid,mailruapi";
     if (def_module::isXSLTResultMode()) {
         return $result;
     } else {
         return $result['widget_url'];
     }
 }
示例#23
0
 public function __construct()
 {
     parent::__construct();
     // Если режим работы admin
     if (cmsController::getInstance()->getCurrentMode() == "admin") {
         // Добавление вкладок (config стандартная вкладка)
         $configTabs = $this->getConfigTabs();
         if ($configTabs) {
             $configTabs->add("config");
         }
         // Подгрузить библиотеку __admin.php и класс
         $this->__loadLib("__admin.php");
         $this->__implement("__postsms");
     }
 }
示例#24
0
 public function __construct()
 {
     parent::__construct();
     $cmsController = cmsController::getInstance();
     $config = mainConfiguration::getInstance();
     if ($cmsController->getCurrentMode() == 'admin') {
         $commonTabs = $this->getCommonTabs();
         if ($commonTabs) {
             $commonTabs->add('config');
             $commonTabs->add('backup_copies');
         }
     }
     $this->__loadLib("__admin.php");
     $this->__implement("__backup");
 }
示例#25
0
		public function process($template = null) {
			$this->order->order();
			$currency = strtoupper( mainConfiguration::getInstance()->get('system', 'default-currency') );
			$amount = number_format($this->order->getActualPrice(), 2, '.', '');
			$param = array();
			$param["formAction"] = "https://rbkmoney.ru/acceptpurchase.aspx";
			$param["eshopId"] = $this->object->eshopId;
			$param["orderId"] = $this->order->id;
			$param["recipientAmount"] = $amount;
			$param["recipientCurrency"] = $currency;
			$param["version"] = "2"; // May be 1 or 2, see documentation
			$this->order->setPaymentStatus('initialized');
			list($templateString) = def_module::loadTemplates("emarket/payment/rbk/".$template, "form_block");
			return def_module::parseTemplate($templateString, $param);
		}
示例#26
0
 public function getElementRating($element_id)
 {
     $element = umiHierarchy::getInstance()->getElement($element_id);
     if (!$element) {
         return '';
     }
     $block_arr = array();
     $block_arr['rate_sum'] = (int) $element->getValue("rate_sum");
     $block_arr['rate_voters'] = (int) $element->getValue("rate_voters");
     $block_arr['is_rated'] = self::getIsRated($element_id);
     if ($block_arr['rate_voters'] > 0) {
         $block_arr['rate'] = round($block_arr['rate_sum'] / $block_arr['rate_voters'], 2);
         $block_arr['ceil_rate'] = round($block_arr['rate']);
     }
     return def_module::parseTemplate("", $block_arr, $element_id);
 }
示例#27
0
 public function stores($elementId, $template = 'default')
 {
     if (!$template) {
         $tempate = 'default';
     }
     $hierarchy = umiHierarchy::getInstance();
     $objects = umiObjectsCollection::getInstance();
     list($tpl_block, $tpl_block_empty, $tpl_item) = def_module::loadTemplates("emarket/stores/" . $template, 'stores_block', 'stores_block_empty', 'stores_item');
     $elementId = $this->analyzeRequiredPath($elementId);
     if ($elementId == false) {
         throw new publicException("Wrong element id given");
     }
     $element = $hierarchy->getElement($elementId);
     if ($element instanceof iUmiHierarchyElement == false) {
         throw new publicException("Wrong element id given");
     }
     $storesInfo = $element->stores_state;
     $items_arr = array();
     $stores = array();
     $total = 0;
     if (is_array($storesInfo)) {
         foreach ($storesInfo as $storeInfo) {
             $object = $objects->getObject(getArrayKey($storeInfo, 'rel'));
             if ($object instanceof iUmiObject) {
                 $amount = (int) getArrayKey($storeInfo, 'int');
                 $total += $amount;
                 $store = array('attribute:amount' => $amount);
                 if ($object->primary) {
                     $reserved = (int) $element->reserved;
                     $store['attribute:amount'] -= $reserved;
                     $store['attribute:reserved'] = $reserved;
                     $store['attribute:primary'] = 'primary';
                 }
                 $store['item'] = $object;
                 $stores[] = $store;
                 $items_arr[] = def_module::parseTemplate($tpl_item, array('store_id' => $object->id, 'amount' => $amount, 'name' => $object->name), false, $object->id);
             }
         }
     }
     $result = array('stores' => array('attribute:total-amount' => $total, 'nodes:store' => $stores));
     $result['void:total-amount'] = $total;
     $result['void:items'] = $items_arr;
     if (!$total) {
         $tpl_block = $tpl_block_empty;
     }
     return def_module::parseTemplate($tpl_block, $result);
 }
示例#28
0
 /**
  * Функция рисует список заказов пользователя
  * @param string $template Название шаблона
  * @return mixed Список заказов пользователя
  */
 public function show_user_orders($template = 'default')
 {
     list($tpl_block, $tpl_block_empty, $tpl_item, $tpl_order_item) = def_module::loadTemplates("emarket/" . $template, 'orders_block', 'orders_block_empty', 'orders_item', 'orders_order_item');
     $cmsController = cmsController::getInstance();
     $domain = $cmsController->getCurrentDomain();
     $domainId = $domain->getId();
     $sel = new selector('objects');
     $sel->types('object-type')->name('emarket', 'order');
     $sel->where('customer_id')->equals(customer::get()->id);
     $sel->where('name')->isNull(false);
     $sel->where('domain_id')->equals($domainId);
     if ($sel->length == 0) {
         $tpl_block = $tpl_block_empty;
     }
     $items_arr = array();
     foreach ($sel->result as $selOrder) {
         $order = order::get($selOrder->id);
         $item_arr['attribute:id'] = $order->id;
         $item_arr['attribute:name'] = $order->name;
         $item_arr['attribute:type-id'] = $order->typeId;
         $item_arr['attribute:guid'] = $order->GUID;
         $item_arr['attribute:type-guid'] = $order->typeGUID;
         $item_arr['attribute:ownerId'] = $order->ownerId;
         $item_arr['xlink:href'] = $order->xlink;
         $item_arr['attribute:delivery_allow_date'] = date('d.m.Y', $order->getValue('delivery_allow_date')->timestamp);
         //print_r($order->getValue('order_items'));
         //Получаем список товаров заказа
         $items = array();
         foreach ($order->getItems() as $orderItem) {
             //					print_r($order_item); die;
             $item_line = array();
             //					print_r(umiHierarchy::getInstance()->getObjectInstances($orderItem->id));
             $item_line['attribute:element_id'] = $orderItem->id;
             $item_line['attribute:name'] = $orderItem->name;
             $item_line['attribute:item_amount'] = $orderItem->getAmount();
             //					$item_line['attribute:options'] = $orderItem->getOptions();
             //						print_r($order_item->options);
             $items[] = def_module::parseTemplate($tpl_order_item, $item_line, false, $iOrderItemId);
             umiObjectsCollection::getInstance()->unloadObject($iOrderItemId);
         }
         $item_arr['subnodes:order_items'] = $items;
         $items_arr[] = def_module::parseTemplate($tpl_item, $item_arr, false, $order->id);
     }
     return def_module::parseTemplate($tpl_block, array('subnodes:items' => $items_arr));
 }
示例#29
0
 public function checkLogged($template = "default")
 {
     if (!$template) {
         $template = "default";
     }
     if (!$this->is_auth()) {
         list($template_reg_form) = def_module::loadTemplates("users/" . $template, "login_registration_form");
         $from_page = getRequest('from_page');
         if (!$from_page) {
             $from_page = getServer('REQUEST_URI');
         }
         $block_arr = array();
         $block_arr['from_page'] = def_module::protectStringVariable($from_page);
         return def_module::parseTemplate($template_reg_form, $block_arr, false);
     } else {
         return;
     }
 }
示例#30
0
 /**
  * Получить типы событий, отслеживаемые пользователем
  */
 public function getUserSettings()
 {
     $pool = ConnectionPool::getInstance();
     $connection = $pool->getConnection();
     umiEventFeedType::setConnection($connection);
     umiEventFeedUser::setConnection($connection);
     $user = $this->getUser();
     $settings = umiEventFeedType::getAllowedList($user->getSettings());
     $types = umiEventFeedType::getList();
     $result = array('nodes:type' => array());
     foreach ($types as $type) {
         $typeId = $type->getId();
         $result['nodes:type'][$typeId]['attribute:id'] = $typeId;
         $result['nodes:type'][$typeId]['attribute:name'] = getLabel($typeId);
         $result['nodes:type'][$typeId]['attribute:checked'] = in_array($typeId, $settings) ? 1 : 0;
     }
     return def_module::parseTemplate('', $result);
 }