Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1033756
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
Fri, Jun 20, 9:44 PM
Size
6 KB
Mime Type
text/x-diff
Expires
Sun, Jun 22, 9:44 PM (2 h, 20 m)
Engine
blob
Format
Raw Data
Handle
668085
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/RC/core/kernel/constants.php
===================================================================
--- branches/RC/core/kernel/constants.php (revision 10856)
+++ branches/RC/core/kernel/constants.php (revision 10857)
@@ -1,75 +1,86 @@
<?php
// kDBList filter types (then, types are divided into classes)
define('HAVING_FILTER', 1);
define('WHERE_FILTER', 2);
define('AGGREGATE_FILTER', 3);
// kDBList filter classes
define('FLT_SYSTEM', 1); // System Having/Where filter [AND]
define('FLT_NORMAL', 2); // User Having/Where filter [OR]
define('FLT_SEARCH', 3); // User "Search" Having/Where filter [OR]
define('FLT_VIEW', 4); // User "View Menu" Having/Where filter [AND]
define('FLT_CUSTOM', 5); // Custom fields (above) grid columns [AND]
// kMultipleFilter types
define('FLT_TYPE_AND', 'AND');
define('FLT_TYPE_OR', 'OR');
// item statuses
safeDefine('STATUS_DISABLED', 0);
safeDefine('STATUS_ACTIVE', 1);
safeDefine('STATUS_PENDING', 2);
safeDefine('STATUS_PENDING_EDITING', -2);
// sections
define('stTREE', 1);
define('stTAB', 2);
// event statuses
define('erSUCCESS', 0); // event finished working succsessfully
define('erFAIL', -1); // event finished working, but result is unsuccsessfull
define('erFATAL', -2); // event experienced FATAL error - no hooks should continue!
define('erPERM_FAIL', -3); // event failed on internal permission checking (user has not permission)
define('erSTOP', -4); // event requested to stop processing (don't parse templates)
// permission types
define('ptCATEGORY', 0);
define('ptSYSTEM', 1);
// email event statuses & types
define('EVENT_TYPE_FRONTEND', 0);
define('EVENT_TYPE_ADMIN', 1);
define('EVENT_STATUS_DISABLED', 0);
define('EVENT_STATUS_ENABLED', 1);
define('EVENT_STATUS_FRONTEND', 2);
define('EDIT_MARK', '&|edit|&'); // replace this sequence inside filters to SID[_main_wid]
$application =& kApplication::Instance();
$spacer_url = $application->BaseURL().'core/admin_templates/img/spacer.gif';
define('SPACER_URL', $spacer_url);
if (!$application->IsAdmin()) {
// don't show debugger buttons on front (if not overrided in "debug.php")
safeDefine('DBG_TOOLBAR_BUTTONS', 0);
}
define('smDEBUG', 2); // show section in debug mode only
define('smSUPER_ADMIN', 4); // show section in super admin & debug mode
// common usage regular expressions
define('REGEX_EMAIL_USER', '[-a-zA-Z0-9!\#$%&*+\/=?^_`{|}~.]+');
define('REGEX_EMAIL_DOMAIN', '[a-zA-Z0-9]{1}[-.a-zA-Z0-9_]*\.[a-zA-Z]{2,6}');
define('ALLOW_DEFAULT_SETTINGS', '_USE_DEFAULT_USER_DATA_'); //Allow persistent vars to take data from default user's persistent data
define('XML_NO_TEXT_NODES', 1); // Normal mode for XMLHelper
define('XML_WITH_TEXT_NODES', 2); // Will create text nodes for every char-data (used in kPDFHelper)
// ChangeLog actions
define('clCREATE', 1);
define('clUPDATE', 2);
define('clDELETE', 3);
+
+ /**
+ * Separator for ValueList fields
+ *
+ */
+ define('VALUE_LIST_SEPARATOR', '||');
+
+ // template editing modes
+ define('EDITING_MODE_CMS', 1);
+ define('EDITING_MODE_LAYOUT', 2);
+ define('EDITING_MODE_DESIGN', 3);
?>
\ No newline at end of file
Property changes on: branches/RC/core/kernel/constants.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.7.2.3
\ No newline at end of property
+1.7.2.4
\ No newline at end of property
Index: branches/RC/core/units/general/custom_fields.php
===================================================================
--- branches/RC/core/units/general/custom_fields.php (revision 10856)
+++ branches/RC/core/units/general/custom_fields.php (revision 10857)
@@ -1,99 +1,99 @@
<?php
/**
* Enter description here...
*
* @todo rewrite
*/
class InpCustomFieldsHelper extends kHelper {
function GetValuesHash($values_list)
{
- $optionValuesStr = trim($this->ParseConfigSQL($values_list), ',');
+ $optionValuesStr = trim($this->ParseConfigSQL($values_list), VALUE_LIST_SEPARATOR);
if (!$optionValuesStr) {
// no options, then return empty array
return Array();
}
- $optionValuesTmp = explode(',', $optionValuesStr);
+ $optionValuesTmp = explode(VALUE_LIST_SEPARATOR, $optionValuesStr);
$optionValues = Array();
if (substr_count($optionValuesStr, '=') != count($optionValuesTmp)) {
trigger_error('Invalid symbol in ValueList field [' . substr($optionValuesStr, 0, 100) . ' ...]' , E_USER_NOTICE);
return Array ();
}
foreach ($optionValuesTmp as $optionValue) {
list($key, $val) = explode('=', $optionValue);
$val = (substr($val,0,1) == '+') ? substr($val, 1) : $this->Application->Phrase($val);
$optionValues[$key] = $val;
}
return $optionValues;
}
/**
* Replace SQL's in valueList with appropriate queried values
*
* @param string $valueString
* @return string
* @todo Apply refactoring to embedded vars stuff
*/
function ParseConfigSQL($valueString)
{
$string = trim( str_replace(Array('<PREFIX>', '%3$s'), Array (TABLE_PREFIX, $this->Application->GetVar('m_lang')), $valueString) );
preg_match_all("|\{(.*)\}|U", $string, $embedded_vars, PREG_SET_ORDER);
/*
<SQL> in ValueList now can use globally available variables.
Usage: {$_POST['variable']|what to output if $_POST['variable'] is set}
e.g. $_POST['variable']='Hello'
Will output: what to output if Hello is set
*/
if ($embedded_vars) {
for ($i = 0; $i < count($embedded_vars); $i++) {
$embedded_var = $embedded_vars[$i][1];
$embedded_var_src = $embedded_vars[$i][0];
list($var_name, $pattern) = explode('|', $embedded_var);
eval('$var_value = (isset('.$var_name.')?'.$var_name.':false);');
if ($var_value !== false) {
$pattern = str_replace($var_name, $var_value, $pattern);
$string = str_replace($embedded_var_src, $pattern, $string);
}
else {
$string = str_replace($embedded_var_src, '', $string);
}
}
}
if (preg_match_all('/<SQL([+]{0,1})>(.*?)<\/SQL>/', $string, $regs)) {
$i = 0;
$sql_count = count($regs[0]);
while ($i < $sql_count) {
$string = str_replace('<SQL'.$regs[1][$i].'>'.$regs[2][$i].'</SQL>', $this->QueryConfigSQL($regs[2][$i], $regs[1][$i]), $string);
$i++;
}
$string = preg_replace('/(,){2,}/', ',', $string); // trim trailing commas inside string
}
return $string;
}
function QueryConfigSQL($sql, $plus = '')
{
$valArray = $this->Conn->Query($sql);
for($i=0; $i<sizeof($valArray); $i++)
{
$valArray[$i] = $valArray[$i]['OptionValue'].'='.$plus.$valArray[$i]['OptionName'];
$valArray[$i] = str_replace(',', ';', $valArray[$i]);
}
return implode(',', $valArray);
}
}
?>
\ No newline at end of file
Property changes on: branches/RC/core/units/general/custom_fields.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.9.2.1
\ No newline at end of property
+1.9.2.2
\ No newline at end of property
Event Timeline
Log In to Comment