15 $this -> aColNames = array (
16 1 => array(
'Page' =>
'Join',
'Order' =>
'JoinOrder',
'Block' =>
'JoinBlock',
'ShowSysItems' =>
'Couple,Captcha,TermsOfUse,ProfilePhoto',
'EditAdd' => array(
'JoinPage' ) ),
18 2 => array(
'Page' =>
'Edit',
'Order' =>
'EditOwnOrder',
'Block' =>
'EditOwnBlock' ),
19 3 => array(
'Page' =>
'Edit',
'Order' =>
'EditAdmOrder',
'Block' =>
'EditAdmBlock',
'ShowSysItems' =>
'Featured,Status,Membership' ),
20 4 => array(
'Page' =>
'Edit',
'Order' =>
'EditModOrder',
'Block' =>
'EditModBlock',
'ShowSysItems' =>
'Featured,Status,Membership' ),
22 5 => array(
'Page' =>
'View',
'Order' =>
'ViewAdmOrder',
'Block' =>
'ViewAdmBlock',
'ShowSysItems' =>
'ID,DateReg,DateLastEdit,DateLastLogin,DateLastNav,Status,Age' ),
23 6 => array(
'Page' =>
'View',
'Order' =>
'ViewMembOrder',
'Block' =>
'ViewMembBlock',
'ShowSysItems' =>
'ID,DateReg,DateLastEdit,DateLastLogin,DateLastNav,Status,Age' ),
24 7 => array(
'Page' =>
'View',
'Order' =>
'ViewModOrder',
'Block' =>
'ViewModBlock',
'ShowSysItems' =>
'ID,DateReg,DateLastEdit,DateLastLogin,DateLastNav,Status,Age' ),
25 8 => array(
'Page' =>
'View',
'Order' =>
'ViewVisOrder',
'Block' =>
'ViewVisBlock',
'ShowSysItems' =>
'ID,DateReg,DateLastEdit,DateLastLogin,DateLastNav,Status,Age' ),
27 9 => array(
'Page' =>
'Search',
'Order' =>
'SearchSimpleOrder',
'Block' =>
'SearchSimpleBlock',
'EditAdd' => array(
'SearchParams' ),
'ShowSysItems' =>
'ID,Keyword,Location,Couple' ),
28 10 => array(
'Page' =>
'Search',
'Order' =>
'SearchQuickOrder',
'Block' =>
'SearchQuickBlock',
'EditAdd' => array(
'SearchParams' ),
'ShowSysItems' =>
'ID,Keyword,Location,Couple' ),
29 11 => array(
'Page' =>
'Search',
'Order' =>
'SearchAdvOrder',
'Block' =>
'SearchAdvBlock',
'EditAdd' => array(
'SearchParams' ),
'ShowSysItems' =>
'ID,Keyword,Location,Couple' ),
32 $this -> sLinkPref =
'#!';
34 $this -> aTypes = array(
37 'html_area' =>
'HtmlTextArea',
40 'select_one' =>
'Selector',
41 'select_set' =>
'Multiple Selector',
44 'bool' =>
'Boolean (checkbox)'
48 $this -> aTypesAlter = array(
49 'text' =>
"varchar(255) NOT NULL {default}",
50 'area' =>
"text NOT NULL",
51 'html_area' =>
"text NOT NULL",
52 'pass' =>
"varchar(40) NOT NULL",
53 'date' =>
"date NOT NULL {default}",
54 'select_one' =>
"enum({values})",
55 'select_one_linked' =>
"varchar(255) NOT NULL default ''",
56 'select_set' =>
"set({values}) NOT NULL default ''",
57 'select_set_linked' =>
"set({values}) NOT NULL default ''",
58 'num' =>
"int(10) unsigned NOT NULL {default}",
59 'range' =>
"varchar(255) NOT NULL {default}",
60 'bool' =>
"tinyint(1) NOT NULL {default}"
63 $this -> iAreaID = (int)$iArea;
64 if( !( $this -> iAreaID > 0
and isset( $this -> aColNames[$this -> iAreaID] ) ) )
68 $sLangDfl =
getParam(
'lang_default');
69 $sQuery =
"SELECT `ID` FROM `sys_localization_languages` WHERE `Name` = ?";
70 $this -> sLangID = (int)
db_value( $sQuery, [$sLangDfl]);
72 if( !$this -> sLangID )
73 die(
'Cannot continue. Default language not found. Check the Basic Settings.');
75 $this -> areaPageName = $this -> aColNames[$this -> iAreaID][
'Page'];
76 $this -> areaOrderCol = $this -> aColNames[$this -> iAreaID][
'Order'];
77 $this -> areaBlockCol = $this -> aColNames[$this -> iAreaID][
'Block'];
78 $this -> areaSysItems = $this -> aColNames[$this -> iAreaID][
'ShowSysItems'];
80 $this -> areaEditAddCols = $this -> aColNames[$this -> iAreaID][
'EditAdd'];
82 $this -> aBlocks = array();
83 $this -> aItems = array();
85 $this -> aBlocksInac = array();
86 $this -> aItemsInac = array();
94 return json_encode( $this -> oJSONObject );
99 if (!$this -> areaOrderCol)
109 FROM `sys_profile_fields`
111 `{$this -> areaOrderCol}` IS NOT NULL AND
114 `{$this -> areaOrderCol}`
117 $rBlocks =
db_res( $sBlocksQuery );
119 while( $aBlock = $rBlocks ->fetch() ) {
120 $iBlockID = $aBlock[
'ID'];
122 $this -> aBlocks[ $iBlockID ] = $aBlock[
'Name'];
129 FROM `sys_profile_fields`
131 `Type` != 'block' AND
132 `{$this -> areaOrderCol}` IS NOT NULL AND
133 `{$this -> areaBlockCol}` = $iBlockID AND
135 `Type` != 'system' OR
137 `Type` = 'system' AND
138 FIND_IN_SET( `Name`, '{$this -> areaSysItems}' )
142 `{$this -> areaOrderCol}`
145 $rItems =
db_res( $sItemsQuery );
147 while( $aItem = $rItems ->fetch() )
148 $this -> aItems[ $aItem[
'ID'] ] = array( $aItem[
'Name'], $iBlockID );
154 $sBlocksInacQuery =
"
158 FROM `sys_profile_fields`
160 `{$this -> areaOrderCol}` IS NULL AND
164 $rBlocksInac =
db_res( $sBlocksInacQuery );
166 while( $aBlock = $rBlocksInac ->fetch() )
167 $this -> aBlocksInac[ $aBlock[
'ID'] ] = $aBlock[
'Name'];
170 $sActiveBlocksList = implode(
',', array_keys( $this -> aBlocks ) );
171 if( $sActiveBlocksList ==
'' )
172 $sActiveBlocksList =
"NULL";
178 FROM `sys_profile_fields`
180 `Type` != 'block' AND (
181 `{$this -> areaBlockCol}` = 0 OR
182 `{$this -> areaBlockCol}` NOT IN ($sActiveBlocksList)
184 `Type` != 'system' OR (
185 `Type` = 'system' AND
186 FIND_IN_SET( `Name`, '{$this -> areaSysItems}' )
191 $rItemsInac =
db_res( $sItemsInacQuery );
193 while( $aItem = $rItemsInac ->fetch() )
194 $this -> aItemsInac[ $aItem[
'ID'] ] = $aItem[
'Name'];
201 db_res(
"UPDATE `sys_profile_fields` SET `{$this -> areaOrderCol}` = NULL" );
202 db_res(
"UPDATE `sys_profile_fields` SET `{$this -> areaBlockCol}` = 0" );
204 if( is_array( $aInArrays[
'blocks'] ) ) {
205 foreach( $aInArrays[
'blocks']
as $iBlockID ) {
206 $iBlockID = (int)$iBlockID;
209 SELECT MAX( `{$this -> areaOrderCol}` )
210 FROM `sys_profile_fields`
211 WHERE `Type` = 'block'
215 UPDATE `sys_profile_fields`
216 SET `{$this -> areaOrderCol}` = $iBlockOrd
217 WHERE `ID` = $iBlockID
221 if( is_array( $aInArrays[
'items'] )
and is_array( $aInArrays[
'items_blocks'] ) ) {
222 foreach( $aInArrays[
'items']
as $iItemID ) {
223 $iItemID = (int)$iItemID;
224 $iItemBlockID = (int)$aInArrays[
'items_blocks'][$iItemID];
226 if( in_array( $iItemBlockID, $aInArrays[
'blocks'] ) ) {
228 SELECT MAX( `{$this -> areaOrderCol}` )
229 FROM `sys_profile_fields`
230 WHERE `Type` != 'block' AND `{$this -> areaBlockCol}` = $iItemBlockID
234 UPDATE `sys_profile_fields`
236 `{$this -> areaOrderCol}` = $iItemOrd,
237 `{$this -> areaBlockCol}` = $iItemBlockID
238 WHERE `ID` = $iItemID
268 ( $this -> areaEditAddCols ?
269 (
', `' . implode(
'`, `', $this -> areaEditAddCols ) .
'`' ) :
273 FROM `sys_profile_fields` WHERE `ID` = $iItemID";
278 echo
_t(
'_adm_fields_error_field_not_found');
282 $sGeneralC =
_t(
'_adm_fields_general');
283 $sAdvancedC =
_t(
'_adm_fields_advanced');
284 $sMessagesC =
_t(
'_adm_fields_messages');
285 $sMatchingC =
_t(
'_adm_fields_matching');
286 $sNameC =
_t(
'_adm_mbuilder_System_Name');
287 $sCaptionC =
_t(
'_Caption');
288 $sDescriptionC =
_t(
'_Description');
289 $sNameDescC =
_t(
'_adm_fields_name_desc');
290 $sTypeC =
_t(
'_Type');
291 $sJoinPageC =
_t(
'_adm_fields_join_page');
292 $sSearchInFieldsC =
_t(
'_adm_fields_search_in_fields');
293 $sSearchInFieldsDescC =
_t(
'_adm_fields_search_in_fields_desc');
294 $sMutualCpFieldsC =
_t(
'_adm_fields_mutual_couple_fields');
295 $sMutualCpFieldsDescC =
_t(
'_adm_fields_mutual_couple_fields_desc');
296 $sSureDeleteItemC = addslashes(
_t(
'_adm_fields_delete_item_desc'));
299 $this -> fieldCaption =
"_FieldCaption_{$aField['Name']}_{$this -> areaPageName}";
300 $this -> fieldDesc =
"_FieldDesc_{$aField['Name']}_{$this -> areaPageName}";
302 $this -> showFormTabs = ( $aField[
'Type'] !=
'block' and $aField[
'Type'] !=
'system' );
304 $sCaptionDescC =
_t(
'_adm_fields_caption_desc', $this -> areaPageName, $this -> fieldCaption);
305 $sDescriptionDescC =
_t(
'_adm_fields_description_desc', $this -> areaPageName, $this -> fieldDesc);
310 <input
type=
"hidden" name=
"area" value=
"<?= $this -> iAreaID ?>" />
313 if( $this -> showFormTabs ) {
315 <ul
id=
"form_tabs_switcher">
316 <li><
a href=
"#f1"><?= $sGeneralC ?></
a></li>
317 <li><
a href=
"#f2"><?= $sAdvancedC ?></
a></li>
318 <li><
a href=
"#f3"><?= $sMessagesC ?></
a></li>
319 <li><
a href=
"#f4"><?= $sMatchingC ?></
a></li>
325 <
table class=
"field_edit_tab" id=
"f1"> <!-- General -->
327 <td
class=
"label"><?= $sNameC ?>:</td>
329 <input
type=
"text" maxlength=
"255" class=
"input_text" name=
"Name"
330 value=
"<?= htmlspecialchars( $aField['Name'] ); ?>"
331 <?
php if( $aField[
'Type'] ==
'system' or !$aField[
'Deletable'] ) echo
'readonly="readonly"'; ?> />
335 if( $aField[
'Type'] !=
'block' and $aField[
'Type'] !=
'system' )
336 echo $this ->
getInfoIcon(addslashes($sNameDescC));
343 <td
class=
"label"><?= $sCaptionC ?>:</td>
345 <input
type=
"text" maxlength=
"255" class=
"input_text" name=
"Caption"
346 value=
"<?= htmlspecialchars( $this -> getLangString( $this -> fieldCaption ) ); ?>" />
349 <?= $this ->
getInfoIcon(addslashes($sCaptionDescC)) ?>
353 <td
class=
"label"><?= $sDescriptionC ?>:</td>
355 <textarea
class=
"input_text" name=
"Desc"><?= htmlspecialchars( $this ->
getLangString( $this -> fieldDesc ) ); ?></textarea>
358 <?= $this ->
getInfoIcon(addslashes($sDescriptionDescC)) ?>
363 if( $aField[
'Type'] ==
'block' ) {
364 if( $this -> iAreaID == 1 ) {
367 <td
class=
"label"><?= $sJoinPageC ?>:</td>
371 <td
class=
"info"> </td>
378 <td
class=
"label"><?= $sTypeC ?>:</td>
381 if( $aField[
'Type'] ==
'system' )
385 <select
name=
"Type" class=
"select_type" onchange=
"changeFieldType( this.value );">
392 <td
class=
"info"> </td>
398 if( $aField[
'Name'] ==
'Keyword' ) {
401 <td
class=
"label"><?= $sSearchInFieldsC ?>:</td>
403 <select
name=
"KeywordFields[]" class=
"select_multiple" multiple=
"multiple">
408 <?= $this ->
getInfoIcon(addslashes($sSearchInFieldsDescC)) ?>
412 } elseif( $aField[
'Name'] ==
'Couple' ) {
415 <td
class=
"label"><?= $sMutualCpFieldsC ?>:</td>
417 <select
name=
"CoupleFields[]" class=
"select_multiple" multiple=
"multiple">
422 <?= $this ->
getInfoIcon(addslashes($sMutualCpFieldsDescC)) ?>
433 if( $this -> showFormTabs ) {
440 <
table class=
"field_edit_tab ch-def-margin-sec-topbottom"> <!--Controls-->
442 <td
class=
"buttons" colspan=
"2">
443 <input
type=
"submit" name=
"action-save" value=
"<?= ch_html_attribute(_t('_Save')) ?>" class=
"ch-btn ch-btn-small" />
446 if( $aField[
'Type'] !=
'system' and $aField[
'Deletable'] ) {
448 <input
type=
"submit" name=
"action-delete" value=
"<?= ch_html_attribute(_t('_Delete')) ?>" onclick=
"return confirm('<?= $sSureDeleteItemC ?>');" class=
"ch-btn ch-btn-small" />
456 <script
type=
"text/javascript">
458 $(
'.edit_item_table_cont:first').tabs({selected:0});
459 changeFieldType(
'<?= $aField['Type
'] ?>' );
467 $aSelected = explode(
"\n", $sSelected );
468 foreach( $aSelected
as $iKey => $sValue )
469 $aSelected[$iKey] = trim( $sValue );
472 case 'Keyword': $sWhere =
"`Type` = 'text' OR `Type` = 'area' OR `Type` = 'html_area'";
break;
473 case 'Couple' : $sWhere =
"`Type` != 'block' AND `Type` != 'system' AND `Deletable` = 1";
break;
477 $sQuery =
"SELECT `Name` FROM `sys_profile_fields` WHERE $sWhere";
478 $rFields =
db_res( $sQuery );
481 while( $aField = $rFields ->fetch() ) {
482 $sRet .=
'<option value="' . $aField[
'Name'] .
'"' .
483 ( in_array( $aField[
'Name'], $aSelected ) ?
'selected="selected"' :
'' ) .
'>' .
484 $aField[
'Name'] .
'</option>';
492 $sQuery =
"SELECT MAX( `JoinPage` ) FROM `sys_profile_fields`";
493 $iMaxPage = (int)
db_value( $sQuery );
495 $sRet =
'<select name="JoinPage" class="select_page">';
498 '<option value="' .
$iPage .
'"' .
499 ( (
$iPage == $iCurrent ) ?
' selected="selected"' :
'' ) .
'>' .
502 $sRet .=
'</select>';
510 'MatchField' => array(
511 'label' =>
_t(
'_adm_fields_match_with_field'),
513 'info' => addslashes(
_t(
'_adm_fields_match_with_field_desc')),
514 'value' => $aField[
'MatchField'],
517 'MatchPercent' => array(
518 'label' =>
_t(
'_adm_fields_match_percent'),
520 'info' => addslashes(
_t(
'_adm_fields_match_percent_desc')),
521 'value' => $aField[
'MatchPercent']
530 $aSelectFields = array( $aField[
'Type'] );
532 switch( $aField[
'Type'] ) {
534 $aSelectFields[] =
'select_one';
538 $aSelectFields[] =
'select_set';
542 $aSelectFields[] =
'num';
543 $aSelectFields[] =
'date';
547 $sQuery =
"SELECT `ID`, `Name` FROM `sys_profile_fields` WHERE FIND_IN_SET( `Type`, '" . implode(
',', $aSelectFields ) .
"' )";
548 $rMyFields =
db_res( $sQuery );
550 $aMyFields = array(
'0' =>
'-Not set-' );
551 while( $aMyField = $rMyFields ->fetch() ) {
552 $aMyFields[ $aMyField[
'ID'] ] = $aMyField[
'Name'];
561 'Control_one' => array(
562 'label' =>
_t(
'_adm_fields_selector_control'),
564 'info' => addslashes(
_t(
'_adm_fields_selector_control_desc')),
565 'value' => $aField[
'Control'],
566 'row_id' =>
'field_control_select_one',
568 'select' =>
'Select (Dropdown box)',
569 'radio' =>
'Radio-buttons'
572 'Control_set' => array(
573 'label' =>
_t(
'_adm_fields_multiple_selector_control'),
575 'info' => addslashes(
_t(
'_adm_fields_multiple_selector_control_desc')),
576 'value' => $aField[
'Control'],
577 'row_id' =>
'field_control_select_set',
579 'select' =>
'Select (Box)',
580 'checkbox' =>
'Checkboxes'
583 'Mandatory' => array(
584 'label' =>
_t(
'_adm_fields_mandatory'),
585 'type' =>
'checkbox',
586 'info' => addslashes(
_t(
'_adm_fields_mandatory_desc')),
587 'value' => $aField[
'Mandatory']
590 'label' =>
_t(
'_adm_fields_minimum_value'),
592 'info' => addslashes(
_t(
'_adm_fields_minimum_value_desc')),
593 'value' => $aField[
'Min'],
594 'row_id' =>
'field_minimum'
597 'label' =>
_t(
'_adm_fields_maximum_value'),
599 'info' => addslashes(
_t(
'_adm_fields_maximum_value_desc')),
600 'value' => $aField[
'Max'],
601 'row_id' =>
'field_maximum'
604 'label' =>
_t(
'_adm_fields_unique'),
605 'type' =>
'checkbox',
606 'info' => addslashes(
_t(
'_adm_fields_unique_desc')),
607 'value' => $aField[
'Unique'],
608 'row_id' =>
'field_unique'
611 'label' =>
_t(
'_adm_ambuilder_Check'),
612 'type' =>
'textarea',
613 'info' => addslashes(
_t(
'_adm_ambuilder_Check_desc')),
614 'value' => $aField[
'Check'],
615 'row_id' =>
'field_check'
618 'label' =>
_t(
'_adm_fields_possible_values'),
620 'info' => addslashes(
_t(
'_adm_fields_possible_values_desc')),
621 'value' => $aField[
'Values'],
622 'row_id' =>
'field_values'
625 'label' =>
_t(
'_adm_fields_used_lang_key'),
627 'info' => addslashes(
_t(
'_adm_fields_used_lang_key_desc')),
628 'value' => $aField[
'UseLKey'],
629 'row_id' =>
'field_lkey',
637 'label' =>
_t(
'_adm_fields_default_value'),
639 'info' => addslashes(
_t(
'_adm_fields_default_value_desc')),
640 'value' => $aField[
'Default'],
641 'row_id' =>
'field_default'
651 <
table class=
"field_edit_tab" <?= $sID ? (
'id="' . $sID .
'"' ) :
'' ?>>
654 foreach(
$aForm as $sInputName => $aInput ) {
656 <tr <?= $aInput[
'row_id'] ? (
'id="' . $aInput[
'row_id'] .
'"' ) :
'' ?>>
657 <td
class=
"label"><?= $aInput[
'label'] ?>:</td>
660 switch( $aInput[
'type'] ) {
663 <textarea
name=
"<?= $sInputName ?>" class=
"input_text"><?= htmlspecialchars( $aInput[
'value'] ) ?></textarea>
668 <input
type=
"checkbox" name=
"<?= $sInputName ?>" value=
"yes" class=
"input_checkbox"
669 <?= $aInput[
'value'] ?
'checked="checked"' :
'' ?> />
674 <input
type=
"text" name=
"<?= $sInputName ?>" value=
"<?= htmlspecialchars( $aInput['value'] ) ?>" class=
"input_text" />
679 <select
name=
"<?= $sInputName ?>" class=
"select_type">
681 foreach( $aInput[
'values']
as $sKey => $sValue ) {
683 <option
value=
"<?= $sKey ?>" <?= ( $sKey == $aInput[
'value'] ) ?
'selected="selected"' :
'' ?>><?= $sValue ?></option>
691 if( substr( $aInput[
'value'], 0, 2 ) == $this -> sLinkPref ) {
692 $sLink = substr( $aInput[
'value'], 2 );
694 <input
type=
"hidden" name=
"<?= $sInputName ?>" value=
"<?= htmlspecialchars( $aInput['value'] ) ?>" />
695 <
a href=
"preValues.php?list=<?= urlencode( $sLink ) ?>" target=
"_blank"
696 onclick=
"return !window.open( this.href + '&popup=1', 'preValuesEdit', 'width=635,height=700,resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no' );"
697 title=
"Edit list"><?= $sLink ?></
a>
699 <
a href=
"javascript:void(0);" onclick=
"activateValuesEdit( this );" title=
"Change link" style=
"margin-left:20px;">
700 <img
src=
"../templates/base/images/icons/edit.gif" alt=
"Change" />
705 <textarea
class=
"input_text" name=
"<?= $sInputName ?>"><?= htmlspecialchars( $aInput[
'value'] ) ?></textarea>
732 $aParamLines = explode(
"\n", $sParams );
734 foreach( $aParamLines
as $sLine ) {
735 list( $sKey, $sValue) = explode(
':', $sLine, 2 );
736 $aParams[$sKey] = $sValue;
745 'Mandatory_msg' => array(
746 'label' =>
_t(
'_adm_fields_mandatory_error_message'),
747 'type' =>
'textarea',
748 'info' => addslashes(
_t(
'_adm_fields_mandatory_error_message_desc', $aField[
'Name'])),
749 'value' => $this ->
getLangString(
"_FieldError_{$aField['Name']}_Mandatory" ),
753 'label' =>
_t(
'_adm_fields_minimum_exceed_error_message'),
754 'type' =>
'textarea',
755 'info' => addslashes(
_t(
'_adm_fields_minimum_exceed_error_message_desc', $aField[
'Name'])),
756 'value' => $this ->
getLangString(
"_FieldError_{$aField['Name']}_Min" ),
757 'row_id' =>
'field_minimum_msg'
760 'label' =>
_t(
'_adm_fields_maximum_exceed_error_message'),
761 'type' =>
'textarea',
762 'info' => addslashes(
_t(
'_adm_fields_maximum_exceed_error_message_desc', $aField[
'Name'])),
763 'value' => $this ->
getLangString(
"_FieldError_{$aField['Name']}_Max" ),
764 'row_id' =>
'field_maximum_msg'
766 'Unique_msg' => array(
767 'label' =>
_t(
'_adm_fields_non_unique_error_message'),
768 'type' =>
'textarea',
769 'info' => addslashes(
_t(
'_adm_fields_non_unique_error_message_desc', $aField[
'Name'])),
770 'value' => $this ->
getLangString(
"_FieldError_{$aField['Name']}_Unique" ),
771 'row_id' =>
'field_unique_msg'
773 'Check_msg' => array(
774 'label' =>
_t(
'_adm_fields_check_error_message'),
775 'type' =>
'textarea',
776 'info' => addslashes(
_t(
'_adm_fields_check_error_message_desc', $aField[
'Name'])),
777 'value' => $this ->
getLangString(
"_FieldError_{$aField['Name']}_Check" ),
778 'row_id' =>
'field_check_msg'
788 <img src="../templates/base/images/icons/info.gif" class="info_icon"
789 onmouseover="showFloatDesc(\'' . htmlspecialchars( $sText ) .
'\');
"
790 onmousemove="moveFloatDesc( event )
"
791 onmouseout="hideFloatDesc();
" />
795 function getTypeOptions( $sActive )
799 foreach( $this -> aTypes as $sKey => $sValue ) {
800 $sRet .= '<option value="' . $sKey . '" ' . ( $sActive == $sKey ? 'selected="selected
"' : '') . '>' . $sValue . '</option>';
806 function getLangString( $sKey )
811 $sQuery = "SELECT `
ID` FROM `sys_localization_keys` WHERE `Key` = ?
";
812 $iKeyID = (int)db_value( $sQuery , [$sKey]);
818 SELECT `String` FROM `sys_localization_strings`
819 WHERE `IDKey` = $iKeyID AND `IDLanguage` = {$this -> sLangID}
";
821 return (string)db_value( $sQuery );
824 function saveItem( $aData )
826 $this -> genSaveItemHeader();
827 $this -> isHaveErrors = false;
829 $iItemID = (int)$aData['id'];
831 $aItem = db_assoc_arr( "SELECT * FROM `sys_profile_fields` WHERE `
ID` = $iItemID
" );
834 $this -> genSaveItemError(_t('_adm_fields_warning_field_not_found'));
835 $this -> genSaveItemFooter();
840 $bHaveErrors = false;
842 // this array will be put into db
846 if( $aItem['Type'] != 'system' and $aItem['Deletable'] ) { //we can change the name
848 $sName = trim( strip_tags( process_pass_data( $aData['Name'] ) ) );
850 $aReservedNames = array('starttime', 'youremail', 'reg_email', 'reg_name', 'reg_nickname');
852 if( $sName === '' ) {
853 $this -> genSaveItemError( _t('_adm_fields_error_you_must_enter_name'), 'Name' );
855 } elseif( in_array($sName, $aReservedNames) ) {
856 $this -> genSaveItemError( _t('_adm_fields_error_reserved_name'), 'Name' );
858 } elseif( $aItem['Type'] != 'block' and !preg_match( '/^[a-z][a-z0-9_]*$/i', $sName ) ) {
859 $this -> genSaveItemError( _t('_adm_fields_error_name_latin'), 'Name' );
861 } elseif($GLOBALS['MySQL']->getOne("SELECT COUNT(*) FROM `sys_profile_fields` WHERE `Name`='" .
$sName . "' AND `
ID`<>'" . $iItemID . "'") || (
$sName != $aItem['Name'] &&
$GLOBALS['MySQL']->isFieldExists('Profiles',
$sName))) {
864 } elseif(
$sName == $aItem[
'Name'] ) {
867 $aUpdate[
'Name'] =
$sName;
870 $sNewName = isset( $aUpdate[
'Name'] ) ? $aUpdate[
'Name'] : $aItem[
'Name'];
872 $this -> fieldCaption =
"_FieldCaption_{$sNewName}_{$this -> areaPageName}";
873 $this -> fieldDesc =
"_FieldDesc_{$sNewName}_{$this -> areaPageName}";
879 $this ->
genSaveItemError(
_t(
'_adm_fields_error_you_must_enter_caption'),
'Caption' );
892 if( $aItem[
'Type'] !=
'system' and $aItem[
'Type'] !=
'block' ) {
897 if( !isset( $this -> aTypes[
$sType] ) ) {
900 } elseif(
$sType == $aItem[
'Type'] ) {
903 $aUpdate[
'Type'] =
$sType;
906 if( !$bHaveErrors ) {
909 if(
$sType ==
'select_one' ) {
910 if( $aData[
'Control_one'] == $aItem[
'Control'] ) {
912 } elseif( $aData[
'Control_one'] ==
'select' or $aData[
'Control_one'] ==
'radio' ) {
913 $aUpdate[
'Control'] = $aData[
'Control_one'];
915 $this ->
genSaveItemError(
_t(
'_adm_fields_error_i_dont_know_this_control_type'),
'Control_one' );
918 } elseif(
$sType ==
'select_set' ) {
919 if( $aData[
'Control_set'] == $aItem[
'Control'] ) {
921 } elseif( $aData[
'Control_set'] ==
'select' or $aData[
'Control_set'] ==
'checkbox' ) {
922 $aUpdate[
'Control'] = $aData[
'Control_set'];
924 $this ->
genSaveItemError(
_t(
'_adm_fields_error_i_dont_know_this_control_type'),
'Control_set' );
928 $aUpdate[
'Control'] =
null;
931 $iMin = trim($aData[
'Min']);
932 if($iMin ===
'' ||
$sType ==
'bool' ||
$sType ==
'select_one' ||
$sType ==
'select_set')
936 if((
$sType ==
'area' ||
$sType ==
'html_area') && $iMin > 65534)
938 else if(
$sType !=
'area' &&
$sType !=
'html_area' && $iMin > 254)
943 $aUpdate[
'Min'] = $iMin;
946 $iMax = trim($aData[
'Max']);
947 if($iMax ===
'' ||
$sType ==
'bool' ||
$sType ==
'select_one' ||
$sType ==
'select_set' )
951 if((
$sType ==
'area' ||
$sType ==
'html_area') && $iMax > 65534)
953 else if(
$sType !=
'area' &&
$sType !=
'html_area' && $iMax > 254)
958 $aUpdate[
'Max'] = $iMax;
961 if( $sNewName ==
'DateOfBirth' )
962 $this ->
setMinMaxAge( ( $iMin ? $iMin : 18 ), ( $iMax ? $iMax : 75 ) );
966 $aUpdate[
'Check'] =
'';
970 if( $aItem[
'Check'] != $sCheck )
971 $aUpdate[
'Check'] = $sCheck;
975 $aUpdate[
'Unique'] = (
976 isset( $aData[
'Unique'] )
and
977 $aData[
'Unique'] ==
'yes' and
982 $aUpdate[
'Mandatory'] = ( isset( $aData[
'Mandatory'] )
and $aData[
'Mandatory'] ==
'yes' ) ? 1 : 0;
988 $sValues = str_replace(
",",
"", $sValues );
990 $sValues = str_replace(
"\r",
"\n", $sValues );
991 $sValues = str_replace(
"\n\n",
"\n", $sValues );
994 if( $sValues ===
'' ) {
997 } elseif( $sValues != $aItem[
'Values'] ) {
998 if( substr( $sValues, 0, 2 ) == $this -> sLinkPref
and !$this ->
checkValuesLink( substr( $sValues, 2 ) ) ) {
999 $this ->
genSaveItemError(
_t(
'_adm_fields_error_you_entered_incorrect_link'),
'Values' );
1000 $bHaveErrors =
true;
1002 $aUpdate[
'Values'] = $sValues;
1010 $aUpdate[
'UseLKey'] = $sUseLKey;
1012 if( substr( $sValues, 0, 2 ) != $this -> sLinkPref ) {
1015 $aValues2LF = explode(
"\n", $sValues);
1016 foreach ( $aValues2LF
as $sValues2LF ) {
1017 $sLFKey =
'_FieldValues_' . $sValues2LF;
1018 $sLFValue = $sValues2LF;
1025 } elseif( $aItem[
'Values'] !=
'' )
1026 $aUpdate['Values'] = '';
1028 if( !$bHaveErrors ) {
1038 $aUpdate[
'Default'] =
'';
1041 $aUpdate[
'Default'] = (int)$aData[
'Default'];
1044 $aUpdate[
'Default'] = (int)(
bool)$aData[
'Default'];
1047 if( trim( $aData[
'Default'] ) ==
'' )
1048 $aUpdate[
'Default'] =
'';
1050 list( $sFirst, $sSecond ) = explode(
'-', trim( $aData[
'Default'], 2 ) );
1051 $sFirst = (int)trim( $sFirst );
1052 $sSecond = (int)trim( $sSecond );
1053 $aUpdate[
'Default'] =
"$sFirst-$sSecond";
1057 if( $aData[
'Default'] ===
'' )
1058 $aUpdate[
'Default'] =
'';
1060 $aUpdate[
'Default'] = date(
'Y-m-d', strtotime( trim(
process_pass_data( $aData[
'Default'] ) ) ) );
1065 if( $sDefault ===
'' )
1066 $aUpdate[
'Default'] =
'';
1069 $aUpdate[
'Default'] = $sDefault;
1071 $this ->
genSaveItemError(
_t(
'_adm_fields_error_you_entered_incorrect_value'),
'Default' );
1072 $bHaveErrors =
true;
1083 if( $aItem[
'Type'] ==
'block' and $this -> iAreaID == 1 ) {
1085 $iJoinPage = (int)$aData[
'JoinPage'];
1086 if( $aItem[
'JoinPage'] != $iJoinPage )
1087 $aUpdate[
'JoinPage'] = $iJoinPage;
1091 if( $aItem[
'Name'] ==
'Keyword' ) {
1092 if( is_array( $aData[
'KeywordFields'] ) ) {
1093 $sKeywordFields = implode(
"\n", $aData[
'KeywordFields'] );
1096 $aUpdate[
'Extra'] = $sKeywordFields;
1100 if( $aItem[
'Name'] ==
'Couple' ) {
1101 if( is_array( $aData[
'CoupleFields'] ) ) {
1102 $sKeywordFields = implode(
"\n", $aData[
'CoupleFields'] );
1105 $aUpdate[
'Extra'] = $sKeywordFields;
1110 foreach( array(
'Mandatory',
'Min',
'Max',
'Unique',
'Check' )
as $sErrName ) {
1112 if(
empty($sErrMsg) )
1115 $sErrKey =
"_FieldError_{$sNewName}_{$sErrName}";
1121 if( isset( $aData[
'MatchField'] )
and (
int)$aData[
'MatchField'] != $aItem[
'MatchField'] )
1122 $aUpdate[
'MatchField'] = (int)$aData[
'MatchField'];
1124 if( isset( $aData[
'MatchPercent'] )
and (
int)$aData[
'MatchPercent'] != $aItem[
'MatchPercent'] )
1125 $aUpdate[
'MatchPercent'] = (
int)$aData[
'MatchPercent'];
1127 if( !
empty( $aUpdate )
and !$bHaveErrors ) {
1129 if( isset( $aUpdate[
'Name'] ) )
1132 if( $aItem[
'Type'] ==
'block' and $aUpdate[
'Name'] ) {
1134 UPDATE `sys_page_compose` SET
1135 `Caption` = '_FieldCaption_" .
$GLOBALS[
'MySQL']->escape( $sNewName,
false ) .
"_View'
1137 `Func` = 'PFBlock' AND
1138 `Content` = '$iItemID'
1153 setParam(
'search_start_age', $iMin );
1154 setParam(
'search_end_age', $iMax );
1161 return isset( $aPreValues[$sKey] );
1168 if( substr( $sValues, 0, 2 ) == $this -> sLinkPref ) {
1169 $sKey = substr( $sValues, 2 );
1170 return isset( $aPreValues[$sKey][$sDefault] );
1172 $aValues = explode(
"\n", $sValues );
1173 return in_array( $sDefault, $aValues );
1181 $aUpdateStrs = array();
1182 foreach( $aUpdate
as $sKey => $sValue ) {
1183 if( is_null( $sValue ) )
1184 $aUpdateStrs[] =
"`$sKey` = NULL";
1186 $aUpdateStrs[] =
"`$sKey` = {$GLOBALS['MySQL']->escape( $sValue )}";
1190 UPDATE `sys_profile_fields` SET
1192 ", $aUpdateStrs ) .
"
1193 WHERE `ID` = {$aItem['ID']}";
1198 $aItem[
'Type'] !=
'block' and (
1199 isset( $aUpdate[
'Type'] )
or
1200 isset( $aUpdate[
'Name'] )
or
1201 isset( $aUpdate[
'Values'] )
or
1202 isset( $aUpdate[
'Default'] )
1206 'Type' => isset( $aUpdate[
'Type'] ) ? $aUpdate[
'Type'] : $aItem[
'Type'],
1207 'Name' => isset( $aUpdate[
'Name'] ) ? $aUpdate[
'Name'] : $aItem[
'Name'],
1208 'Values' => isset( $aUpdate[
'Values'] ) ? $aUpdate[
'Values'] : $aItem[
'Values'],
1209 'Default' => isset( $aUpdate[
'Default'] ) ? $aUpdate[
'Default'] : $aItem[
'Default'],
1212 if( substr( $aAlter[
'Values'], 0, 2 ) == $this -> sLinkPref )
1213 $aAlter[
'Type'] .=
'_linked';
1215 $sQuery =
"ALTER TABLE `Profiles` CHANGE `{$aItem['Name']}` `{$aAlter['Name']}` {$this -> aTypesAlter[$aAlter['Type']]}";
1216 $sReplacedVal = ($aAlter[
'Default'] !=
'') ?
"default '" .
$GLOBALS[
'MySQL']->escape( $aAlter[
'Default'],
false ) .
"'" :
"";
1217 $sQuery = str_replace(
'{default}', $sReplacedVal, $sQuery );
1219 if( $aAlter[
'Type'] ==
'select_one' or $aAlter[
'Type'] ==
'select_set' ) {
1220 $aValuesAlter = explode(
"\n", $aAlter[
'Values'] );
1222 foreach( $aValuesAlter
as $iKey => $sValue ){
1223 $sValue = str_replace(
'\\',
'\\\\', $sValue );
1224 $sValue = str_replace(
'\'',
'\\\'', $sValue );
1225 $aValuesAlter[$iKey] = $sValue;
1228 $sValuesAlter =
" '" . implode(
"', '", $aValuesAlter ) .
"' ";
1229 $sQuery = str_replace(
'{values}', $sValuesAlter, $sQuery );
1230 } elseif( $aAlter[
'Type'] ==
'select_set_linked' ) {
1231 $sLink = substr( $aAlter[
'Values'], 2 );
1232 $aValuesAlter = array_keys( $aPreValues[$sLink] );
1234 $sValuesAlter = implode(
', ', $aValuesAlter );
1235 $sValuesAlter = str_replace(
'\\',
'\\\\', $sValuesAlter );
1236 $sValuesAlter = str_replace(
'\'',
'\\\'', $sValuesAlter );
1238 $sValuesAlter =
"'" .str_replace(
', ',
"', '", $sValuesAlter ) .
"'";
1240 $sQuery = str_replace(
'{values}', $sValuesAlter, $sQuery );
1252 if(
db_res(
"INSERT INTO `sys_profile_fields` (`Name`, `Type` ) VALUES ('NEW_ITEM', 'text')", 0 )
and $iNewID =
db_last_id() ) {
1254 if( !
db_res(
"ALTER TABLE `Profiles` ADD `NEW_ITEM` varchar(255) NOT NULL default ''", 0 ) ) {
1256 db_res(
"DELETE FROM `sys_profile_fields` WHERE `ID` = $iNewID" );
1266 db_res(
"INSERT INTO `sys_profile_fields` (`Name`, `Type` ) VALUES ('NEW BLOCK', 'block')", 0 );
1270 INSERT INTO `sys_page_compose`
1271 ( `Desc`, `Caption`, `Visible`, `Func`, `Content`, `Page` )
1273 ( 'Profile Fields Block', '_FieldCaption_NEW BLOCK_View', 'non,memb', 'PFBlock', '$iNewID', 'profile' )
1277 INSERT INTO `sys_page_compose`
1278 ( `Desc`, `Caption`, `Visible`, `Func`, `Content`, `Page` )
1280 ( 'Profile Fields Block', '_FieldCaption_NEW BLOCK_View', 'non,memb', 'PFBlock', '$iNewID', 'profile_info' )
1291 $sQuery =
"SELECT `ID` FROM `sys_localization_keys` WHERE `Key` = ?";
1292 $iKeyID = (int)
db_value( $sQuery, [$sKey]);
1295 $sQuery =
"INSERT INTO `sys_localization_keys` (`IDCategory`,`Key`) VALUES (?, ?)";
1296 db_res( $sQuery, [32, $sKey]);
1301 SELECT COUNT( * ) FROM `sys_localization_strings`
1302 WHERE `IDKey` = $iKeyID AND `IDLanguage` = {$this -> sLangID}";
1304 $iCount = (int)
db_value( $sQuery );
1308 UPDATE `sys_localization_strings`
1310 WHERE `IDKey` = ? AND `IDLanguage` = ?";
1312 db_res( $sQuery, [$sString, $iKeyID, $this->sLangID] );
1314 $sQuery =
"INSERT INTO `sys_localization_strings` VALUES ( ?, ?, ? )";
1315 db_res( $sQuery, [$iKeyID, $this->sLangID, $sString]);
1324 <html><script
type=
"text/javascript">
1330 $this -> isHaveErrors =
true;
1333 echo
"alert( '" . addslashes( $sText ) .
"' );";
1336 parent.genEditFormError(
'<?= $sField ?>',
'<?= addslashes( $sText ) ?>' );
1351 $this -> genSaveItemHeader();
1353 $aItem =
db_assoc_arr(
"SELECT * FROM `sys_profile_fields` WHERE `ID` = $iItemID" );
1356 $this -> genSaveItemError(
_t(
'_adm_fields_warning_item_not_found'));
1357 elseif( $aItem[
'Type'] ==
'system' or !(
int)$aItem[
'Deletable'] )
1358 $this -> genSaveItemError(
_t(
'_adm_fields_error_field_cannot_be_deleted'));
1360 $sQuery =
"DELETE FROM `sys_profile_fields` WHERE `ID` = $iItemID";
1363 if( $aItem[
'Type'] ==
'block' )
1364 db_res(
"DELETE FROM `sys_page_compose` WHERE `Func` = 'PFBlock' AND `Content` = '$iItemID'" );
1366 db_res(
"ALTER TABLE `Profiles` DROP `{$aItem['Name']}`" );
1368 $this -> genSaveItemFormUpdate(
'deleteItem', $iItemID );
1371 $this -> genSaveItemFooter();
1377 parent.updateBuilder(
'<?= $sText ?>', <?= $iItemID ?>,
'<?= addslashes( $sNewName ) ?>' );
1384 parent.hideEditForm();
1393 $this ->
id = $oArea -> iAreaID;
1395 $this -> active_blocks = array();
1396 $this -> inactive_blocks = array();
1397 $this -> active_items = array();
1398 $this -> inactive_items = array();
1400 foreach( $oArea -> aBlocks
as $iID =>
$sName )
1403 foreach( $oArea -> aItems
as $iID => $aItem )
1404 $this -> active_items[] =
new ChWsbPFMItem( $iID, $aItem[0], $aItem[1] );
1406 foreach( $oArea -> aBlocksInac
as $iID =>
$sName )
1409 foreach( $oArea -> aItemsInac
as $iID =>
$sName )
1422 $this -> block = $iBlock;
1438 $aAddBlockProps = array(
1440 'Caption' =>
'_FieldCaption_{Name}_Join',
1444 'Caption' =>
'_FieldCaption_{Name}_Edit',
1448 'Caption' =>
'_FieldCaption_{Name}_View',
1452 'Caption' =>
'_FieldCaption_{Name}_Search',
1460 'Caption' =>
'_FieldCaption_{Name}_Join',
1461 'Desc' =>
'_FieldDesc_{Name}_Join',
1462 'MandatoryMsg' =>
'_FieldError_{Name}_Mandatory',
1463 'MinMsg' =>
'_FieldError_{Name}_Min',
1464 'MaxMsg' =>
'_FieldError_{Name}_Max',
1465 'UniqueMsg' =>
'_FieldError_{Name}_Unique',
1466 'CheckMsg' =>
'_FieldError_{Name}_Check'
1469 'Caption' =>
'_FieldCaption_{Name}_Edit',
1470 'Desc' =>
'_FieldDesc_{Name}_Edit',
1471 'MandatoryMsg' =>
'_FieldError_{Name}_Mandatory',
1472 'MinMsg' =>
'_FieldError_{Name}_Min',
1473 'MaxMsg' =>
'_FieldError_{Name}_Max',
1474 'UniqueMsg' =>
'_FieldError_{Name}_Unique',
1475 'CheckMsg' =>
'_FieldError_{Name}_Check'
1478 'Caption' =>
'_FieldCaption_{Name}_View',
1479 'Desc' =>
'_FieldDesc_{Name}_View'
1482 'Caption' =>
'_FieldCaption_{Name}_Search',
1483 'Desc' =>
'_FieldDesc_{Name}_Search'
1487 $this -> aAreasProps = array (
1488 1 => array(
'Title' =>
'Join',
'Order' =>
'JoinOrder',
'Block' =>
'JoinBlock',
'AddSelect' =>
'Control,Extra,Min,Max,Values,Check,Unique,Mandatory,UseLKey,Default',
'AddBlockProps' => $aAddBlockProps[
'Join'],
'AddProps' => $aAddProps[
'Join'] ),
1490 2 => array(
'Title' =>
'Edit (Owner)',
'Order' =>
'EditOwnOrder',
'Block' =>
'EditOwnBlock',
'AddSelect' =>
'Control,Extra,Min,Max,Values,Check,Unique,Mandatory,UseLKey',
'AddBlockProps' => $aAddBlockProps[
'Edit'],
'AddProps' => $aAddProps[
'Edit'] ),
1491 3 => array(
'Title' =>
'Edit (Admin)',
'Order' =>
'EditAdmOrder',
'Block' =>
'EditAdmBlock',
'AddSelect' =>
'Control,Extra,Min,Max,Values,Check,Unique,Mandatory,UseLKey',
'AddBlockProps' => $aAddBlockProps[
'Edit'],
'AddProps' => $aAddProps[
'Edit'] ),
1492 4 => array(
'Title' =>
'Edit (Moder)',
'Order' =>
'EditModOrder',
'Block' =>
'EditModBlock',
'AddSelect' =>
'Control,Extra,Min,Max,Values,Check,Unique,Mandatory,UseLKey',
'AddBlockProps' => $aAddBlockProps[
'Edit'],
'AddProps' => $aAddProps[
'Edit'] ),
1494 5 => array(
'Title' =>
'View (Admin)',
'Order' =>
'ViewAdmOrder',
'Block' =>
'ViewAdmBlock',
'AddSelect' =>
'Values,UseLKey',
'AddBlockProps' => $aAddBlockProps[
'View'],
'AddProps' => $aAddProps[
'View'] ),
1495 6 => array(
'Title' =>
'View (Member)',
'Order' =>
'ViewMembOrder',
'Block' =>
'ViewMembBlock',
'AddSelect' =>
'Values,UseLKey',
'AddBlockProps' => $aAddBlockProps[
'View'],
'AddProps' => $aAddProps[
'View'] ),
1496 7 => array(
'Title' =>
'View (Moder)',
'Order' =>
'ViewModOrder',
'Block' =>
'ViewModBlock',
'AddSelect' =>
'Values,UseLKey',
'AddBlockProps' => $aAddBlockProps[
'View'],
'AddProps' => $aAddProps[
'View'] ),
1497 8 => array(
'Title' =>
'View (Visitor)',
'Order' =>
'ViewVisOrder',
'Block' =>
'ViewVisBlock',
'AddSelect' =>
'Values,UseLKey',
'AddBlockProps' => $aAddBlockProps[
'View'],
'AddProps' => $aAddProps[
'View'] ),
1499 9 => array(
'Title' =>
'Search (Simple)',
'Order' =>
'SearchSimpleOrder',
'Block' =>
'SearchSimpleBlock',
'AddSelect' =>
'Control,Extra,Min,Max,Values,UseLKey',
'AddBlockProps' => $aAddBlockProps[
'Search'],
'AddProps' => $aAddProps[
'Search'] ),
1500 10 => array(
'Title' =>
'Search (Quick)',
'Order' =>
'SearchQuickOrder',
'Block' =>
'SearchQuickBlock',
'AddSelect' =>
'Control,Extra,Min,Max,Values,UseLKey',
'AddBlockProps' => $aAddBlockProps[
'Search'],
'AddProps' => $aAddProps[
'Search'] ),
1501 11 => array(
'Title' =>
'Search (Adv)',
'Order' =>
'SearchAdvOrder',
'Block' =>
'SearchAdvBlock',
'AddSelect' =>
'Control,Extra,Min,Max,Values,UseLKey',
'AddBlockProps' => $aAddBlockProps[
'Search'],
'AddProps' => $aAddProps[
'Search'] ),
1504 100 => array(
'Title' =>
'All Fields. PC cache',
'AddSelect' =>
'Default,Unique,Extra' ),
1505 101 => array(
'Title' =>
'Matching Fields',
'AddSelect' =>
'MatchField,MatchPercent' ),
1515 $oCacheBlocks = $oPageViewCacher->getBlocksCacheObject ();
1516 $aBlockIds = array (4, 146, 147, 156);
1521 false.
'popup'.
false,
1527 foreach ($aBlockIds
as $iBlockId)
1528 foreach ($aKeys
as $sKey)
1529 $oCacheBlocks->delData($oPageViewCacher->genBlocksCacheKey ($iBlockId.$sKey));
1534 $sCacheString =
"// cache of Profile Fields\n\nreturn array(\n //areas\n";
1537 foreach ($this -> aAreasProps
as $iAreaID => $aArea) {
1540 $sCacheString .= $oArea -> getCacheString();
1543 $sCacheString .=
");\n";
1546 $aCacheArray = eval($sCacheString);
1549 return $oCache->setData (
$GLOBALS[
'MySQL']->genDbCacheKey(
'sys_profile_fields'), $aCacheArray);
1570 $this ->
id = $iAreaID;
1573 $this -> sTitle = $this -> oParent -> aAreasProps[ $this -> id ][
'Title'];
1574 $this -> sBlockCol = $this -> oParent -> aAreasProps[ $this -> id ][
'Block'];
1575 $this -> sOrderCol = $this -> oParent -> aAreasProps[ $this -> id ][
'Order'];
1576 $this -> sAddSelect = $this -> oParent -> aAreasProps[ $this -> id ][
'AddSelect'];
1577 $this -> aAddBlockProps = $this -> oParent -> aAreasProps[ $this -> id ][
'AddBlockProps'];
1578 $this -> aAddProps = $this -> oParent -> aAreasProps[ $this -> id ][
'AddProps'];
1583 $sCacheString =
"\n //{$this -> sTitle}\n {$this -> id} => array(\n";
1585 if( $this ->
id == 1 ) {
1588 $sCacheString .=
" //pages\n";
1589 foreach( $this -> aPages
as $iPage ){
1590 $this -> aBlocks = $this ->
getBlocks(
"`JoinPage` = $iPage" );
1592 $sCacheString .=
" $iPage => array(\n";
1594 $sCacheString .=
" ),\n";
1597 if( $this ->
id == 100
or $this ->
id == 101 )
1598 $this -> aBlocks = array( 0 =>
'' );
1600 $this -> aBlocks = $this ->
getBlocks();
1605 $sCacheString .=
" ),\n";
1607 return $sCacheString;
1612 $sCacheString =
"$sPrefix //blocks\n";
1614 foreach ($this -> aBlocks
as $iBlockID => $sBlockName) {
1615 $sBlockName = $this ->
addSlashes( $sBlockName );
1616 $sCacheString .=
"$sPrefix $iBlockID => array(\n";
1617 $sCacheString .=
"$sPrefix //block properties\n";
1620 if( is_array($this -> aAddBlockProps) )
1621 foreach ($this -> aAddBlockProps
as $sProp => $sValue) {
1622 $sPropValue = str_replace(
'{Name}', $sBlockName, $sValue );
1623 $sCacheString .=
"$sPrefix '$sProp' => '$sPropValue',\n";
1629 $sCacheString .=
"$sPrefix 'Items' => array(\n";
1630 foreach ($aItems
as $iBlockID => $aItem) {
1631 $sCacheString .=
"$sPrefix $iBlockID => array(\n";
1632 $sCacheString .=
"$sPrefix //item properties\n";
1635 if( is_array($this -> aAddProps) )
1636 foreach ($this -> aAddProps
as $sProp => $sValue) {
1637 $aItem[ $sProp ] = str_replace(
'{Name}', $aItem[
'Name'], $sValue );
1640 foreach ($aItem
as $sProp => $sValue) {
1641 if( $sProp ==
'ID' )
1644 $sCacheString .=
"$sPrefix '$sProp' => " . $this ->
processValue4CacheString( $sProp, $sValue,
"$sPrefix " ) .
",\n";
1647 $sCacheString .=
"$sPrefix ),\n";
1650 $sCacheString .=
"$sPrefix ),\n";
1651 $sCacheString .=
"$sPrefix ),\n";
1654 return $sCacheString;
1659 if( is_null( $sValue ) )
1667 case 'MandatoryMsg':
1675 case 'MatchPercent':
1680 return ( $sValue ==
'1' ?
'true' :
'false' );
1684 elseif( substr( $sValue, 0, 2) ==
'#!' )
1688 $aValues = explode(
"\n", $sValue );
1692 foreach( $aValues
as $iKey => $sValue1 ) {
1694 $sRet .=
"$sPrefix '$sValue1',\n";
1697 $sRet .=
"$sPrefix)";
1708 $sText = str_replace(
"\\",
"\\\\", $sText );
1709 $sText = str_replace(
"'",
"\\'", $sText );
1716 $sText = str_replace(
'\\',
'\\\\', $sText );
1717 $sText = str_replace(
'"',
'\"', $sText );
1718 $sText = str_replace(
'$',
'\$', $sText );
1719 $sText = str_replace(
"\r",
'\r', $sText );
1720 $sText = str_replace(
"\n",
'\n', $sText );
1721 $sText = str_replace(
"\t",
'\t', $sText );
1722 $sText = str_replace(
"\x0",
'\x0', $sText );
1735 FROM `sys_profile_fields`
1737 `Type` = 'block' AND
1738 `JoinOrder` IS NOT NULL
1739 ORDER BY `JoinPage` ASC
1742 $rPages =
db_res( $sQuery );
1744 while( $aPage = $rPages ->fetch() ) {
1745 $aPages[] = (int)$aPage[
'JoinPage'];
1760 FROM `sys_profile_fields`
1762 `Type` = 'block' AND
1763 `{$this -> sOrderCol}` IS NOT NULL AND
1766 `{$this -> sOrderCol}`
1769 $rBlocks =
db_res( $sQuery );
1771 while( $aBlock = $rBlocks ->fetch() ) {
1772 $aBlocks[ $aBlock[
'ID'] ] = $aBlock[
'Name'];
1782 $sAddSelect =
'`' . str_replace(
',',
'`, `', $this -> sAddSelect ) .
'`';
1784 if( $this ->
id == 100 )
1786 elseif( $this ->
id == 101 )
1787 $sWhere =
"`MatchField` != ''";
1789 $sWhere =
"`{$this -> sBlockCol}` = $iBlockID AND `{$this -> sOrderCol}` IS NOT NULL";
1791 $sOrderCol = isset( $this -> sOrderCol ) ? $this -> sOrderCol :
'ID';
1800 `sys_profile_fields`
1802 `Type` != 'block' AND
1808 $rItems =
db_res( $sQuery );
1810 while( $aItem = $rItems->fetch() ) {
1811 $aItems[ $aItem[
'ID'] ] = $aItem;