Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1044132
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jun 24, 11:28 PM
Size
34 KB
Mime Type
text/x-diff
Expires
Thu, Jun 26, 11:28 PM (4 h, 15 m)
Engine
blob
Format
Raw Data
Handle
675312
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/unlabeled/unlabeled-1.13.2/kernel/units/users/users_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.13.2/kernel/units/users/users_tag_processor.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.13.2/kernel/units/users/users_tag_processor.php (revision 4760)
@@ -0,0 +1,182 @@
+<?php
+
+ class UsersTagProcessor extends kDBTagProcessor
+ {
+
+ function LogoutLink($params)
+ {
+ $pass = Array('pass' => 'all,m,u', 'u_event' => 'OnLogout');
+ $logout_template = $this->SelectParam($params, 'template,t');
+ return $this->Application->HREF($logout_template, '', $pass);
+ }
+
+ function UseUsernames($params)
+ {
+ return $this->Application->ConfigValue('Email_As_Login') != 1;
+ }
+
+ function RegistrationEnabled($params)
+ {
+ return $this->Application->ConfigValue('User_Allow_New') != 2;
+ }
+
+ function SuggestRegister($params)
+ {
+ return !$this->Application->LoggedIn() && !$this->Application->ConfigValue('Comm_RequireLoginBeforeCheckout') && $this->RegistrationEnabled($params);
+ }
+
+ function ConfirmPasswordLink($params)
+ {
+ //global $m_var_list_update, $var_list_update, $objSession, $objConfig;
+
+ $template = "forgotpw_reset_result";
+
+ $tmp_user_id = $this->Application->RecallVar("tmp_user_id");
+
+ $saved_denerated_code = $this->Application->GetVar('saved_denerated_code');
+ if ($saved_denerated_code){
+ $code = $saved_denerated_code;
+ }
+ else {
+ $code = md5($this->GenerateCode());
+ $this->Application->SetVar('saved_denerated_code', $code);
+ }
+
+
+
+ $sql = 'UPDATE '.TABLE_PREFIX.'PortalUser SET PwResetConfirm="'.$code.'", PwRequestTime='.adodb_mktime().' WHERE PortalUserId='.$tmp_user_id;
+
+ $this->Conn->Query($sql);
+
+ $params = array_merge($params, array('pass'=>'m', 'user_key'=>$code));
+
+ $main_processor =& $this->Application->recallObject('m_TagProcessor');
+
+ return $main_processor->T($params);
+
+ }
+
+ function GenerateCode()
+ {
+ list($usec, $sec) = explode(" ",microtime());
+
+ $id_part_1 = substr($usec, 4, 4);
+ $id_part_2 = mt_rand(1,9);
+ $id_part_3 = substr($sec, 6, 4);
+ $digit_one = substr($id_part_1, 0, 1);
+ if ($digit_one == 0) {
+ $digit_one = mt_rand(1,9);
+ $id_part_1 = ereg_replace("^0","",$id_part_1);
+ $id_part_1=$digit_one.$id_part_1;
+ }
+ return $id_part_1.$id_part_2.$id_part_3;
+ }
+
+ function ForgottenPassword($params){
+ return $this->Application->GetVar('ForgottenPassword');
+ }
+
+ function TestCodeIsValid($param){
+
+ $passed_key = $this->Application->GetVar('user_key');
+
+ $user_object = &$this->Application->recallObject('u.forgot');
+ $user_current_object = &$this->Application->recallObject('u');
+
+ if (strlen(trim($passed_key)) == 0) {
+
+ $user_current_object->ErrorMsgs['code_is_not_valid'] = $this->Application->Phrase('lu_code_is_not_valid');
+ $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_is_not_valid';
+ return false;
+ }
+
+
+ if($user_object->Load(array('PwResetConfirm'=>$passed_key)))
+ {
+ $exp_time = $user_object->GetDBField('PwRequestTime') + 3600;
+ if ($exp_time > adodb_mktime())
+ {
+
+
+ } else {
+ $user_current_object->ErrorMsgs['code_expired'] = $this->Application->Phrase('lu_code_expired');
+ $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_expired';
+ return false;
+
+ }
+ } else {
+ $user_current_object->ErrorMsgs['code_is_not_valid'] = $this->Application->Phrase('lu_code_is_not_valid');
+ $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_is_not_valid';
+ return false;
+
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns sitem administrator email
+ *
+ * @param Array $params
+ * @return string
+ */
+ function SiteAdminEmail($params)
+ {
+ return $this->Application->ConfigValue('Smtp_AdminMailFrom');
+ }
+
+ function AffiliatePaymentTypeChecked($params)
+ {
+ static $checked = false;
+
+ if( $this->Application->GetVar('PaymentTypeId') )
+ {
+ $apt_object =& $this->Application->recallObject('apt.active');
+ if( $this->Application->GetVar('PaymentTypeId') == $apt_object->GetDBField('PaymentTypeId') )
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ if(!$checked)
+ {
+ $checked = true;
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ function HasError($params)
+ {
+ $res = parent::HasError($params);
+ if($this->SelectParam($params,'field,fields') == 'any')
+ {
+ $res = $res || $this->Application->GetVar('MustAgreeToTerms'); // need to do it not put module fields into kernel ! (noticed by Alex)
+ $res = $res || $this->Application->GetVar('SSNRequiredError');
+ }
+ return $res;
+ }
+
+ /**
+ * Returns login name of user
+ *
+ * @param Array $params
+ */
+ function LoginName($params)
+ {
+ $object =& $this->getObject($params);
+ return $object->GetID() != -1 ? $object->GetDBField('Login') : 'root';
+ }
+
+ }
+
+
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.13.2/kernel/units/users/users_tag_processor.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.13
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.13.2/kernel/units/config_search/config_search_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.13.2/kernel/units/config_search/config_search_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.13.2/kernel/units/config_search/config_search_event_handler.php (revision 4760)
@@ -0,0 +1,104 @@
+<?php
+
+ class ConfigSearchEventHandler extends InpDBEventHandler {
+
+ /**
+ * Changes permission section to one from REQUEST, not from config
+ *
+ * @param kEvent $event
+ */
+ function CheckPermission(&$event)
+ {
+ $module = $this->Application->GetVar('module');
+ $main_prefix = $this->Application->findModule('Name', $module, 'Var');
+ $section = $this->Application->getUnitOption($main_prefix.'.search', 'PermSection');
+ $event->setEventParam('PermSection', $section);
+ return parent::CheckPermission($event);
+ }
+
+ /**
+ * Apply any custom changes to list's sql query
+ *
+ * @param kEvent $event
+ * @access protected
+ * @see OnListBuild
+ */
+ function SetCustomQuery(&$event)
+ {
+ $object =& $event->getObject();
+
+ // show only items that belong to selected module
+ $module = $this->Application->GetVar('module');
+ $object->addFilter('module_filter', '%1$s.ModuleName = '.$this->Conn->qstr($module));
+
+ // don't show disabled search items
+ $object->addFilter('active_filter', '%1$s.SimpleSearch <> -1');
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnUpdate(&$event)
+ {
+ if (!$this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
+ parent::OnUpdate($event);
+
+ $conf_update = new kEvent('conf:OnUpdate');
+ $conf_update->redirect = false;
+ $this->Application->HandleEvent($conf_update);
+ }
+
+ $event->SetRedirectParam('opener', 's');
+ }
+
+ function OnCancel(&$event)
+ {
+ parent::OnCancel($event);
+ $event->SetRedirectParam('opener', 's');
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnCreateCustomField(&$event)
+ {
+ $custom_field =& $event->MasterEvent->getObject();
+ if ($custom_field->GetDBField('Type') == 6 || $custom_field->GetDBField('IsSystem') == 1) {
+ // user & system custom fields are not searchable
+ return false;
+ }
+
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+
+ $custom_id = $custom_field->GetID();
+ if ($custom_id) {
+ $object->Load($custom_id, 'CustomFieldId');
+ $object->SetDBField('CustomFieldId', $custom_id); // for cloning only
+ }
+
+ $cf_search = Array();
+ $cf_search['DisplayOrder'] = $custom_field->GetDBField('DisplayOrder');
+ $cf_search['ElementType'] = $custom_field->GetDBField('ElementType');
+ $cf_search['DisplayName'] = $custom_field->GetDBField('FieldLabel');
+ $cf_search['FieldName'] = $custom_field->GetDBField('FieldName');
+ $cf_search['Description'] = $custom_field->GetDBField('Prompt');
+ $cf_search['ConfigHeader'] = $custom_field->GetDBField('Heading'); // 'la_Text_CustomFields';
+ $cf_search['TableName'] = 'CustomField';
+
+ $sql = 'SELECT Module
+ FROM '.TABLE_PREFIX.'ItemTypes
+ WHERE ItemType = '.$custom_field->GetDBField('Type');
+
+ $cf_search['ModuleName'] = $this->Conn->GetOne($sql);
+
+ $object->SetFieldsFromHash($cf_search);
+
+ $result = $object->isLoaded() ? $object->Update() : $object->Create();
+ }
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.13.2/kernel/units/config_search/config_search_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.13
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.13.2/kernel/include/customfield.php
===================================================================
--- branches/unlabeled/unlabeled-1.13.2/kernel/include/customfield.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.13.2/kernel/include/customfield.php (revision 4760)
@@ -0,0 +1,289 @@
+<?php
+
+class clsCustomField extends clsItem
+{
+
+ function clsCustomField($CustomFieldId=-1)
+ {
+ $this->clsItem();
+ $this->tablename=GetTablePrefix()."CustomField";
+ $this->type=10;
+ $this->BasePermission="";
+ $this->id_field = "CustomFieldId";
+ $this->NoResourceId=1; //set this to avoid using a resource ID
+ $this->debuglevel=0;
+ if($CustomFieldId>-1)
+ $this->LoadFromDatabase($CustomFieldId);
+ }
+
+
+ function GetAdminUI()
+ {
+ $a = new clsConfigAdminItem();
+ $a->name = "_".$this->Get("FieldName");
+ $a->heading = $this->Get("Heading");
+ $a->prompt = $this->Get("Prompt");
+ $a->ElementType = $this->Get("ElementType");
+ $a->ValidationRules="";
+ $a->default_value = "";
+ $a->ValueList=$this->Get("ValueList");
+ if(!strlen($a->ElementType))
+ $a->ElementType="text";
+ if(!strlen($a->prompt))
+ $a->prompt = "lu_fieldcustom__".strtolower($this->Get("FieldName"));
+ return $a;
+ }
+
+ function parsetag($tag)
+ {
+ if(is_object($tag))
+ {
+ $tagname = $tag->name;
+ }
+ else
+ $tagname = $tag;
+ switch($tagname)
+ {
+ case "fieldlabel":
+ return $this->Get("FieldLabel");
+ break;
+
+ case "fieldname":
+ return $this->Get("FieldName");
+ break;
+
+ case "customfieldid":
+ return $this->Get("CustomFieldId");
+
+ default:
+ return "Undefined:$tagname";
+ break;
+ }
+ }
+
+ }
+
+class clsCustomFieldList extends clsItemCollection
+{
+ var $Type;
+
+ function clsCustomFieldList($type = -1, $table = 'CustomField')
+ {
+ $this->clsItemCollection();
+ $this->Type = $type;
+ $this->classname = 'clsCustomField';
+ if ($table == 'CustomField') {
+ $table = GetTablePrefix().$table;
+ }
+
+ $this->SourceTable = $table;
+ if ($this->Type > 0) {
+ $this->LoadFields();
+ }
+ }
+
+ function LoadFields()
+ {
+ $this->Clear();
+ $sql = 'SELECT *
+ FROM '.$this->SourceTable.'
+ WHERE Type = '.$this->Type.' AND IsSystem = 0
+ ORDER BY DisplayOrder DESC, CustomFieldId ASC';
+ if($this->debuglevel > 1)
+ echo $sql."<br>\n";
+ $rs = $this->adodbConnection->Execute($sql);
+
+ while($rs && !$rs->EOF)
+ {
+ $data = $rs->fields;
+ $this->AddItemFromArray($data);
+ $rs->MoveNext();
+ }
+ }
+
+ function LoadFieldsAndValues($ResourceId, $main_prefix, $temp_table = false)
+ {
+ $this->Clear();
+
+ $table = $this->Application->getUnitOption($main_prefix.'-cdata', 'TableName');
+ if ($temp_table) {
+ $table = $this->Application->GetTempName($table);
+ }
+
+ $sql = 'SELECT *
+ FROM '.$table.'
+ WHERE ResourceId = '.$ResourceId;
+ $custom_data = $this->adodbConnection->GetRow($sql);
+
+ $sql = 'SELECT *
+ FROM '.TABLE_PREFIX.'CustomField
+ WHERE Type = '.$this->Application->getUnitOption($main_prefix, 'ItemType');
+ $custom_fields = $this->Conn->Query($sql, 'CustomFieldId');
+
+ $ml_formatter =& $this->Application->recallObject('kMultiLanguage');
+ foreach ($custom_fields as $custom_id => $custom_info) {
+ $custom_name = $ml_formatter->LangFieldName('cust_'.$custom_id);
+ $custom_info['Value'] = getArrayValue($custom_data, $custom_name) ? $custom_data[$custom_name] : '';
+ $custom_info['CustomDataId'] = 0;
+ $this->AddItemFromArray($custom_info);
+ }
+ }
+
+ function GetFieldUIList($GeneralTab=FALSE)
+ {
+ $ret = new clsConfigAdmin();
+
+ if ($this->NumItems() > 0) {
+ foreach ($this->Items as $field) {
+ if ($GeneralTab == true && $field->Get('OnGeneralTab') == 1 || !$GeneralTab) {
+ $ui = $field->GetAdminUI();
+ array_push($ret->Items,$ui);
+ }
+ }
+ }
+ return $ret;
+ }
+
+ function GetFieldNames()
+ {
+ $res = array();
+ foreach($this->Items as $f)
+ $res[] = $f->Get("FieldName");
+ return $res;
+ }
+
+ function SaveFields()
+ {
+ foreach($this->Items as $i)
+ {
+ if($i->Get("CustomFieldId"))
+ {
+ $i->Update();
+ }
+ else
+ $i->Create();
+ }
+
+ }
+
+ function Query_CustomField($where=NULL,$orderby=NULL,$limit=NULL)
+ {
+ $this->Clear();
+ $sql = "SELECT * FROM ".$this->SourceTable;
+ if(isset($where))
+ $sql = sprintf('%s WHERE %s',$sql,$where);
+ if(isset($orderby) && strlen(trim($orderby))>0)
+ $sql = sprintf('%s ORDER BY %s',$sql,$orderby);
+ if(isset($limit) && strlen(trim($limit)))
+ $sql .= " ".$limit;
+ // $sql."<br>";
+ $this->Query_Item($sql);
+ return $this->Items;
+ }
+
+ function AddField($Type,$FieldName,$FieldLabel,$ShowGeneral=0,$Heading="", $Prompt="",
+ $ElementType="",$ValueList="")
+ {
+ global $objItemTypes,$objSearchConfig,$objLanguages;
+
+ //if(!is_numeric($Type))
+ // {
+ $f = new clsCustomField();
+ $f->tablename = $this->SourceTable;
+ $f->Set(array("Type","FieldName","FieldLabel","OnGeneralTab","Heading","Prompt",
+ "ElementType","ValueList"),
+ array($Type,$FieldName,$FieldLabel,$ShowGeneral,$Heading,$Prompt,
+ $ElementType,$ValueList));
+ $f->Create();
+ $Item = $objItemTypes->GetItem($Type);
+ if(is_object($Item))
+ {
+ //$Table = $Item->Get("SourceTable");
+ $Table = 'CustomField';
+ $Header = "la_text_".strtolower($Item->Get("ItemName"));
+ $Module = $Item->Get("Module");
+// $Desc = $FieldLabel;
+
+ if(!is_object($objSearchConfig))
+ {
+ $objSearchConfig = new clsSearchConfigList();
+ }
+
+ $NextOrder = $objSearchConfig->GetNextDisplayOrder($Module);
+ $desc = "lu_fieldcustom__".strtolower($FieldName);
+ if(!strlen($FieldLabel))
+ {
+ $FieldLabel = $FieldName;
+ }
+
+ $l = $objLanguages->GetPrimary();
+ $phrases = new clsPhraseList();
+ $phrases->AddPhrase($desc,$l,$FieldLabel,2, $Item->Get('Module') );
+
+ $dtable = GetTablePrefix()."CustomMetaData";
+ $Join = "($dtable.ResourceId={Table}.ResourceId)";
+ $objSearchConfig->AddSearchField($Table,$FieldName,$Module,$Type == 6 ? -1 : 0,0,
+ $FieldLabel,$desc,$Header,$NextOrder,0,
+ $ElementType, NULL, NULL, NULL, NULL, NULL,
+ $f->Get("CustomFieldId"), NULL);
+ }
+ return $f;
+ //}
+ //else
+ // return FALSE;
+ }
+
+ function EditField($FieldId,$Type,$FieldName,$FieldLabel,$ShowGeneral=0,$Heading="", $Prompt="",$ElementType="",$ValueList="")
+ {
+ global $objSearchConfig;
+
+ $f = $this->GetItem($FieldId);
+ $f->Set(array("Type","FieldName","FieldLabel","OnGeneralTab","Heading","Prompt","ElementType","ValueList"),
+ array($Type,$FieldName,$FieldLabel,$ShowGeneral,$Heading,$Prompt,$ElementType,$ValueList));
+ $f->Update();
+
+ $db =& $this->adodbConnection;
+
+ if (!$FieldLabel) $FieldLabel = $FieldName;
+ $sql = 'UPDATE '.GetTablePrefix().'SearchConfig
+ SET FieldType = '.$db->qstr($ElementType).',
+ DisplayName = '.$db->qstr('lu_fieldcustom__'.strtolower($FieldName)).',
+ FieldName = '.$db->qstr($FieldName).',
+ Description = '.$db->qstr($FieldLabel).'
+ WHERE CustomFieldId = '.$FieldId;
+ $this->adodbConnection->Execute($sql);
+
+ return $f;
+ }
+
+ function DeleteField($FieldId)
+ {
+ global $objItemTypes, $objSearchConfig;
+ //echo "<pre>"; print_r($objSearchConfig); echo "</pre>";
+ $f = $this->GetItem($FieldId);
+ $Type = $f->Get("Type");
+ $Item = $objItemTypes->GetItem($Type);
+ $Module = $Item->Get("Module");
+ if(is_object($Item))
+ {
+ //$table = $Item->Get("TableName");
+ $table = GetTablePrefix()."CustomField";
+ if(!is_object($objSearchConfig))
+ {
+ $objSearchConfig = new clsSearchConfigList($Module);
+ }
+
+ $sql = 'DELETE FROM '.$objSearchConfig->SourceTable.' WHERE CustomFieldId = '.$FieldId;
+ $this->adodbConnection->Execute($sql);
+
+ $phrase_name = 'lu_fieldcustom__'.strtolower($f->Get('FieldName'));
+ $sql = 'DELETE FROM '.GetTablePrefix().'Phrase WHERE Phrase = '.$this->adodbConnection->qstr($phrase_name);
+ $this->adodbConnection->Execute($sql);
+ }
+ $f->Delete();
+ }
+
+}/*clsCustomFieldList*/
+
+
+?>
Property changes on: branches/unlabeled/unlabeled-1.13.2/kernel/include/customfield.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.13
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.13.2/core/kernel/parser/template.php
===================================================================
--- branches/unlabeled/unlabeled-1.13.2/core/kernel/parser/template.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.13.2/core/kernel/parser/template.php (revision 4760)
@@ -0,0 +1,205 @@
+<?php
+
+class Template {
+ var $Body = '';
+ var $BasePath = '';
+ var $Filename = '';
+
+ function Template($base_path=null, $filename=null, $silent=0)
+ {
+ if ($this->SetBasePath($base_path)) {
+ if (isset($filename)) {
+ $this->Filename = $filename;
+ $this->LoadTemplate($silent);
+ }
+ }
+ }
+
+ function SetBasePath($base_path=null)
+ {
+ if (isset($base_path)) {
+ $base_path = eregi_replace("/$", '', $base_path); //Cutting possible last slash
+ $this->BasePath = $base_path;
+ return true;
+ }
+ return false;
+ }
+
+ function GetFullPath()
+ {
+ return $this->BasePath.'/'.ltrim($this->Filename, '/').'.tpl';
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param int $silent template not found {0 - fatal error, 1 - warning, 2 - nothing}
+ * @return bool
+ */
+ function LoadTemplate($silent = 0)
+ {
+ $filename = $this->GetFullPath();
+ if(file_exists($filename)) {
+ if (filesize ($filename) == 0) {
+ trigger_error("Template file size is 0: <b>$filename</b>", ($silent ? E_USER_NOTICE : E_USER_ERROR) );
+ }
+
+ $this->SetBody(file_get_contents($filename));
+ /*$handle = fopen ($filename, "r");
+ $contents = fread ($handle, filesize ($filename));
+ $this->SetBody($contents);
+ fclose ($handle);*/
+ return true;
+ }
+ else {
+ if ($silent != 2) {
+ trigger_error("File or block not found: <b>$filename</b>", ($silent ? E_USER_NOTICE : E_USER_ERROR) );
+ }
+ return false;
+ }
+ }
+
+ function SetBody($body)
+ {
+ $this->Body = $body;
+ }
+
+ function GetBody()
+ {
+ return $this->Body;
+ }
+}
+
+class TemplatesCache extends kBase {
+ var $Templates = Array();
+ var $BasePath;
+ var $FileNames = Array();
+
+ var $ModulesCache = Array();
+
+ function TemplatesCache()
+ {
+ parent::kBase();
+ $this->SetThemePath();
+ $this->BasePath = FULL_PATH.THEMES_PATH;
+
+ $conn =& $this->Application->GetADODBConnection();
+// $this->ModulesCache = $conn->GetCol('SELECT LOWER(Name) FROM '.TABLE_PREFIX.'Modules');
+ }
+
+ function SetThemePath()
+ {
+ if (defined('SPECIAL_TEMPLATES_FOLDER')) {
+ $sub_folder = SPECIAL_TEMPLATES_FOLDER;
+ }
+ elseif ($this->Application->IsAdmin()) {
+ $sub_folder = '/admin/templates';
+ }
+ else {
+ $theme =& $this->Application->recallObject('theme.current');
+ if ($theme->isLoaded()) {
+ $sub_folder = '/themes/'.$theme->GetDBField('Name');
+ }
+ else {
+ die('No Primary Theme Selected');
+ }
+ }
+ safeDefine('THEMES_PATH', $sub_folder);
+ }
+
+ function LoadTemplate($filename, $title=NULL, $silent=0)
+ {
+ if (preg_match('#^[\/]{0,1}([^\/]*)\/(.*)#', $filename, $regs)) {
+ $module_filename = $regs[2];
+ $first_dir = $regs[1];
+ }
+ else {
+ $first_dir = '';
+ $module_filename = $filename;
+ }
+
+ if ( $this->Application->IsAdmin() && $this->Application->findModule('Name', $first_dir, null, true)) {
+ $path = MODULES_PATH.'/'.strtolower($first_dir).'/admin_templates';
+ }
+ else {
+ $path = $this->BasePath;
+ $module_filename = $first_dir.'/'.$module_filename;
+ }
+
+ $template =& new Template($path, $module_filename, $silent);
+ if (!isset($title)) $title = $filename;
+ $this->SetTemplate($title, $template);
+ }
+
+ function GetRealFilename($filename, $base=null) {
+ if (preg_match('#^[\/]{0,1}([^\/]*)\/(.*)#', $filename, $regs)) {
+ $module_filename = $regs[2];
+ $first_dir = $regs[1];
+ }
+ else {
+ $first_dir = '';
+ $module_filename = $filename;
+ }
+
+ if ( $this->Application->IsAdmin() && $this->Application->findModule('Name', $first_dir, null, true)) {
+ $path = MODULES_PATH.'/'.strtolower($first_dir).'/admin_templates';
+ }
+ else {
+ $path = isset($base) ? $base : $this->BasePath;
+ $module_filename = $first_dir.'/'.$module_filename;
+ }
+ return $path.'/'.$module_filename;
+ }
+
+ function SetTemplate($title, &$template, $filename=null)
+ {
+ if (!isset($filename)) $filename=$title;
+ $this->Templates[$title] = $template;
+ $this->FileNames[$title] = $filename;
+ }
+
+ function &GetTemplate($title, $silent=0)
+ {
+ if (!isset($this->Templates[$title])) {
+ $this->LoadTemplate($title, null, $silent);
+ }
+ return $this->Templates[$title];
+ }
+
+ function GetTemplateBody($title, $silent=0)
+ {
+ $template =& $this->GetTemplate($title, $silent);
+ if ( !is_object($template) ) {
+ return '';
+ }
+ return $template->GetBody();
+ }
+
+ function GetTemplateFileName($title)
+ {
+ return getArrayValue($this->FileNames, $title);
+ }
+
+ function SetTemplateBody($title, $body)
+ {
+ $template =& new Template();
+ $template->SetBody($body);
+ $this->SetTemplate($title, $template);
+ }
+
+ function ParseTemplate($template_name)
+ {
+ $Parser =& new TemplateParser($this->Application);
+ return $Parser->Parse( $this->GetTemplateBody($template_name) );
+ }
+
+ function TemplateExists($filename)
+ {
+ if (!preg_match("/\.tpl$/", $filename)) $filename .= '.tpl';
+ $real_file = $this->GetRealFilename($filename);
+ return file_exists($real_file);
+ }
+}
+
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.13.2/core/kernel/parser/template.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.13
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.13.2/core/units/users/users_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.13.2/core/units/users/users_tag_processor.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.13.2/core/units/users/users_tag_processor.php (revision 4760)
@@ -0,0 +1,182 @@
+<?php
+
+ class UsersTagProcessor extends kDBTagProcessor
+ {
+
+ function LogoutLink($params)
+ {
+ $pass = Array('pass' => 'all,m,u', 'u_event' => 'OnLogout');
+ $logout_template = $this->SelectParam($params, 'template,t');
+ return $this->Application->HREF($logout_template, '', $pass);
+ }
+
+ function UseUsernames($params)
+ {
+ return $this->Application->ConfigValue('Email_As_Login') != 1;
+ }
+
+ function RegistrationEnabled($params)
+ {
+ return $this->Application->ConfigValue('User_Allow_New') != 2;
+ }
+
+ function SuggestRegister($params)
+ {
+ return !$this->Application->LoggedIn() && !$this->Application->ConfigValue('Comm_RequireLoginBeforeCheckout') && $this->RegistrationEnabled($params);
+ }
+
+ function ConfirmPasswordLink($params)
+ {
+ //global $m_var_list_update, $var_list_update, $objSession, $objConfig;
+
+ $template = "forgotpw_reset_result";
+
+ $tmp_user_id = $this->Application->RecallVar("tmp_user_id");
+
+ $saved_denerated_code = $this->Application->GetVar('saved_denerated_code');
+ if ($saved_denerated_code){
+ $code = $saved_denerated_code;
+ }
+ else {
+ $code = md5($this->GenerateCode());
+ $this->Application->SetVar('saved_denerated_code', $code);
+ }
+
+
+
+ $sql = 'UPDATE '.TABLE_PREFIX.'PortalUser SET PwResetConfirm="'.$code.'", PwRequestTime='.adodb_mktime().' WHERE PortalUserId='.$tmp_user_id;
+
+ $this->Conn->Query($sql);
+
+ $params = array_merge($params, array('pass'=>'m', 'user_key'=>$code));
+
+ $main_processor =& $this->Application->recallObject('m_TagProcessor');
+
+ return $main_processor->T($params);
+
+ }
+
+ function GenerateCode()
+ {
+ list($usec, $sec) = explode(" ",microtime());
+
+ $id_part_1 = substr($usec, 4, 4);
+ $id_part_2 = mt_rand(1,9);
+ $id_part_3 = substr($sec, 6, 4);
+ $digit_one = substr($id_part_1, 0, 1);
+ if ($digit_one == 0) {
+ $digit_one = mt_rand(1,9);
+ $id_part_1 = ereg_replace("^0","",$id_part_1);
+ $id_part_1=$digit_one.$id_part_1;
+ }
+ return $id_part_1.$id_part_2.$id_part_3;
+ }
+
+ function ForgottenPassword($params){
+ return $this->Application->GetVar('ForgottenPassword');
+ }
+
+ function TestCodeIsValid($param){
+
+ $passed_key = $this->Application->GetVar('user_key');
+
+ $user_object = &$this->Application->recallObject('u.forgot');
+ $user_current_object = &$this->Application->recallObject('u');
+
+ if (strlen(trim($passed_key)) == 0) {
+
+ $user_current_object->ErrorMsgs['code_is_not_valid'] = $this->Application->Phrase('lu_code_is_not_valid');
+ $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_is_not_valid';
+ return false;
+ }
+
+
+ if($user_object->Load(array('PwResetConfirm'=>$passed_key)))
+ {
+ $exp_time = $user_object->GetDBField('PwRequestTime') + 3600;
+ if ($exp_time > adodb_mktime())
+ {
+
+
+ } else {
+ $user_current_object->ErrorMsgs['code_expired'] = $this->Application->Phrase('lu_code_expired');
+ $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_expired';
+ return false;
+
+ }
+ } else {
+ $user_current_object->ErrorMsgs['code_is_not_valid'] = $this->Application->Phrase('lu_code_is_not_valid');
+ $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_is_not_valid';
+ return false;
+
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns sitem administrator email
+ *
+ * @param Array $params
+ * @return string
+ */
+ function SiteAdminEmail($params)
+ {
+ return $this->Application->ConfigValue('Smtp_AdminMailFrom');
+ }
+
+ function AffiliatePaymentTypeChecked($params)
+ {
+ static $checked = false;
+
+ if( $this->Application->GetVar('PaymentTypeId') )
+ {
+ $apt_object =& $this->Application->recallObject('apt.active');
+ if( $this->Application->GetVar('PaymentTypeId') == $apt_object->GetDBField('PaymentTypeId') )
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ if(!$checked)
+ {
+ $checked = true;
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ function HasError($params)
+ {
+ $res = parent::HasError($params);
+ if($this->SelectParam($params,'field,fields') == 'any')
+ {
+ $res = $res || $this->Application->GetVar('MustAgreeToTerms'); // need to do it not put module fields into kernel ! (noticed by Alex)
+ $res = $res || $this->Application->GetVar('SSNRequiredError');
+ }
+ return $res;
+ }
+
+ /**
+ * Returns login name of user
+ *
+ * @param Array $params
+ */
+ function LoginName($params)
+ {
+ $object =& $this->getObject($params);
+ return $object->GetID() != -1 ? $object->GetDBField('Login') : 'root';
+ }
+
+ }
+
+
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.13.2/core/units/users/users_tag_processor.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.13
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.13.2/core/units/config_search/config_search_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.13.2/core/units/config_search/config_search_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.13.2/core/units/config_search/config_search_event_handler.php (revision 4760)
@@ -0,0 +1,104 @@
+<?php
+
+ class ConfigSearchEventHandler extends InpDBEventHandler {
+
+ /**
+ * Changes permission section to one from REQUEST, not from config
+ *
+ * @param kEvent $event
+ */
+ function CheckPermission(&$event)
+ {
+ $module = $this->Application->GetVar('module');
+ $main_prefix = $this->Application->findModule('Name', $module, 'Var');
+ $section = $this->Application->getUnitOption($main_prefix.'.search', 'PermSection');
+ $event->setEventParam('PermSection', $section);
+ return parent::CheckPermission($event);
+ }
+
+ /**
+ * Apply any custom changes to list's sql query
+ *
+ * @param kEvent $event
+ * @access protected
+ * @see OnListBuild
+ */
+ function SetCustomQuery(&$event)
+ {
+ $object =& $event->getObject();
+
+ // show only items that belong to selected module
+ $module = $this->Application->GetVar('module');
+ $object->addFilter('module_filter', '%1$s.ModuleName = '.$this->Conn->qstr($module));
+
+ // don't show disabled search items
+ $object->addFilter('active_filter', '%1$s.SimpleSearch <> -1');
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnUpdate(&$event)
+ {
+ if (!$this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
+ parent::OnUpdate($event);
+
+ $conf_update = new kEvent('conf:OnUpdate');
+ $conf_update->redirect = false;
+ $this->Application->HandleEvent($conf_update);
+ }
+
+ $event->SetRedirectParam('opener', 's');
+ }
+
+ function OnCancel(&$event)
+ {
+ parent::OnCancel($event);
+ $event->SetRedirectParam('opener', 's');
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnCreateCustomField(&$event)
+ {
+ $custom_field =& $event->MasterEvent->getObject();
+ if ($custom_field->GetDBField('Type') == 6 || $custom_field->GetDBField('IsSystem') == 1) {
+ // user & system custom fields are not searchable
+ return false;
+ }
+
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+
+ $custom_id = $custom_field->GetID();
+ if ($custom_id) {
+ $object->Load($custom_id, 'CustomFieldId');
+ $object->SetDBField('CustomFieldId', $custom_id); // for cloning only
+ }
+
+ $cf_search = Array();
+ $cf_search['DisplayOrder'] = $custom_field->GetDBField('DisplayOrder');
+ $cf_search['ElementType'] = $custom_field->GetDBField('ElementType');
+ $cf_search['DisplayName'] = $custom_field->GetDBField('FieldLabel');
+ $cf_search['FieldName'] = $custom_field->GetDBField('FieldName');
+ $cf_search['Description'] = $custom_field->GetDBField('Prompt');
+ $cf_search['ConfigHeader'] = $custom_field->GetDBField('Heading'); // 'la_Text_CustomFields';
+ $cf_search['TableName'] = 'CustomField';
+
+ $sql = 'SELECT Module
+ FROM '.TABLE_PREFIX.'ItemTypes
+ WHERE ItemType = '.$custom_field->GetDBField('Type');
+
+ $cf_search['ModuleName'] = $this->Conn->GetOne($sql);
+
+ $object->SetFieldsFromHash($cf_search);
+
+ $result = $object->isLoaded() ? $object->Update() : $object->Create();
+ }
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.13.2/core/units/config_search/config_search_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.13
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Event Timeline
Log In to Comment