Index: trunk/core/units/general/helpers/helpers_config.php =================================================================== diff -u -N -r7855 -r7997 --- trunk/core/units/general/helpers/helpers_config.php (.../helpers_config.php) (revision 7855) +++ trunk/core/units/general/helpers/helpers_config.php (.../helpers_config.php) (revision 7997) @@ -18,5 +18,6 @@ Array('pseudo'=>'ThemesHelper','class'=>'kThemesHelper','file'=>'themes_helper.php','build_event'=>'','require_classes'=>'kHelper'), Array('pseudo'=>'CaptchaHelper','class'=>'kCaptchaHelper','file'=>'captcha_helper.php','build_event'=>'','require_classes'=>'kHelper'), Array('pseudo'=>'PriorityHelper','class'=>'kPriorityHelper','file'=>'priority_helper.php','build_event'=>'','require_classes'=>'kHelper'), + Array('pseudo' => 'CurlHelper', 'class' => 'kCurlHelper','file' => 'curl_helper.php', 'build_event' => '', 'require_classes' => Array('kHelper')), ), ); \ No newline at end of file Index: trunk/core/install/install_schema.sql =================================================================== diff -u -N -r7855 -r7997 --- trunk/core/install/install_schema.sql (.../install_schema.sql) (revision 7855) +++ trunk/core/install/install_schema.sql (.../install_schema.sql) (revision 7997) @@ -180,7 +180,7 @@ CREATE TABLE PortalUser ( PortalUserId int(11) NOT NULL auto_increment, Login varchar(255) default NULL, - `Password` varchar(255) default NULL, + `Password` VARCHAR(255) NULL DEFAULT 'd41d8cd98f00b204e9800998ecf8427e', FirstName varchar(255) default NULL, LastName varchar(255) default NULL, Company varchar(255) NOT NULL default '', Index: trunk/core/units/email_events/email_events_config.php =================================================================== diff -u -N -r7855 -r7997 --- trunk/core/units/email_events/email_events_config.php (.../email_events_config.php) (revision 7855) +++ trunk/core/units/email_events/email_events_config.php (.../email_events_config.php) (revision 7997) @@ -60,10 +60,10 @@ 'EventId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), 'Event' => Array('type' => 'string','not_null' => '1','default' => ''), 'Enabled' => Array('type'=>'int', 'formatter'=>'kOptionsFormatter', 'options' => Array(1 => 'la_Enabled', 0 => 'la_Disabled', 2 => 'la_Text_FrontOnly'), 'use_phrases' => 1, 'default' => 1, 'not_null' => 1), - 'FromUserId' => Array('formatter' => 'kLEFTFormatter','options' => Array(-1=>'root'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'required'=>1, 'not_null' => 1, 'default' => -1), + 'FromUserId' => Array('type' => 'int', 'formatter' => 'kLEFTFormatter','options' => Array(-1=>'root'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'required'=>1, 'not_null' => 1, 'default' => -1), 'Module' => Array('type' => 'string','not_null' => '1','default' => ''), 'Description' => Array('type' => 'string','not_null' => '1','default' => ''), - 'Type' => Array('formatter'=>'kOptionsFormatter', 'options' => Array (1 => 'la_Text_Admin', 0 => 'la_Text_User'), 'use_phrases' => 1, 'default' => 0, 'not_null' => 1), + 'Type' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'options' => Array (1 => 'la_Text_Admin', 0 => 'la_Text_User'), 'use_phrases' => 1, 'default' => 0, 'not_null' => 1), ), 'VirtualFields' => Array( 'FromUser' => Array(), Index: trunk/core/units/email_messages/email_messages_config.php =================================================================== diff -u -N -r7991 -r7997 --- trunk/core/units/email_messages/email_messages_config.php (.../email_messages_config.php) (revision 7991) +++ trunk/core/units/email_messages/email_messages_config.php (.../email_messages_config.php) (revision 7997) @@ -56,7 +56,7 @@ 'Fields' => Array ( 'EmailMessageId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), 'Template' => Array('type' => 'string','default' => ''), - 'ReplacementTags' => Array ('type' => 'string', 'not_null' => 1, 'default' => 'a:0:{}'), + 'ReplacementTags' => Array ('type' => 'string', 'not_null' => 1, 'default' => null), 'MessageType' => Array('type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array('text'=>'la_Text','html'=>'la_Html'), 'not_null' => '1','default' => 'text'), 'LanguageId' => Array('type' => 'int', 'not_null' => '1', 'default' => '0'), 'EventId' => Array('type' => 'int', 'not_null' => '1', 'default' => '0'), Index: trunk/core/units/category_items/category_items_config.php =================================================================== diff -u -N -r6093 -r7997 --- trunk/core/units/category_items/category_items_config.php (.../category_items_config.php) (revision 6093) +++ trunk/core/units/category_items/category_items_config.php (.../category_items_config.php) (revision 7997) @@ -50,7 +50,7 @@ 'Fields' => Array( 'DummyId' => Array(), 'CategoryId' => Array('type'=>'int','not_null'=>1,'default'=>0), - 'ItemResourceId' => Array('not_null' => 1, 'default' => 0), + 'ItemResourceId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), 'PrimaryCat' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), 'ItemPrefix' => Array('type' => 'string','not_null'=>1,'default'=>''), 'Filename' => Array('type' => 'string','not_null'=>1,'default'=>''), Index: trunk/core/units/relationship/relationship_config.php =================================================================== diff -u -N -r7867 -r7997 --- trunk/core/units/relationship/relationship_config.php (.../relationship_config.php) (revision 7867) +++ trunk/core/units/relationship/relationship_config.php (.../relationship_config.php) (revision 7997) @@ -78,8 +78,8 @@ 'Fields' => Array( 'RelationshipId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), - 'SourceId' => Array('type'=>'int', 'required' => 1, 'default' => 0), - 'TargetId' => Array('type'=>'int', 'required' => 1, 'default' => ''), + 'SourceId' => Array('type'=>'int', 'required' => 1, 'default' => NULL), + 'TargetId' => Array('type'=>'int', 'required' => 1, 'default' => NULL), 'SourceType' => Array('type'=>'int','not_null'=>1,'default'=>0), 'TargetType' => Array('type'=>'int','not_null'=>1,'default'=>0), 'Type' => Array('type'=>'int','formatter'=>'kOptionsFormatter', 'required' => 1, 'options'=>Array(1=>'la_Reciprocal',0=>'la_OneWay'),'not_null'=>1,'default'=>0,'use_phrases'=>1), Index: trunk/core/units/images/images_config.php =================================================================== diff -u -N -r7991 -r7997 --- trunk/core/units/images/images_config.php (.../images_config.php) (revision 7991) +++ trunk/core/units/images/images_config.php (.../images_config.php) (revision 7997) @@ -79,12 +79,12 @@ 'Fields' => Array( 'ImageId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), 'ResourceId' => Array('type'=>'int', 'not_null'=>1, 'default' => 0), - 'Url' => Array('max_len'=>255, 'default' => '', 'not_null'=>1), - 'Name' => Array('max_len'=>255, 'required'=>1, 'not_null'=>1, 'default' => ''), - 'AltName' => Array('max_len'=>255, 'required'=>1, 'not_null'=>1, 'default' => ''), + 'Url' => Array('type' => 'string', 'max_len'=>255, 'default' => '', 'not_null'=>1), + 'Name' => Array('type' => 'string', 'max_len'=>255, 'required'=>1, 'not_null'=>1, 'default' => ''), + 'AltName' => Array('type' => 'string', 'max_len'=>255, 'required'=>1, 'not_null'=>1, 'default' => ''), 'ImageIndex' => Array('type'=>'int', 'default' => 0, 'not_null'=>1), 'LocalImage' => Array('type'=>'int', 'default' => 1, 'not_null'=>1), - 'LocalPath' => Array('formatter'=>'kPictureFormatter', 'skip_empty'=>1, 'max_len'=>240, 'default' => '', 'not_null' => 1, 'include_path' => 1, + 'LocalPath' => Array('type' => 'string', 'formatter'=>'kPictureFormatter', 'skip_empty'=>1, 'max_len'=>240, 'default' => '', 'not_null' => 1, 'include_path' => 1, 'allowed_types' => Array( 0 => 'image/jpeg', 1 => 'image/pjpeg', @@ -97,11 +97,11 @@ 'cant_save_file' => '!la_error_cant_save_file!' ) ), - 'Enabled' => Array('formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options' => Array ( 1 => 'la_Enabled', 0 => 'la_Disabled' ), 'default' => 0, 'not_null'=>1), + 'Enabled' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options' => Array ( 1 => 'la_Enabled', 0 => 'la_Disabled' ), 'default' => 0, 'not_null'=>1), 'DefaultImg' => Array('type'=>'int', 'default' => 0, 'not_null'=>1), 'ThumbUrl' => Array('type' => 'string', 'max_len' => 255, 'default' => ''), 'Priority' => Array('type'=>'int', 'default' => 0, 'not_null'=>1), - 'ThumbPath' => Array( 'formatter'=>'kPictureFormatter', 'skip_empty'=>1, 'max_len' => 255, 'default' => '', + 'ThumbPath' => Array('type' => 'string', 'formatter'=>'kPictureFormatter', 'skip_empty'=>1, 'max_len' => 255, 'default' => '', 'allowed_types' => Array( 0 => 'image/jpeg', 1 => 'image/pjpeg', Index: trunk/core/units/categories/categories_config.php =================================================================== diff -u -N -r7855 -r7997 --- trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 7855) +++ trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 7997) @@ -227,7 +227,7 @@ 'Filename' => Array('type' => 'string', 'not_null' => 1, 'default' => ''), 'AutomaticFilename' => Array('type' => 'int', 'not_null' => 1, 'default' => 1), 'Description' => Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'required' => 1, 'default' => ''), - 'CreatedOn' => Array('formatter' => 'kDateFormatter', 'default'=>'#NOW#', 'required' => 1, 'not_null' => 1), + 'CreatedOn' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'default'=>'#NOW#', 'required' => 1, 'not_null' => 1), 'EditorsPick' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), 'Status' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Active', 2 => 'la_Pending', 0 => 'la_Disabled' ), 'use_phrases' => 1, 'not_null' => 1,'default' => 2), 'Priority' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), Index: trunk/kernel/units/relationship/relationship_config.php =================================================================== diff -u -N -r7867 -r7997 --- trunk/kernel/units/relationship/relationship_config.php (.../relationship_config.php) (revision 7867) +++ trunk/kernel/units/relationship/relationship_config.php (.../relationship_config.php) (revision 7997) @@ -78,8 +78,8 @@ 'Fields' => Array( 'RelationshipId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), - 'SourceId' => Array('type'=>'int', 'required' => 1, 'default' => 0), - 'TargetId' => Array('type'=>'int', 'required' => 1, 'default' => ''), + 'SourceId' => Array('type'=>'int', 'required' => 1, 'default' => NULL), + 'TargetId' => Array('type'=>'int', 'required' => 1, 'default' => NULL), 'SourceType' => Array('type'=>'int','not_null'=>1,'default'=>0), 'TargetType' => Array('type'=>'int','not_null'=>1,'default'=>0), 'Type' => Array('type'=>'int','formatter'=>'kOptionsFormatter', 'required' => 1, 'options'=>Array(1=>'la_Reciprocal',0=>'la_OneWay'),'not_null'=>1,'default'=>0,'use_phrases'=>1), Index: trunk/kernel/units/images/images_config.php =================================================================== diff -u -N -r7991 -r7997 --- trunk/kernel/units/images/images_config.php (.../images_config.php) (revision 7991) +++ trunk/kernel/units/images/images_config.php (.../images_config.php) (revision 7997) @@ -79,12 +79,12 @@ 'Fields' => Array( 'ImageId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), 'ResourceId' => Array('type'=>'int', 'not_null'=>1, 'default' => 0), - 'Url' => Array('max_len'=>255, 'default' => '', 'not_null'=>1), - 'Name' => Array('max_len'=>255, 'required'=>1, 'not_null'=>1, 'default' => ''), - 'AltName' => Array('max_len'=>255, 'required'=>1, 'not_null'=>1, 'default' => ''), + 'Url' => Array('type' => 'string', 'max_len'=>255, 'default' => '', 'not_null'=>1), + 'Name' => Array('type' => 'string', 'max_len'=>255, 'required'=>1, 'not_null'=>1, 'default' => ''), + 'AltName' => Array('type' => 'string', 'max_len'=>255, 'required'=>1, 'not_null'=>1, 'default' => ''), 'ImageIndex' => Array('type'=>'int', 'default' => 0, 'not_null'=>1), 'LocalImage' => Array('type'=>'int', 'default' => 1, 'not_null'=>1), - 'LocalPath' => Array('formatter'=>'kPictureFormatter', 'skip_empty'=>1, 'max_len'=>240, 'default' => '', 'not_null' => 1, 'include_path' => 1, + 'LocalPath' => Array('type' => 'string', 'formatter'=>'kPictureFormatter', 'skip_empty'=>1, 'max_len'=>240, 'default' => '', 'not_null' => 1, 'include_path' => 1, 'allowed_types' => Array( 0 => 'image/jpeg', 1 => 'image/pjpeg', @@ -97,11 +97,11 @@ 'cant_save_file' => '!la_error_cant_save_file!' ) ), - 'Enabled' => Array('formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options' => Array ( 1 => 'la_Enabled', 0 => 'la_Disabled' ), 'default' => 0, 'not_null'=>1), + 'Enabled' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options' => Array ( 1 => 'la_Enabled', 0 => 'la_Disabled' ), 'default' => 0, 'not_null'=>1), 'DefaultImg' => Array('type'=>'int', 'default' => 0, 'not_null'=>1), 'ThumbUrl' => Array('type' => 'string', 'max_len' => 255, 'default' => ''), 'Priority' => Array('type'=>'int', 'default' => 0, 'not_null'=>1), - 'ThumbPath' => Array( 'formatter'=>'kPictureFormatter', 'skip_empty'=>1, 'max_len' => 255, 'default' => '', + 'ThumbPath' => Array('type' => 'string', 'formatter'=>'kPictureFormatter', 'skip_empty'=>1, 'max_len' => 255, 'default' => '', 'allowed_types' => Array( 0 => 'image/jpeg', 1 => 'image/pjpeg', Index: trunk/core/units/general/helpers/curl_helper.php =================================================================== diff -u -N --- trunk/core/units/general/helpers/curl_helper.php (revision 0) +++ trunk/core/units/general/helpers/curl_helper.php (revision 7997) @@ -0,0 +1,198 @@ +debugMode = $this->Application->isDebugMode(false) && constOn('DBG_CURL'); + } + + function SetOptions() + { + // customizable options + curl_setopt($this->connectionID, CURLOPT_FOLLOWLOCATION, $this->followLocation ? 1 : 0); + curl_setopt($this->connectionID, CURLOPT_TIMEOUT, $this->timeout); + + // hardcoded options + curl_setopt($this->connectionID, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($this->connectionID, CURLOPT_REFERER, PROTOCOL.SERVER_NAME); + curl_setopt($this->connectionID, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); + + if ($this->requestHeaders) { + curl_setopt($this->connectionID, CURLOPT_HTTPHEADER, $this->prepareHeaders()); + } + + // if we have post data, then POST else use GET method instead + if ($this->postData) { + curl_setopt($this->connectionID, CURLOPT_POST, 1); + curl_setopt($this->connectionID, CURLOPT_POSTFIELDS, $this->postData); + } + +// curl_setopt($this->connectionID, CURLOPT_HEADERFUNCTION, Array(&$this, 'ParseHeader')); + } + + function ParseHeader(&$ch, $header) + { + $this->responceHeaders[] = $header; + return strlen($header); + } + + /** + * Sets POST data for next query + * + * @param mixed $post_data Array or string + */ + function SetPostData($post_data) + { + if (is_array($post_data)) { + $params_str = ''; + foreach ($post_data as $key => $value) { + $params_str .= $key.'='.urlencode($value).'&'; + } + $post_data = $params_str; + } + + $this->postData = $post_data; + } + + function SetHeaders($headers) + { + $this->requestHeaders = array_merge_recursive2($this->requestHeaders, $headers); + } + + function SetHeader($name, $value) + { + $this->requestHeaders[$name] = $value; + } + + /** + * Returns compiled header to be used by curl + * + * @return Array + */ + function prepareHeaders() + { + $ret = Array (); + foreach ($this->requestHeaders as $header_name => $header_value) { + $ret[] = $header_name.': '.$header_value; + } + return $ret; + } + + function Send($url) + { + $this->connectionID = curl_init($url); + + if ($this->debugMode) { + safeDefine('DBG_CURL_LOGFILE', '/curl.log'); + $this->logFilePointer = fopen(FULL_PATH.DBG_CURL_LOGFILE, 'a'); + + curl_setopt($this->connectionID, CURLOPT_FILE, $this->logFilePointer); + curl_setopt($this->connectionID, CURLOPT_VERBOSE, true); + curl_setopt($this->connectionID, CURLOPT_STDERR, $this->logFilePointer); + //curl_setopt($this->connectionID, CURLOPT_WRITEHEADER, $this->logFilePointer); + } + + $this->responceHeaders = Array (); + + $this->SetOptions(); + $this->lastRespoce = curl_exec($this->connectionID); + $this->Finalize(); + + return $this->lastRespoce; + } + + function Finalize() + { + $this->lastErrorCode = curl_errno($this->connectionID); + $this->lastErrorMsg = curl_error($this->connectionID); + $this->lastHTTPCode = curl_getinfo($this->connectionID, CURLINFO_HTTP_CODE); + + if ($this->debugMode) { + fwrite($this->logFilePointer, "\n".$this->lastRespoce); + fclose($this->logFilePointer); + } + + curl_close($this->connectionID); + $this->postData = ''; + $this->requestHeaders = Array (); + } + } + +?> \ No newline at end of file Index: trunk/core/units/reviews/reviews_config.php =================================================================== diff -u -N -r7867 -r7997 --- trunk/core/units/reviews/reviews_config.php (.../reviews_config.php) (revision 7867) +++ trunk/core/units/reviews/reviews_config.php (.../reviews_config.php) (revision 7997) @@ -96,14 +96,14 @@ 'Fields' => Array( 'ReviewId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), - 'CreatedOn' => Array('formatter'=>'kDateFormatter','not_null'=>1,'default'=>'#NOW#'), + 'CreatedOn' => Array('type' => 'double', 'formatter'=>'kDateFormatter','not_null'=>1,'default'=>'#NOW#'), 'ReviewText' => Array('type'=>'string','required'=>1,'not_null'=>1,'default'=>''), 'IPAddress' => Array('type'=>'string','max_value_inc'=>15,'not_null'=>1,'default'=>''), 'ItemId' => Array('type'=>'int','not_null'=>1,'default'=>0), - 'CreatedById' => Array('formatter'=>'kLEFTFormatter','options'=>Array(-1=>'root',-2=>'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'','left_key_field'=>'PortalUserId','left_title_field'=>'Login','required'=>1,'not_null'=>1,'default'=>-1), + 'CreatedById' => Array('type' => 'int', 'formatter'=>'kLEFTFormatter','options'=>Array(-1=>'root',-2=>'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'','left_key_field'=>'PortalUserId','left_title_field'=>'Login','required'=>1,'not_null'=>1,'default'=>-1), 'ItemType' => Array('type'=>'int','not_null'=>1,'default'=>0), 'Priority' => Array('type'=>'int','not_null'=>1,'default'=>0), - 'Status' => Array('formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array(1=>'la_Active',2=>'la_Pending',0=>'la_Disabled'),'not_null'=>1,'default'=>2 ), + 'Status' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array(1=>'la_Active',2=>'la_Pending',0=>'la_Disabled'),'not_null'=>1,'default'=>2 ), 'TextFormat' => Array('type'=>'int','not_null'=>1,'default'=>0), 'Module' => Array('type'=>'string','not_null'=>1,'default'=>''), ), Index: trunk/kernel/units/reviews/reviews_config.php =================================================================== diff -u -N -r7867 -r7997 --- trunk/kernel/units/reviews/reviews_config.php (.../reviews_config.php) (revision 7867) +++ trunk/kernel/units/reviews/reviews_config.php (.../reviews_config.php) (revision 7997) @@ -96,14 +96,14 @@ 'Fields' => Array( 'ReviewId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), - 'CreatedOn' => Array('formatter'=>'kDateFormatter','not_null'=>1,'default'=>'#NOW#'), + 'CreatedOn' => Array('type' => 'double', 'formatter'=>'kDateFormatter','not_null'=>1,'default'=>'#NOW#'), 'ReviewText' => Array('type'=>'string','required'=>1,'not_null'=>1,'default'=>''), 'IPAddress' => Array('type'=>'string','max_value_inc'=>15,'not_null'=>1,'default'=>''), 'ItemId' => Array('type'=>'int','not_null'=>1,'default'=>0), - 'CreatedById' => Array('formatter'=>'kLEFTFormatter','options'=>Array(-1=>'root',-2=>'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'','left_key_field'=>'PortalUserId','left_title_field'=>'Login','required'=>1,'not_null'=>1,'default'=>-1), + 'CreatedById' => Array('type' => 'int', 'formatter'=>'kLEFTFormatter','options'=>Array(-1=>'root',-2=>'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'','left_key_field'=>'PortalUserId','left_title_field'=>'Login','required'=>1,'not_null'=>1,'default'=>-1), 'ItemType' => Array('type'=>'int','not_null'=>1,'default'=>0), 'Priority' => Array('type'=>'int','not_null'=>1,'default'=>0), - 'Status' => Array('formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array(1=>'la_Active',2=>'la_Pending',0=>'la_Disabled'),'not_null'=>1,'default'=>2 ), + 'Status' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array(1=>'la_Active',2=>'la_Pending',0=>'la_Disabled'),'not_null'=>1,'default'=>2 ), 'TextFormat' => Array('type'=>'int','not_null'=>1,'default'=>0), 'Module' => Array('type'=>'string','not_null'=>1,'default'=>''), ), Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r7991 -r7997 --- trunk/core/kernel/application.php (.../application.php) (revision 7991) +++ trunk/core/kernel/application.php (.../application.php) (revision 7997) @@ -1678,9 +1678,11 @@ if ($res) { $this->Caches['PhraseList'] = $res['PhraseList'] ? explode(',', $res['PhraseList']) : array(); - + $config_ids = $res['ConfigVariables'] ? explode(',', $res['ConfigVariables']) : array(); - $config_ids = array_diff($config_ids, $this->Caches['ConfigVariables']); + if (isset($this->Caches['ConfigVariables'])) { + $config_ids = array_diff($config_ids, $this->Caches['ConfigVariables']); + } } else { $config_ids = array(); Index: trunk/core/units/users/users_config.php =================================================================== diff -u -N -r7855 -r7997 --- trunk/core/units/users/users_config.php (.../users_config.php) (revision 7855) +++ trunk/core/units/users/users_config.php (.../users_config.php) (revision 7997) @@ -142,12 +142,12 @@ 'Street' => Array('type' => 'string','default' => ''), 'Street2' => Array('type' => 'string', 'not_null' => '1', 'default' => ''), 'City' => Array('type' => 'string','default' => ''), - 'State' => Array('formatter'=>'kOptionsFormatter', + 'State' => Array('type' => 'string', 'formatter'=>'kOptionsFormatter', 'options' => Array(), 'option_key_field'=>'DestAbbr','option_title_field'=>'Translation', 'not_null' => '1','default' => ''), 'Zip' => Array('type' => 'string','default' => ''), - 'Country' => Array('formatter'=>'kOptionsFormatter', + 'Country' => Array('type' => 'string', 'formatter'=>'kOptionsFormatter', 'options_sql'=>'SELECT %1$s FROM '.TABLE_PREFIX.'StdDestinations LEFT JOIN '.TABLE_PREFIX.'Phrase Index: trunk/admin/install/inportal_schema.sql =================================================================== diff -u -N -r7867 -r7997 --- trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 7867) +++ trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 7997) @@ -131,7 +131,7 @@ AdvancedSearch tinyint(4) NOT NULL default '1', Description varchar(255) default NULL, DisplayName varchar(80) default NULL, - ModuleName varchar(20) default NULL, + ModuleName VARCHAR(20) NULL DEFAULT 'In-Portal', ConfigHeader varchar(255) default NULL, DisplayOrder int(11) NOT NULL default '0', SearchConfigId int(11) NOT NULL auto_increment, Index: trunk/core/install/upgrades.sql =================================================================== diff -u -N -r7855 -r7997 --- trunk/core/install/upgrades.sql (.../upgrades.sql) (revision 7855) +++ trunk/core/install/upgrades.sql (.../upgrades.sql) (revision 7997) @@ -37,7 +37,8 @@ CHANGE CreatedOn CreatedOn INT DEFAULT NULL, CHANGE dob dob INT(11) NULL DEFAULT NULL, CHANGE PassResetTime PassResetTime INT(11) UNSIGNED NULL DEFAULT NULL, - CHANGE PwRequestTime PwRequestTime INT(11) UNSIGNED NULL DEFAULT NULL; + CHANGE PwRequestTime PwRequestTime INT(11) UNSIGNED NULL DEFAULT NULL, + CHANGE `Password` `Password` VARCHAR(255) NULL DEFAULT 'd41d8cd98f00b204e9800998ecf8427e'; ALTER TABLE Modules CHANGE BuildDate BuildDate INT UNSIGNED NULL DEFAULT NULL, Index: trunk/admin/install/upgrades/inportal_upgrade_v4.0.2.sql =================================================================== diff -u -N -r7867 -r7997 --- trunk/admin/install/upgrades/inportal_upgrade_v4.0.2.sql (.../inportal_upgrade_v4.0.2.sql) (revision 7867) +++ trunk/admin/install/upgrades/inportal_upgrade_v4.0.2.sql (.../inportal_upgrade_v4.0.2.sql) (revision 7997) @@ -8,7 +8,7 @@ ALTER TABLE EmailQueue CHANGE `Subject` `Subject` TEXT, CHANGE toaddr toaddr TEXT, CHANGE fromaddr fromaddr TEXT; ALTER TABLE Category DROP Pop; -ALTER TABLE PortalUser CHANGE CreatedOn CreatedOn INT NOT NULL DEFAULT '0', CHANGE dob dob INT(11) NULL DEFAULT NULL, CHANGE PassResetTime PassResetTime INT(11) UNSIGNED NULL DEFAULT NULL, CHANGE PwRequestTime PwRequestTime INT(11) UNSIGNED NULL DEFAULT NULL; +ALTER TABLE PortalUser CHANGE CreatedOn CreatedOn INT NOT NULL DEFAULT '0', CHANGE dob dob INT(11) NULL DEFAULT NULL, CHANGE PassResetTime PassResetTime INT(11) UNSIGNED NULL DEFAULT NULL, CHANGE PwRequestTime PwRequestTime INT(11) UNSIGNED NULL DEFAULT NULL, CHANGE `Password` `Password` VARCHAR(255) NULL DEFAULT 'd41d8cd98f00b204e9800998ecf8427e'; ALTER TABLE Modules CHANGE BuildDate BuildDate INT UNSIGNED NULL DEFAULT NULL, CHANGE Version Version VARCHAR(10) NOT NULL DEFAULT '0.0.0'; ALTER TABLE Language CHANGE Enabled Enabled INT(11) NOT NULL DEFAULT '1', CHANGE InputDateFormat InputDateFormat VARCHAR(50) NOT NULL DEFAULT 'm/d/Y', CHANGE InputTimeFormat InputTimeFormat VARCHAR(50) NOT NULL DEFAULT 'g:i:s A', CHANGE DecimalPoint DecimalPoint CHAR(2) NOT NULL DEFAULT ''; @@ -19,7 +19,7 @@ ALTER TABLE PermCache DROP DACL; ALTER TABLE Images CHANGE LocalThumb LocalThumb TINYINT(4) NOT NULL DEFAULT '1', CHANGE SameImages SameImages TINYINT(4) NOT NULL DEFAULT '1'; -ALTER TABLE SearchConfig CHANGE SimpleSearch SimpleSearch TINYINT(4) NOT NULL DEFAULT '1', CHANGE AdvancedSearch AdvancedSearch TINYINT(4) NOT NULL DEFAULT '1'; +ALTER TABLE SearchConfig CHANGE SimpleSearch SimpleSearch TINYINT(4) NOT NULL DEFAULT '1', CHANGE AdvancedSearch AdvancedSearch TINYINT(4) NOT NULL DEFAULT '1', CHANGE ModuleName ModuleName VARCHAR(20) NULL DEFAULT 'In-Portal'; ALTER TABLE ItemReview CHANGE CreatedById CreatedById INT(11) NOT NULL DEFAULT '-1', CHANGE Status Status TINYINT(4) NOT NULL DEFAULT '2'; ALTER TABLE Visits CHANGE PortalUserId PortalUserId INT(11) NOT NULL DEFAULT '-2'; Index: trunk/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -N -r7996 -r7997 --- trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 7996) +++ trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 7997) @@ -378,13 +378,15 @@ $config_link = $debugger->getFileLink(FULL_PATH.$this->prefixFiles[$config['Prefix']], 1, $config['Prefix']); $error_messages = Array ( - 'field_not_found' => 'Config Warning: Field %s exists in the database, but is not defined in config file for prefix %s !', - 'default_missing' => 'Config Error: Default value for field %s in config for prefix %s not set !', - 'not_null_error1' => 'Config Error: Field %s in config for prefix %s is NOT NULL in the database, but is not configured as not_null or required !', - 'not_null_error2' => 'Config Error: Field %s in config for prefix %s is described as NOT NULL, but does not have DEFAULT value !', - 'invalid_default' => 'Config Error: Default value for field %s%s (%s) in config for prefix %s differs from default value from field in database (%s) !', + 'field_not_found' => 'Field %s exists in the database, but is not defined in config', + 'default_missing' => 'Default value for field %s not set in config', + 'not_null_error1' => 'Field %s is NOT NULL in the database, but is not configured as not_null or required', + 'not_null_error2' => 'Field %s is described as NOT NULL in config, but does not have DEFAULT value', + 'invalid_default' => 'Default value for field %s%s (%s) in config differs from default value from field in database (%s)', + 'type_missing' => 'Type definition for field %s missing in config', ); - + + $config_errors = Array (); foreach ($res as $field) { $f_name = $field['Field']; if (getArrayValue($config, 'Fields')) { @@ -394,44 +396,51 @@ } if (!array_key_exists ($f_name, $config['Fields'])) { - $debugger->appendHTML(sprintf($error_messages['field_not_found'], $f_name, $config_link)); - safeDefine('DBG_RAISE_ON_WARNINGS', 1); + $config_errors[] = sprintf($error_messages['field_not_found'], $f_name); } else { $options = $config['Fields'][$f_name]; $default_missing = false; if (!array_key_exists('default', $options)) { - $debugger->appendHTML(sprintf($error_messages['default_missing'], $f_name, $config_link)); - safeDefine('DBG_RAISE_ON_WARNINGS', 1); + $config_errors[] = sprintf($error_messages['default_missing'], $f_name); $default_missing = true; } if ($field['Null'] != 'YES') { // MySQL5 for null returns "NO", but MySQL4 returns "" if ( $f_name != $config['IDField'] && !isset($options['not_null']) && !isset($options['required']) ) { - $debugger->appendHTML(sprintf($error_messages['not_null_error1'], $f_name, $config_link)); - safeDefine('DBG_RAISE_ON_WARNINGS', 1); + $config_errors[] = sprintf($error_messages['not_null_error1'], $f_name); } if ( isset($options['not_null']) && !isset($options['default']) ) { - $debugger->appendHTML(sprintf($error_messages['not_null_error2'], $f_name, $config_link)); - safeDefine('DBG_RAISE_ON_WARNINGS', 1); + $config_errors[] = sprintf($error_messages['not_null_error2'], $f_name); } } - + + if (!array_key_exists('type', $options)) { + $config_errors[] = sprintf($error_messages['type_missing'], $f_name); + } + if (!$default_missing) { if ($f_name == $config['IDField'] && $options['default'] !== 0) { - $debugger->appendHTML(sprintf($error_messages['invalid_default'], 'IDField ', $f_name, var_export($options['default'], true), $config_link, var_export($field['Default'], true))); - safeDefine('DBG_RAISE_ON_WARNINGS', 1); + $config_errors[] = sprintf($error_messages['invalid_default'], 'IDField ', $f_name, var_export($options['default'], true), var_export($field['Default'], true)); } - else if ($options['default'] != '#NOW#' && $field['Default'] !== (string)$options['default'] && !in_array($options['type'], $float_types)) { - $debugger->appendHTML(sprintf($error_messages['invalid_default'], '', $f_name, var_export($options['default'], true), $config_link, var_export($field['Default'], true))); - safeDefine('DBG_RAISE_ON_WARNINGS', 1); + else if ($options['default'] != '#NOW#' && (string)$field['Default'] !== (string)$options['default'] && !in_array($options['type'], $float_types)) { + $config_errors[] = sprintf($error_messages['invalid_default'], '', $f_name, var_export($options['default'], true), var_export($field['Default'], true)); } } } } } + if ($config_errors) { + $error_prefix = 'Config Error'.(count($config_errors) > 1 ? 's' : '').': for prefix '.$config_link.' in unit config:
'; + $config_errors = $error_prefix.'   '.implode('
   ', $config_errors); + + + + $debugger->appendHTML($config_errors); + safeDefine('DBG_RAISE_ON_WARNINGS', 1); + } } function ProcessDependencies($prefix) Index: trunk/core/units/selectors/selectors_config.php =================================================================== diff -u -N -r7867 -r7997 --- trunk/core/units/selectors/selectors_config.php (.../selectors_config.php) (revision 7867) +++ trunk/core/units/selectors/selectors_config.php (.../selectors_config.php) (revision 7997) @@ -91,7 +91,7 @@ 'StylesheetId' => Array('type' => 'int', 'unique'=>Array('SelectorName'), 'current_table_only' => 1, 'not_null' => '1','default' => '0'), 'Name' => Array('type' => 'string','not_null' => '1','default' => '','required'=>1), 'SelectorName' => Array('type' => 'string', 'unique'=>Array('StylesheetId'), 'current_table_only' => 1, 'not_null' => '1','default' => '','required'=>1), - 'SelectorData' => Array('not_null' => '1','default' => ''), + 'SelectorData' => Array('type' => 'string', 'not_null' => '1','default' => ''), 'Description' => Array('type' => 'string','not_null' => '1','default' => ''), 'Type' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'options'=>Array( 1 => 'la_BaseSelectors', 2 => 'la_BlockSelectors'), 'use_phrases' => 1, 'not_null' => '1','default' => '0'), 'AdvancedCSS' => Array('type' => 'string','not_null' => '1','default' => ''), Index: trunk/kernel/units/selectors/selectors_config.php =================================================================== diff -u -N -r7867 -r7997 --- trunk/kernel/units/selectors/selectors_config.php (.../selectors_config.php) (revision 7867) +++ trunk/kernel/units/selectors/selectors_config.php (.../selectors_config.php) (revision 7997) @@ -91,7 +91,7 @@ 'StylesheetId' => Array('type' => 'int', 'unique'=>Array('SelectorName'), 'current_table_only' => 1, 'not_null' => '1','default' => '0'), 'Name' => Array('type' => 'string','not_null' => '1','default' => '','required'=>1), 'SelectorName' => Array('type' => 'string', 'unique'=>Array('StylesheetId'), 'current_table_only' => 1, 'not_null' => '1','default' => '','required'=>1), - 'SelectorData' => Array('not_null' => '1','default' => ''), + 'SelectorData' => Array('type' => 'string', 'not_null' => '1','default' => ''), 'Description' => Array('type' => 'string','not_null' => '1','default' => ''), 'Type' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'options'=>Array( 1 => 'la_BaseSelectors', 2 => 'la_BlockSelectors'), 'use_phrases' => 1, 'not_null' => '1','default' => '0'), 'AdvancedCSS' => Array('type' => 'string','not_null' => '1','default' => ''),