Index: trunk/core/kernel/startup.php =================================================================== diff -u -N -r5248 -r6428 --- trunk/core/kernel/startup.php (.../startup.php) (revision 5248) +++ trunk/core/kernel/startup.php (.../startup.php) (revision 6428) @@ -18,7 +18,7 @@ # New path detection method: begin safeDefine('REL_PATH', '/admin'); - $ps = preg_replace("/".preg_quote(rtrim(REL_PATH, '/'), '/')."$/", '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))); + $ps = rtrim(preg_replace("/".preg_quote(rtrim(REL_PATH, '/'), '/')."$/", '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/'); safeDefine('BASE_PATH', $ps); // in case in-portal has defined it before # New path detection method: end Index: trunk/kernel/admin/include/toolbar/editgroup_users.php =================================================================== diff -u -N --- trunk/kernel/admin/include/toolbar/editgroup_users.php (revision 13) +++ trunk/kernel/admin/include/toolbar/editgroup_users.php (revision 0) @@ -1,93 +0,0 @@ -SetVariable("Page_Userlist","1"); - -/* determine current view menu settings */ -$UserView = $objConfig->Get("User_View"); -$ViewNormal = 0; - -if(!is_numeric($UserView)) -{ - $UserView = $Bit_All; //Set all bits ON - $UserFilter = ""; -} - if($UserView & $Bit_Valid) - $Status[] = 1; - - if($UserView & $Bit_Disabled) - $Status[] = 0; - - if($UserView & $Bit_Pending) - $Status[] = 2; - - - if(count($Status)>0) - { - $UserFilter = "Status IN (".implode(",",$Status).")"; - } - else - $UserFilter = "Status = -1"; - -/* Set the Items PerPage value */ -$User_Page = (int)$objConfig->Get("Perpage_User"); -if(!$User_Page) - $User_Page = 10; - -/* Set the sort values */ -$SortField = trim($objConfig->Get("User_SortField")); -$SortOrder = trim($objConfig->Get("User_SortOrder")); - -if(!strlen($SortOrder)) - $SortOrder = "asc"; - -$browseURL = $adminURL."/browse"; - -$lang_users = admin_language("la_Text_Users"); -$lang_Username = admin_language("la_prompt_Username"); -$lang_LastName = admin_language("la_prompt_LastName"); -$lang_FirstName = admin_language("la_prompt_FirstName"); -$lang_Email = admin_language("la_prompt_Email"); -$lang_PrimaryGroup = admin_language("la_prompt_PrimaryGroup"); -$lang_Valid = admin_language("la_Text_Valid"); - -print << - - - - - - - -END; -?> \ No newline at end of file Index: trunk/admin/install.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/admin/install.php (.../install.php) (revision 6093) +++ trunk/admin/install.php (.../install.php) (revision 6428) @@ -382,8 +382,14 @@ { $RootPass = $rs->fields["VariableValue"]; - if(strlen($RootPass)>0) - $LoggedIn = ($RootPass==md5($_POST["UserPass"])); + if(strlen($RootPass)>0) { + if (ConvertVersion($g_InPortal) >= ConvertVersion("1.3.0")) { + $LoggedIn = ($RootPass==md5(md5($_POST["UserPass"]).'b38')); + } + else { + $LoggedIn = ($RootPass==md5($_POST["UserPass"])); + } + } } else { $login_err_mesg = 'Invalid username or password'; @@ -1361,7 +1367,7 @@ } else { - $pass = md5($pass); + $pass = md5(md5($pass).'b38'); $sql = ' UPDATE '.$g_TablePrefix.'ConfigurationValues SET VariableValue = '.$ado->qstr($pass).' WHERE VariableName = "RootPass";'; @@ -1379,10 +1385,10 @@ if($state=="lang_install_init") { - $ado =& inst_GetADODBConnection(); + $ado =& inst_GetADODBConnection(); - if( TableExists($ado, 'Language,Phrase') ) - { + if( TableExists($ado, 'Language,Phrase') ) + { // KERNEL 4 INIT: BEGIN define('FULL_PATH', realpath(dirname(__FILE__).'/..')); define('APPLICATION_CLASS', 'MyApplication'); @@ -1392,12 +1398,18 @@ $application->Init(); // KERNEL 4 INIT: END - $lang_xml =& $application->recallObject('LangXML'); + $lang_xml =& $application->recallObject('LangXML'); - $lang_xml->renameTable('phrases', TABLE_PREFIX.'ImportPhrases'); - $lang_xml->renameTable('emailmessages', TABLE_PREFIX.'ImportEvents'); + if (defined('DBG_FAST_INSTALL') && DBG_FAST_INSTALL) { + $lang_xml->tables['phrases'] = TABLE_PREFIX.'Phrase'; + $lang_xml->tables['emailmessages'] = TABLE_PREFIX.'EmailMessage'; + } + else { + $lang_xml->renameTable('phrases', TABLE_PREFIX.'ImportPhrases'); + $lang_xml->renameTable('emailmessages', TABLE_PREFIX.'ImportEvents'); + } - $lang_xml->lang_object->TableName = $application->getUnitOption('lang','TableName'); + $lang_xml->lang_object->TableName = $application->getUnitOption('lang','TableName'); $languages = $application->GetVar('lang'); if($languages) @@ -1418,19 +1430,24 @@ } } - $state = 'lang_install'; - } - else - { - $state = 'lang_select'; - } + if (defined('DBG_FAST_INSTALL') && DBG_FAST_INSTALL) { + $state = 'lang_default'; + } + else { + $state = 'lang_install'; + } + } + else + { + $state = 'lang_select'; + } - $application->Done(); - } - else - { - $general_error = 'Database error! No language tables found!'; - } + $application->Done(); + } + else + { + $general_error = 'Database error! No language tables found!'; + } } if($state=="lang_install") @@ -1510,7 +1527,12 @@ $Id = $_POST["lang"]; $objLanguages->SetPrimary($Id); - $state="postconfig_1"; + if (defined('DBG_FAST_INSTALL')) { + $state = 'theme_sel'; + } + else { + $state="postconfig_1"; + } } if($state=="lang_default") @@ -1780,6 +1802,7 @@ $title = "Thank You!"; $help ="

Thanks for using In-Portal! Be sure to visit www.in-portal.net "; $help.=" for the latest news, module releases and support.

"; + $help.="

*Make sure to clean your browser' cache after upgrading In-portal version

"; break; case "license": $title = "License Configuration"; Index: trunk/core/units/configuration/configuration_event_handler.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 6093) +++ trunk/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 6428) @@ -49,7 +49,8 @@ $field_options['skip_empty'] = 1; $object->SetFieldOptions('VariableValue', $field_options); }else { - $object->SetDBField('VariableValue', md5($object->GetDBField('VariableValue'))); + $password_formatter =& $this->Application->recallObject('kPasswordFormatter'); + $object->SetDBField('VariableValue', $password_formatter->EncryptPassword($object->GetDBField('VariableValue'), 'b38')); } } @@ -171,7 +172,7 @@ $event->redirect_params = Array('opener' => 's', 'pass'=>'all,conf'); //stay! $event->redirect = false; }*/ - + /** * Process items from selector (selected_ids var, key - prefix, value - comma separated ids) * Index: trunk/admin/category/addcategory.php =================================================================== diff -u -N --- trunk/admin/category/addcategory.php (revision 4747) +++ trunk/admin/category/addcategory.php (revision 0) @@ -1,351 +0,0 @@ -SetVariable('IsHomeCategory', 0); - -require_once ($pathtoroot.$admin."/include/elements.php"); -require_once ($pathtoroot."kernel/admin/include/navmenu.php"); -//require_once ($pathtolocal."admin/include/navmenu.php"); -require_once($pathtoroot.$admin."/toolbar.php"); - -unset($objEditItems); - -if($_REQUEST['item']) -{ - // smulate like normal edit button pressed - $tmp_cat =& $objCatList->GetItemByField('ResourceId', $_REQUEST['item']); - $_POST['catlist'][] = $tmp_cat->UniqueId(); -} - -$objEditItems = new clsCatList(); -$objEditItems->SourceTable = $objSession->GetEditTable("Category"); -$objCustomFields = new clsCustomFieldList(1); -$application->SetVar('c_mode', 't'); -$objCustomDataList = new clsCustomDataList(); -$objRelList = new clsRelationshipList(); -$objImages = new clsImageList(); - -//Multiedit init -if ($_GET["new"] == 1) -{ - $c = new clsCategory(NULL); - $c->Set("CreatedOn", adodb_mktime()); - $c->Set("EndOn", adodb_mktime()); - $c->Set("ParentId",$objCatList->CurrentCategoryID()); - $c->Set("NewItem",2); //auto - $c->Set("Status",2); //pending - $c->Set('AutomaticFilename', 1); - $en = 0; - $action = "m_add_category"; - $objCatList->CreateEmptyEditTable("CategoryId"); - $objRelList->CreateEmptyEditTable("RelationshipId"); - $objCustomDataList->CreateEmptyEditTable('c'); - $objImages->CreateEmptyEditTable("ResourceId"); - - $TitleVerb = prompt_language("la_Text_Adding"); -} -else -{ - if(isset($_POST["catlist"])) - { - $cats = $_POST["catlist"]; - $objCatList->CopyToEditTable("CategoryId",$cats); - $objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable); - /* make a copy of the relationship records */ - $ids = $objEditItems->GetResourceIDList(); - $objRelList->CopyToEditTable("SourceId", $ids); - $objCustomDataList->CopyToEditTable('c', $ids); - $objImages->CopyToEditTable("ResourceId", $ids); - $c = $objEditItems->GetItemByIndex(0); - $itemcount=$objEditItems->NumItems(); - $en = 0; - } - else - { - if($_GET["item"]) - { - /*shortcut to edit link */ - $objCatList->CopyToEditTable("ResourceId",$_GET["item"]); - $backurl = $_GET["return"]; - } - - //Multiedit init - $en = (int)$_GET["en"]; - $objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable); - - //$ids = $objEditItems->GetResourceIDList(); - //$objRelList->CopyToEditTable("SourceId", $ids); - //$objCustomDataList->CopyToEditTable("ResourceId",$ids); - //$objImages->CopyToEditTable("ResourceId", $ids); - - $itemcount=$objEditItems->NumItems(); - $c = $objEditItems->GetItemByIndex($en); - } - - if($itemcount>1) - { - if ($en+1 == $itemcount) - $en_next = -1; - else - $en_next = $en+1; - - if ($en == 0) - $en_prev = -1; - else - $en_prev = $en-1; - } - - $action = "m_edit_category"; - $TitleVerb = prompt_language("la_Text_Editing"); -} - -$envar = "env=" . BuildEnv() . "&en=$en"; -$section = 'in-portal:editcategory_general'; - -if (strlen($c->Get("Name"))) - $editing_category_title = "'".$c->Get("Name")."' "; -else - $editing_category_title = ""; - -$title = $TitleVerb." ".prompt_language("la_Text_Category")." $editing_category_title- ".prompt_language("la_tab_General"); - -//$saveURL = $admin."/browse.php"; -$saveURL = $admin."/category/category_maint.php"; -$cancelURL = $admin."/".$objSession->GetVariable('ReturnScript'); - -//Display header -$sec = $objSections->GetSection($section); - -$objCatToolBar = new clsToolBar(); -$objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","edit_submit('category','CatEditStatus','$saveURL',1,'');","tool_select.gif"); -$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('category','CatEditStatus','$cancelURL',2,'');","tool_cancel.gif"); - -if ( isset($en_prev) || isset($en_next) ) -{ - $url = $RootUrl.$admin."/category/addcategory.php"; - $StatusField = "CatEditStatus"; - $form = "category"; - MultiEditButtons($objCatToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'','la_PrevCategory','la_NextCategory'); -} - -int_header($objCatToolBar,NULL,$title); -$c->Data=inp_htmlize($c->Data); -if ($objSession->GetVariable("HasChanges") == 1) { -?> - - - - -
- -
- - - - > - - - - Get("CategoryId") > 0 ) { ?> - > - - - - - - > - - - - - > - - - - - - > - - - - - > - - - - - - > - - - - - > - - - - - - - > - - - - - > - - - - - > - - - - - > - - - - - > - - - - - - > - - - - - > - - - - -GetFieldUIList(TRUE); -if($CustomFieldUI->NumItems()>0) -{ - $objCustomDataList->SourceTable = $objSession->GetEditTable("CustomMetaData"); - if((int)$c->Get("ResourceId")>0) - { - $objCustomDataList->LoadResource($c->Get("ResourceId")); - } - $headings = $CustomFieldUI->GetHeadingList(); - //echo "
";print_r($objCustomFields); echo "
"; - $tab_index = 14; - for($i=0;$i<=count($headings);$i++) - { - $h = $headings[$i]; - if(strlen($h)) - { - int_subsection_title(prompt_language($h)); - $Items = $CustomFieldUI->GetHeadingItems($h); - foreach($Items as $f) - { - $n = substr($f->name,1); - - $cfield = $objCustomFields->GetItemByField("FieldName",$n,FALSE); - if (is_object($cfield)) { - $f->default_value = $c->GetCustomFieldValue($n, '', 0, true); - } - print "\n"; - print " \n"; - print " "; - if(is_object($f->NextItem)) - { - $n = $f->NextItem; - print " "; - } - else - print " \n"; - print "\n"; - } - } - } -} -?> - "> - "> - - - - -
- -
- -
Get("CategoryId"); ?> - DBG: ResourceId = '.$c->Get('ResourceId'); - } - else { - echo ' '; - } - ?> -
- "> -
-
- - - -
- -
- Get('AutomaticFilename') == 1) echo ' checked'; ?> onchange="reflect_filename();"> -  
- -  
- -  
- -  
- Get("Status") == 1) echo "checked"; ?>> - Get("Status") == 2) echo "checked"; ?>> - Get("Status") == 0) echo "checked"; ?>> -  
- Get("NewItem") == 2) echo "checked"; ?>> - Get("NewItem") == 1) echo "checked"; ?>> - Get("NewItem") == 0) echo "checked"; ?>> - -  
- Get("EditorsPick") == 1) echo "checked"; ?>> -  
"> 
- "> - - - DBG: '.adodb_date('M d. Y H:i:s', $c->get('Modified') ); ?> -
- "> -  
- -  
".$f->GetPrompt()."".$f->ItemFormElement($tab_index++)."".$n->ItemFormElement($tab_index++)." 
- - - -
- -
- \ No newline at end of file Index: trunk/admin/category/addcategory_relations.php =================================================================== diff -u -N --- trunk/admin/category/addcategory_relations.php (revision 2853) +++ trunk/admin/category/addcategory_relations.php (revision 0) @@ -1,392 +0,0 @@ - $value) -{ - $path = $pathtoroot.$value."admin/include/parser.php"; - if( file_exists($path) ) include_once($path); -} - -/* ------------------------------------- Edit Table --------------------------------------------------- */ -unset($objEditItems); - -$objEditItems = new clsCatList(); -$objEditItems->SourceTable = $objSession->GetEditTable("Category"); - -//Multiedit init -$en = (int)$_GET["en"]; -$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable); -$itemcount=$objEditItems->NumItems(); - -$c = $objEditItems->GetItemByIndex($en); - -if($itemcount>1) -{ - if ($en+1 == $itemcount) - $en_next = -1; - else - $en_next = $en+1; - - if ($en == 0) - $en_prev = -1; - else - $en_prev = $en-1; -} - -$action = "m_edit_category"; - -/* -------------------------------------- Section configuration ------------------------------------------- */ -$envar = "env=" . BuildEnv() . "&en=$en"; -$section = 'in-portal:editcategory_relations'; -$title = admin_language("la_Text_Editing")." ".admin_language("la_Text_Category")." '".$c->Get("Name")."' - ".admin_language("la_tab_Relations"); - -$SortFieldVar = "Relation_LV_Sortfield"; -$SortOrderVar = "Relation_LV_Sortorder"; -$DefaultSortField = "ItemName"; -$PerPageVar = "Perpage_Relations"; -$CurrentPageVar = "Page_Relations"; -$CurrentFilterVar = "CatRel_View"; - -$ListForm = "permlistform"; -$CheckClass = "PermChecks"; - -$saveURL = $admin."/category/category_maint.php"; -$cancelURL = $admin."/".$objSession->GetVariable('ReturnScript'); -//echo $envar."
\n"; -/* ------------------------------------- Configure the toolbar ------------------------------------------- */ -$objListToolBar = new clsToolBar(); -$objListToolBar->Add("img_save", "la_Save","","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('save_edit_buttons','CatEditStatus','$saveURL',1);","tool_select.gif"); -$objListToolBar->Add("img_cancel", "la_Cancel","","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('save_edit_buttons','CatEditStatus','".$cancelURL."',2);","tool_cancel.gif"); -if($itemcount == 1) $objListToolBar->Add("divider"); -$objListToolBar->Set("section",$section); -$objListToolBar->Set("load_menu_func",""); -$objListToolBar->Set("CheckClass",$CheckClass); -$objListToolBar->Set("CheckForm",$ListForm); - -//Display header -$sec = $objSections->GetSection($section); - -if ( isset($en_prev) || isset($en_next) ) -{ - $url = $RootUrl.$admin."/category/addcategory_relations.php"; - $StatusField = "CatEditStatus"; - $form = "category"; - MultiEditButtons($objListToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'','la_PrevCategory','la_NextCategory'); - $objListToolBar->Add("divider"); -} - -$listImages = array(); - //$img, $alt, $link, $onMouseOver, $onMouseOut, $onClick - -$objListToolBar->Add("new_rel", "la_ToolTip_New_Relation","#".$envar,"swap('new_rel','toolbar/tool_new_relation_f2.gif');", - "swap('new_rel', 'toolbar/tool_new_relation.gif');", - "OpenItemSelector('$envar&source=addcategory_relations&CatId=".$c->Get("CategoryId")."&destform=popup&destfield=itemlist&Selector=radio');", - "tool_new_relation.gif",FALSE,FALSE); - -$objListToolBar->Add("rel_edit","la_ToolTip_Edit","#", "if (PermChecks.itemChecked()) swap('rel_edit','toolbar/tool_edit_f2.gif');", - "if (PermChecks.itemChecked()) swap('rel_edit', 'toolbar/tool_edit.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addrelation', '');", - "tool_edit.gif",TRUE,TRUE); -$listImages[] = "PermChecks.addImage('rel_edit','$imagesURL/toolbar/tool_edit.gif','$imagesURL/toolbar/tool_edit_f3.gif',1); "; - -$objListToolBar->Add("rel_del","la_ToolTip_Delete","#", "if (PermChecks.itemChecked()) swap('rel_del','toolbar/tool_delete_f2.gif');", - "if (PermChecks.itemChecked()) swap('rel_del', 'toolbar/tool_delete.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addcategory_relations', 'm_rel_delete');", - "tool_delete.gif",FALSE,TRUE); -$listImages[] = "PermChecks.addImage('rel_del','$imagesURL/toolbar/tool_delete.gif','$imagesURL/toolbar/tool_delete_f3.gif',1); "; - -$objListToolBar->Add("divider"); - -$objListToolBar->Add("rel_move_up","la_ToolTip_Move_Up","#", "if (PermChecks.itemChecked()) swap('rel_move_up','toolbar/tool_move_up_f2.gif');", - "if (PermChecks.itemChecked()) swap('rel_move_up', 'toolbar/tool_move_up.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addcategory_relations', 'm_rel_move_up');", - "tool_move_up.gif",FALSE,TRUE); -$listImages[] = "PermChecks.addImage('rel_move_up','$imagesURL/toolbar/tool_move_up.gif','$imagesURL/toolbar/tool_move_up_f3.gif',1); "; - -$objListToolBar->Add("rel_move_down","la_ToolTip_Move_Down","#", "if (PermChecks.itemChecked()) swap('rel_move_down','toolbar/tool_move_down_f2.gif');", - "if (PermChecks.itemChecked()) swap('rel_move_down', 'toolbar/tool_move_down.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addcategory_relations', 'm_rel_move_down');", - "tool_move_down.gif",FALSE,TRUE); -$listImages[] = "PermChecks.addImage('rel_move_down','$imagesURL/toolbar/tool_move_down.gif','$imagesURL/toolbar/tool_move_down_f3.gif',1); "; - -$objListToolBar->Add("divider"); - -$objListToolBar->Add("viewmenubutton", "la_ToolTip_View","#","swap('viewmenubutton','toolbar/tool_view_f2.gif'); ", - "swap('viewmenubutton', 'toolbar/tool_view.gif');", - "ShowViewMenu();","tool_view.gif"); - -$objListToolBar->AddToInitScript($listImages); - -/* ----------------------------------------- Set the View Filter ---------------------------------------- */ -$Rel_AllValue = 255; - -$Bit_Categories = 1; -$Bit_Links = 2; -$Bit_News = 4; -$Bit_Topics = 8; - -$Bit_OneWay = 16; -$Bit_Recip = 32; - -$Bit_Enabled=64; -$Bit_Disabled=128; - -$FilterLabels[0] = admin_language("la_Text_Category"); -$FilterLabels[1] = admin_language("la_Text_Links"); -$FilterLabels[2] = admin_language("la_Text_Articles"); -$FilterLabels[3] = admin_language("la_Text_Topics"); -$FilterLabels[4] = admin_language("la_Text_OneWay"); -$FilterLabels[5] = admin_language("la_Text_Reciprocal"); -$FilterLabels[6] = admin_language("la_Text_Enabled"); -$FilterLabels[7] = admin_language("la_Text_Disabled"); - -$RelView = $objConfig->Get($CurrentFilterVar); - -if(!is_numeric($RelView)) -{ - $RelView = $Rel_AllValue; -} -else -{ - $RelTypes = array(); - if($RelView & $Bit_Categories) - $RelTypes[] = 1; - if($RelView & $Bit_Links) - $RelTypes[] = 4; - if($RelView & $Bit_News) - $RelTypes[] = 2; - if($RelView & $Bit_Topics) - $RelTypes[] = 3; - - $RelFilters = array(); - - if(count($RelTypes)) - { - $TypeFilter = "rel.TargetType IN (".implode(",",$RelTypes).")"; - } - - $RelTypes = array(); - if($RelView & $Bit_OneWay) - $RelTypes[] = 0; - - if($RelView & $Bit_Recip) - $RelTypes[] = 1; - - if(count($RelTypes)) - $RelFilters[] = "rel.Type IN (".implode(",",$RelTypes).")"; - - if($RelView & $Bit_Enabled) - $RelFilters[] = "rel.Enabled=1"; - - if($RelView & $Bit_Disabled) - $RelFilters[] = "rel.Enabled=0"; - - if(count($RelFilters)) - { - $RelFilter = $TypeFilter." AND (". implode(" OR ",$RelFilters).")"; - } - else - $RelFilter = $TypeFilter; -} - -//$r =& $c->RelationObject(); -$objRelList = new clsRelationshipList(); -$objRelList->SourceTable = $objSession->GetEditTable("Relationship"); -$reltable = $objRelList->SourceTable; - -// ==== build sql depending on modules installed: begin ==== -$prefix = GetTablePrefix(); -$modules = $objModules->GetModuleList(); -$sql_source = $objModules->ExecuteFunction('GetModuleInfo', 'rel_list'); - -$sql_templates['ItemName'] = 'IFNULL('.$prefix."%s.%s,' ')"; -$sql_templates['TableJoin'] = 'LEFT JOIN '.$prefix."%1\$s ON ".$prefix."%1\$s.ResourceId = rel.TargetId"; -$sql_templates['TargetName'] = "IF(rel.TargetType = %s, '%s', %s)"; - -$sql = "SELECT TRIM(CONCAT(%s)) AS ItemName, %s AS ItemType,". - GetELT('rel.Type+1', Array('la_Text_OneWay','la_Text_Reciprocal')).' AS RelationType,'. - "RelationshipId, rel.Priority AS Priority, rel.Type as Type, rel.Enabled as Enabled,". - GetELT('rel.Enabled+1', Array('la_Text_Disabled','la_Text_Enabled')).' AS Status '. - 'FROM '.$reltable.' AS rel %s WHERE rel.SourceId = '.$c->Get('ResourceId'); - -$sql_parts = Array(); -$sql_parts['TargetName'] = "''"; -foreach($modules as $module) -{ - $sql_parts['ItemName'][] = sprintf($sql_templates['ItemName'], $sql_source[$module]['MainTable'], $sql_source[$module]['ItemNameField']); - $sql_parts['TableJoin'][] = sprintf($sql_templates['TableJoin'], $sql_source[$module]['MainTable']); - - $sql_parts['TargetName'] = sprintf( $sql_templates['TargetName'], - $sql_source[$module]['TargetType'], - admin_language($sql_source[$module]['ItemNamePhrase']), - $sql_parts['TargetName']); -} -$sql = sprintf($sql, implode(', ',$sql_parts['ItemName']), $sql_parts['TargetName'], implode(' ',$sql_parts['TableJoin'])); -// ==== build sql depending on modules installed: end ==== - -if(strlen($RelFilter)) -{ - $sql .= " AND (".$RelFilter.")"; -} - -$SearchWords = $objSession->GetVariable("CatRelSearchWord"); -if(strlen($SearchWords)) -{ - $having = $objRelList->AdminSearchWhereClause($SearchWords); -} -else - $having = ""; - -if(strlen($having)) - $sql .= " HAVING ($having)"; - -if(strlen(trim($objConfig->Get($SortFieldVar)))) -{ - $order = " ORDER BY rel.Priority DESC, ".$objConfig->Get($SortFieldVar)." ".$objConfig->Get($SortOrderVar); -} -else - $order = " ORDER BY rel.Priority DESC"; - -if($objConfig->Get($CurrentPageVar)>0) -{ - $objRelList->Page = $objConfig->Get($CurrentPageVar); -} -if($objConfig->Get($PerPageVar)>0) -{ - $objListView->PerPage = $objConfig->Get($PerPageVar); -} - -$sql .= $order." ".$objRelList->GetLimitSQL(); -if($objSession->HasSystemPermission("DEBUG.LIST")) - echo htmlentities($sql,ENT_NOQUOTES)."
\n"; - -$objRelList->Query_Item($sql); - -/* ---------------------------------------- Configure the list view ---------------------------------------- */ - -$objListView = new clsListView($objListToolBar,$objRelList); -$objListView->IdField = "RelationshipId"; - -$objListView->ColumnHeaders->Add("ItemName",admin_language("la_ColHeader_Item"),1,0,$order,"width=\"30%\"",$SortFieldVar,$SortOrderVar,"ItemName"); -$objListView->ColumnHeaders->Add("ItemType",admin_language("la_ColHeader_ItemType"),1,0,$order,"width=\"20%\"",$SortFieldVar,$SortOrderVar,"ItemType"); -$objListView->ColumnHeaders->Add("RelationType",admin_language("la_prompt_RelationType"),1,0,$order,"width=\"10%\"",$SortFieldVar,$SortOrderVar,"RelationType"); -$objListView->ColumnHeaders->Add("Status",admin_language("la_prompt_Status"),1,0,$order,"width=\"10%\"",$SortFieldVar,$SortOrderVar,"Status"); -$objListView->ColumnHeaders->SetSort($objConfig->Get($SortFieldVar), $objConfig->Get($SortOrderVar)); - -$objListView->PrintToolBar = FALSE; -$objListView->SearchBar = TRUE; -$objListView->SearchKeywords = $SearchWords; -$objListView->SearchAction="m_rel_search"; -$objListView->CurrentPageVar = $CurrentPageVar; -$objListView->PerPageVar = $PerPageVar; -$objListView->CheckboxName = "itemlist[]"; - -$objListView->ConfigureViewMenu($SortFieldVar,$SortOrderVar,$DefaultSortField, - $CurrentFilterVar,$RelView,$Rel_AllValue); - -foreach($FilterLabels as $Bit=>$Label) -{ - $objListView->AddViewMenuFilter($Label,$Bit); -} - -for($i=0;$iItems);$i++) -{ - $rel =& $objRelList->GetItemRefByIndex($i); - - $objListView->RowIcons[] = $rel->Admin_Icon(); -} - -$objListToolBar->AddToInitScript("fwLoadMenus();\n"); - - -$filter = false; // always initialize variables before use -if($objSession->GetVariable("CatRelSearchWord") != '') { - $filter = true; -} -else { - if ($RelView != $Rel_AllValue) { - $filter = true; - } -} - -$h = "\n\n\n"; -int_header($objListToolBar,NULL, $title,NULL,$h); -if ($objSession->GetVariable("HasChanges") == 1) { -?> - - - - -
- -
- - - - - - -
- -
- -
-PrintList(); -?> - -"> -"> -
- - -
" name="viewmenu"> - - - - -
-
- > - - - - - -
-
- - -
- - - - \ No newline at end of file Index: trunk/admin/category/js/lang.js =================================================================== diff -u -N --- trunk/admin/category/js/lang.js (revision 13) +++ trunk/admin/category/js/lang.js (revision 0) @@ -1,42 +0,0 @@ -Calendar._DN = new Array -("Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday", - "Sunday"); -Calendar._MN = new Array -("January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December"); - -// tooltips -Calendar._TT = {}; -Calendar._TT["TOGGLE"] = "Toggle first day of week"; -Calendar._TT["PREV_YEAR"] = "Prev. year (hold for menu)"; -Calendar._TT["PREV_MONTH"] = "Prev. month (hold for menu)"; -Calendar._TT["GO_TODAY"] = "Go Today"; -Calendar._TT["NEXT_MONTH"] = "Next month (hold for menu)"; -Calendar._TT["NEXT_YEAR"] = "Next year (hold for menu)"; -Calendar._TT["SEL_DATE"] = "Select date"; -Calendar._TT["DRAG_TO_MOVE"] = "Drag to move"; -Calendar._TT["PART_TODAY"] = " (today)"; -Calendar._TT["MON_FIRST"] = "Display Monday first"; -Calendar._TT["SUN_FIRST"] = "Display Sunday first"; -Calendar._TT["CLOSE"] = "Close"; -Calendar._TT["TODAY"] = "Today"; - -// date formats -Calendar._TT["DEF_DATE_FORMAT"] = "y-mm-dd"; -Calendar._TT["TT_DATE_FORMAT"] = "D, M d"; Index: trunk/admin/category/images/ddarrow.gif =================================================================== diff -u -N -r13 -r6428 Binary files differ Index: trunk/admin/category/addcategory_custom.php =================================================================== diff -u -N --- trunk/admin/category/addcategory_custom.php (revision 4077) +++ trunk/admin/category/addcategory_custom.php (revision 0) @@ -1,209 +0,0 @@ -$value) - -{ - $path = $pathtoroot. $value."admin/include/parser.php"; - if(file_exists($path)) - { - include_once($path); - } -} -unset($objEditItems); - -$application->SetVar('c_mode', 't'); -$objEditItems = new clsCatList(); -$objEditItems->SourceTable = $objSession->GetEditTable("Category"); - -//Multiedit init -$en = (int)$_GET["en"]; -$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable); -$itemcount=$objEditItems->NumItems(); - -$c = $objEditItems->GetItemByIndex($en); - -if($itemcount>1) -{ - if ($en+1 == $itemcount) - $en_next = -1; - else - $en_next = $en+1; - - if ($en == 0) - $en_prev = -1; - else - $en_prev = $en-1; -} -$action = "m_edit_category"; - -$envar = "env=" . BuildEnv() . "&en=$en"; - -$section = 'in-portal:editcategory_custom'; - -$title = admin_language("la_Text_Editing")." ".admin_language("la_Text_Category")." '".$c->Get("Name")."' - ".admin_language("la_tab_Custom"); - -$formaction = $rootURL.$admin."/category/addcategory_custom.php?".$envar; - -//echo $envar."
\n"; - -//Display header -$sec = $objSections->GetSection($section); -$objCatToolBar = new clsToolBar(); - -$ListForm = "permlistform"; -$CheckClass = "PermChecks"; -$objCatToolBar->Set("CheckClass",$CheckClass); -$objCatToolBar->Set("CheckForm",$ListForm); - -$saveURL = $admin."/category/category_maint.php"; -$cancelURL = $admin."/".$objSession->GetVariable('ReturnScript'); -$objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('category','CatEditStatus','$saveURL',1);","tool_select.gif"); -$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('category','CatEditStatus','".$cancelURL."',2);","tool_cancel.gif"); - -if ( isset($en_prev) || isset($en_next) ) -{ - $url = $RootUrl.$admin."/category/addcategory_custom.php"; - $StatusField = "CatEditStatus"; - $form = "category"; - MultiEditButtons($objCatToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'','la_PrevCategory','la_NextCategory'); -} - - int_header($objCatToolBar,NULL,$title); - -if ($objSession->GetVariable("HasChanges") == 1) { -?> - - - - -
- -
- -
-SourceTable = $objSession->GetEditTable("CustomMetaData"); - $objCustomDataList->LoadResource($c->Get("ResourceId")); - - for($i=0;$i<$objCustomFields->NumItems(); $i++) - { - $field =& $objCustomFields->GetItemRefByIndex($i); - $fieldid = $field->Get("CustomFieldId"); - - $CF=$field->GetAdminUI(); - if(is_object($cfield = $objCustomFields->GetItemByField("FieldName",substr($CF->name,1),FALSE))) { - $CF->default_value = $c->GetCustomFieldValue(substr($CF->name,1), '', 0, true); - } - - $f = $objCustomDataList->GetDataItem($fieldid); - $fieldname = "CustomData[$fieldid]"; - - if(is_object($f)) - { -// $val_field = "Get("Value"))."\" name=\"$fieldname\">"; - $field->Set("Value", $CF->ItemFormElement()); - if ($field->Get('Prompt') != '') { - $field->Set("FieldLabel", admin_language($field->Get('Prompt'))); - } - else { - $field->Set("FieldLabel", admin_language('lu_fieldcustom__'.strtolower($field->Get('FieldName')))); - } - $field->Set("DataId",$f->Get("CustomDataId")); - } - else - { - $val_field = ""; - $field->Set("Value", $CF->ItemFormElement()); - if ($field->Get('Prompt') != '') { - $field->Set("FieldLabel", admin_language($field->Get('Prompt'))); - } - else { - $field->Set("FieldLabel", admin_language('lu_fieldcustom__'.strtolower($field->Get('FieldName')))); - } - $field->Set("DataId",0); - } - } - $objCustomFields->SortField = $objConfig->Get("CustomData_LV_Sortfield");; - $objCustomFields->SortItems($objConfig->Get("CustomData_LV_Sortorder")!="desc"); - - $objListView = new clsListView($objCatToolBar,$objCustomFields); - $objListView->IdField = "DataId"; - - $order = $objConfig->Get("CustomData_LV_Sortfield"); - $SortOrder=0; - if($objConfig->Get("CustomData_LV_Sortorder")=="asc") - $SortOrder=1; - - $objListView->ColumnHeaders->Add("FieldName",admin_language("la_ColHeader_FieldName"),1,0,$order,"width=\"30%\"","CustomData_LV_Sortfield","CustomData_LV_Sortorder","FieldName"); - $objListView->ColumnHeaders->Add("FieldLabel",admin_language("la_ColHeader_FieldLabel"),1,0,$order,"width=\"30%\"","CustomData_LV_Sortfield","CustomData_LV_Sortorder","FieldLabel"); - $objListView->ColumnHeaders->Add("Value",admin_language("la_ColHeader_Value"),1,0,$order,"width=\"40%\"","CustomData_LV_Sortfield","CustomData_LV_Sortorder","Value"); - - $objListView->ColumnHeaders->SetSort($objConfig->Get("CustomData_LV_Sortfield"), $objConfig->Get("CustomData_LV_Sortorder")); - - $objListView->PrintToolBar = FALSE; - $objListView->checkboxes = FALSE; - - $objListView->CurrentPageVar = "Page_CustomData"; - $objListView->PerPageVar = "Perpage_CustomData"; - //$objListView->CheckboxName = "itemlist[]"; - - for($i=0;$iItems);$i++) - { - $objListView->RowIcons[] = $imagesURL."/itemicons/icon16_custom.gif"; - } - $objListView->PageLinks = $objListView->PrintPageLinks(); - - $objListView->SliceItems(); - print $objListView->PrintList(); -?> - "> - - - - - - -
- - -
- -
" name="viewmenu"> - - - - -
- - Index: trunk/admin/category/js/core.js =================================================================== diff -u -N --- trunk/admin/category/js/core.js (revision 13) +++ trunk/admin/category/js/core.js (revision 0) @@ -1,1097 +0,0 @@ -/* Copyright Mihai Bazon, 2002 - * http://students.infoiasi.ro/~mishoo - * - * Version: 0.9.1 - * - * Feel free to use this script under the terms of the GNU General Public - * License, as long as you do not remove or alter this notice. - */ - -/** The Calendar object constructor. */ -Calendar = function (mondayFirst, dateStr, onSelected, onClose) { - // member variables - this.activeDiv = null; - this.currentDateEl = null; - this.checkDisabled = null; - this.timeout = null; - this.onSelected = onSelected || null; - this.onClose = onClose || null; - this.dragging = false; - this.minYear = 1970; - this.maxYear = 2050; - this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"]; - this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"]; - this.isPopup = true; - this.mondayFirst = mondayFirst; - this.dateStr = dateStr; - // HTML elements - this.table = null; - this.element = null; - this.tbody = null; - this.daynames = null; - // Combo boxes - this.monthsCombo = null; - this.yearsCombo = null; - this.hilitedMonth = null; - this.activeMonth = null; - this.hilitedYear = null; - this.activeYear = null; - - // one-time initializations - if (!Calendar._DN3) { - // table of short day names - var ar = new Array(); - for (var i = 8; i > 0;) { - ar[--i] = Calendar._DN[i].substr(0, 3); - } - Calendar._DN3 = ar; - // table of short month names - ar = new Array(); - for (var i = 12; i > 0;) { - ar[--i] = Calendar._MN[i].substr(0, 3); - } - Calendar._MN3 = ar; - } -}; - -// ** constants - -/// "static", needed for event handlers. -Calendar._C = null; - -/// detect a special case of "web browser" -Calendar.is_ie = ( (navigator.userAgent.toLowerCase().indexOf("msie") != -1) && - (navigator.userAgent.toLowerCase().indexOf("opera") == -1) ); - -// short day names array (initialized at first constructor call) -Calendar._DN3 = null; - -// short month names array (initialized at first constructor call) -Calendar._MN3 = null; - -// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate -// library, at some point. - -Calendar.getAbsolutePos = function(el) { - var r = { x: el.offsetLeft, y: el.offsetTop }; - if (el.offsetParent) { - var tmp = Calendar.getAbsolutePos(el.offsetParent); - r.x += tmp.x; - r.y += tmp.y; - } - return r; -}; - -Calendar.isRelated = function (el, evt) { - var related = evt.relatedTarget; - if (!related) { - var type = evt.type; - if (type == "mouseover") { - related = evt.fromElement; - } else if (type == "mouseout") { - related = evt.toElement; - } - } - while (related) { - if (related == el) { - return true; - } - related = related.parentNode; - } - return false; -}; - -Calendar.removeClass = function(el, className) { - if (!(el && el.className)) { - return; - } - var cls = el.className.split(" "); - var ar = new Array(); - for (var i = cls.length; i > 0;) { - if (cls[--i] != className) { - ar[ar.length] = cls[i]; - } - } - el.className = ar.join(" "); -}; - -Calendar.addClass = function(el, className) { - el.className += " " + className; -}; - -Calendar.getElement = function(ev) { - if (Calendar.is_ie) { - return window.event.srcElement; - } else { - return ev.currentTarget; - } -}; - -Calendar.getTargetElement = function(ev) { - if (Calendar.is_ie) { - return window.event.srcElement; - } else { - return ev.target; - } -}; - -Calendar.stopEvent = function(ev) { - if (Calendar.is_ie) { - window.event.cancelBubble = true; - window.event.returnValue = false; - } else { - ev.preventDefault(); - ev.stopPropagation(); - } -}; - -Calendar.addEvent = function(el, evname, func) { - if (Calendar.is_ie) { - el.attachEvent("on" + evname, func); - } else { - el.addEventListener(evname, func, true); - } -}; - -Calendar.removeEvent = function(el, evname, func) { - if (Calendar.is_ie) { - el.detachEvent("on" + evname, func); - } else { - el.removeEventListener(evname, func, true); - } -}; - -Calendar.createElement = function(type, parent) { - var el = null; - if (document.createElementNS) { - // use the XHTML namespace; IE won't normally get here unless - // _they_ "fix" the DOM2 implementation. - el = document.createElementNS("http://www.w3.org/1999/xhtml", type); - } else { - el = document.createElement(type); - } - if (typeof parent != "undefined") { - parent.appendChild(el); - } - return el; -}; - -// END: UTILITY FUNCTIONS - -// BEGIN: CALENDAR STATIC FUNCTIONS - -/** Internal -- adds a set of events to make some element behave like a button. */ -Calendar._add_evs = function(el) { - with (Calendar) { - addEvent(el, "mouseover", dayMouseOver); - addEvent(el, "mousedown", dayMouseDown); - addEvent(el, "mouseout", dayMouseOut); - if (is_ie) { - addEvent(el, "dblclick", dayMouseDblClick); - el.setAttribute("unselectable", true); - } - } -}; - -Calendar.findMonth = function(el) { - if (typeof el.month != "undefined") { - return el; - } else if (typeof el.parentNode.month != "undefined") { - return el.parentNode; - } - return null; -}; - -Calendar.findYear = function(el) { - if (typeof el.year != "undefined") { - return el; - } else if (typeof el.parentNode.year != "undefined") { - return el.parentNode; - } - return null; -}; - -Calendar.showMonthsCombo = function () { - var cal = Calendar._C; - if (!cal) { - return false; - } - var cal = cal; - var cd = cal.activeDiv; - var mc = cal.monthsCombo; - if (cal.hilitedMonth) { - Calendar.removeClass(cal.hilitedMonth, "hilite"); - } - if (cal.activeMonth) { - Calendar.removeClass(cal.activeMonth, "active"); - } - var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()]; - Calendar.addClass(mon, "active"); - cal.activeMonth = mon; - mc.style.left = cd.offsetLeft; - mc.style.top = cd.offsetTop + cd.offsetHeight; - mc.style.display = "block"; -}; - -Calendar.showYearsCombo = function (fwd) { - var cal = Calendar._C; - if (!cal) { - return false; - } - var cal = cal; - var cd = cal.activeDiv; - var yc = cal.yearsCombo; - if (cal.hilitedYear) { - Calendar.removeClass(cal.hilitedYear, "hilite"); - } - if (cal.activeYear) { - Calendar.removeClass(cal.activeYear, "active"); - } - cal.activeYear = null; - var Y = cal.date.getFullYear() + (fwd ? 1 : -1); - var yr = yc.firstChild; - var show = false; - for (var i = 12; i > 0; --i) { - if (Y >= cal.minYear && Y <= cal.maxYear) { - yr.firstChild.data = Y; - yr.year = Y; - yr.style.display = "block"; - show = true; - } else { - yr.style.display = "none"; - } - yr = yr.nextSibling; - Y += fwd ? 2 : -2; - } - if (show) { - yc.style.left = cd.offsetLeft; - yc.style.top = cd.offsetTop + cd.offsetHeight; - yc.style.display = "block"; - } -}; - -// event handlers - -Calendar.tableMouseUp = function(ev) { - var cal = Calendar._C; - if (!cal) { - return false; - } - if (cal.timeout) { - clearTimeout(cal.timeout); - } - var el = cal.activeDiv; - if (!el) { - return false; - } - var target = Calendar.getTargetElement(ev); - Calendar.removeClass(el, "active"); - if (target == el || target.parentNode == el) { - Calendar.cellClick(el); - } - var mon = Calendar.findMonth(target); - var date = null; - if (mon) { - date = new Date(cal.date); - if (mon.month != date.getMonth()) { - date.setMonth(mon.month); - cal.setDate(date); - } - } else { - var year = Calendar.findYear(target); - if (year) { - date = new Date(cal.date); - if (year.year != date.getFullYear()) { - date.setFullYear(year.year); - cal.setDate(date); - } - } - } - with (Calendar) { - removeEvent(document, "mouseup", tableMouseUp); - removeEvent(document, "mouseover", tableMouseOver); - removeEvent(document, "mousemove", tableMouseOver); - cal._hideCombos(); - stopEvent(ev); - _C = null; - } -}; - -Calendar.tableMouseOver = function (ev) { - var cal = Calendar._C; - if (!cal) { - return; - } - var el = cal.activeDiv; - var target = Calendar.getTargetElement(ev); - if (target == el || target.parentNode == el) { - Calendar.addClass(el, "hilite active"); - } else { - Calendar.removeClass(el, "active"); - Calendar.removeClass(el, "hilite"); - } - var mon = Calendar.findMonth(target); - if (mon) { - if (mon.month != cal.date.getMonth()) { - if (cal.hilitedMonth) { - Calendar.removeClass(cal.hilitedMonth, "hilite"); - } - Calendar.addClass(mon, "hilite"); - cal.hilitedMonth = mon; - } else if (cal.hilitedMonth) { - Calendar.removeClass(cal.hilitedMonth, "hilite"); - } - } else { - var year = Calendar.findYear(target); - if (year) { - if (year.year != cal.date.getFullYear()) { - if (cal.hilitedYear) { - Calendar.removeClass(cal.hilitedYear, "hilite"); - } - Calendar.addClass(year, "hilite"); - cal.hilitedYear = year; - } else if (cal.hilitedYear) { - Calendar.removeClass(cal.hilitedYear, "hilite"); - } - } - } - Calendar.stopEvent(ev); -}; - -Calendar.tableMouseDown = function (ev) { - if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) { - Calendar.stopEvent(ev); - } -}; - -Calendar.calDragIt = function (ev) { - var cal = Calendar._C; - if (!(cal && cal.dragging)) { - return false; - } - var posX; - var posY; - if (Calendar.is_ie) { - posY = window.event.clientY + document.body.scrollTop; - posX = window.event.clientX + document.body.scrollLeft; - } else { - posX = ev.pageX; - posY = ev.pageY; - } - cal.hideShowCovered(); - var st = cal.element.style; - st.left = (posX - cal.xOffs) + "px"; - st.top = (posY - cal.yOffs) + "px"; - Calendar.stopEvent(ev); -}; - -Calendar.calDragEnd = function (ev) { - var cal = Calendar._C; - if (!cal) { - return false; - } - cal.dragging = false; - with (Calendar) { - removeEvent(document, "mousemove", calDragIt); - removeEvent(document, "mouseover", stopEvent); - removeEvent(document, "mouseup", calDragEnd); - tableMouseUp(ev); - } - cal.hideShowCovered(); -}; - -Calendar.dayMouseDown = function(ev) { - var el = Calendar.getElement(ev); - if (el.disabled) { - return false; - } - var cal = el.calendar; - cal.activeDiv = el; - Calendar._C = cal; - if (el.navtype != 300) with (Calendar) { - addClass(el, "hilite active"); - addEvent(document, "mouseover", tableMouseOver); - addEvent(document, "mousemove", tableMouseOver); - addEvent(document, "mouseup", tableMouseUp); - } else if (cal.isPopup) { - cal._dragStart(ev); - } - Calendar.stopEvent(ev); - if (el.navtype == -1 || el.navtype == 1) { - cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250); - } else if (el.navtype == -2 || el.navtype == 2) { - cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250); - } else { - cal.timeout = null; - } -}; - -Calendar.dayMouseDblClick = function(ev) { - Calendar.cellClick(Calendar.getElement(ev)); - if (Calendar.is_ie) { - document.selection.empty(); - } -}; - -Calendar.dayMouseOver = function(ev) { - var el = Calendar.getElement(ev); - if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) { - return false; - } - if (el.ttip) { - if (el.ttip.substr(0, 1) == "_") { - var date = null; - with (el.calendar.date) { - date = new Date(getFullYear(), getMonth(), el.caldate); - } - el.ttip = date.print(el.calendar.ttDateFormat) + el.ttip.substr(1); - } - el.calendar.tooltips.firstChild.data = el.ttip; - } - if (el.navtype != 300) { - Calendar.addClass(el, "hilite"); - } - Calendar.stopEvent(ev); -}; - -Calendar.dayMouseOut = function(ev) { - with (Calendar) { - var el = getElement(ev); - if (isRelated(el, ev) || _C || el.disabled) { - return false; - } - removeClass(el, "hilite"); - el.calendar.tooltips.firstChild.data = _TT["SEL_DATE"]; - stopEvent(ev); - } -}; - -/** - * A generic "click" handler :) handles all types of buttons defined in this - * calendar. - */ -Calendar.cellClick = function(el) { - var cal = el.calendar; - var closing = false; - var newdate = false; - var date = null; - if (typeof el.navtype == "undefined") { - Calendar.removeClass(cal.currentDateEl, "selected"); - Calendar.addClass(el, "selected"); - closing = (cal.currentDateEl == el); - if (!closing) { - cal.currentDateEl = el; - } - cal.date.setDate(el.caldate); - date = cal.date; - newdate = true; - } else { - if (el.navtype == 200) { - Calendar.removeClass(el, "hilite"); - cal.callCloseHandler(); - return; - } - date = (el.navtype == 0) ? new Date() : new Date(cal.date); - var year = date.getFullYear(); - var mon = date.getMonth(); - var setMonth = function (mon) { - var day = date.getDate(); - var max = date.getMonthDays(); - if (day > max) { - date.setDate(max); - } - date.setMonth(mon); - }; - switch (el.navtype) { - case -2: - if (year > cal.minYear) { - date.setFullYear(year - 1); - } - break; - case -1: - if (mon > 0) { - setMonth(mon - 1); - } else if (year-- > cal.minYear) { - date.setFullYear(year); - setMonth(11); - } - break; - case 1: - if (mon < 11) { - setMonth(mon + 1); - } else if (year < cal.maxYear) { - date.setFullYear(year + 1); - setMonth(0); - } - break; - case 2: - if (year < cal.maxYear) { - date.setFullYear(year + 1); - } - break; - case 100: - cal.setMondayFirst(!cal.mondayFirst); - return; - } - if (!date.equalsTo(cal.date)) { - cal.setDate(date); - newdate = el.navtype == 0; - } - } - if (newdate) { - cal.callHandler(); - } - if (closing) { - Calendar.removeClass(el, "hilite"); - cal.callCloseHandler(); - } -}; - -// END: CALENDAR STATIC FUNCTIONS - -// BEGIN: CALENDAR OBJECT FUNCTIONS - -/** - * This function creates the calendar inside the given parent. If _par is - * null than it creates a popup calendar inside the BODY element. If _par is - * an element, be it BODY, then it creates a non-popup calendar (still - * hidden). Some properties need to be set before calling this function. - */ -Calendar.prototype.create = function (_par) { - var parent = null; - if (! _par) { - // default parent is the document body, in which case we create - // a popup calendar. - parent = document.getElementsByTagName("body")[0]; - this.isPopup = true; - } else { - parent = _par; - this.isPopup = false; - } - this.date = this.dateStr ? new Date(this.dateStr) : new Date(); - - var table = Calendar.createElement("table"); - this.table = table; - table.cellSpacing = 0; - table.cellPadding = 0; - table.calendar = this; - Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown); - - var div = Calendar.createElement("div"); - this.element = div; - div.className = "calendar"; - if (this.isPopup) { - div.style.position = "absolute"; - div.style.display = "none"; - } - div.appendChild(table); - - var thead = Calendar.createElement("thead", table); - var cell = null; - var row = null; - - var cal = this; - var hh = function (text, cs, navtype) { - cell = Calendar.createElement("td", row); - cell.colSpan = cs; - cell.className = "button"; - Calendar._add_evs(cell); - cell.calendar = cal; - cell.navtype = navtype; - if (text.substr(0, 1) != "&") { - cell.appendChild(document.createTextNode(text)); - } - else { - // FIXME: dirty hack for entities - cell.innerHTML = text; - } - return cell; - }; - - row = Calendar.createElement("tr", thead); - row.className = "headrow"; - - hh("-", 1, 100).ttip = Calendar._TT["TOGGLE"]; - this.title = hh("", this.isPopup ? 5 : 6, 300); - this.title.className = "title"; - if (this.isPopup) { - this.title.ttip = Calendar._TT["DRAG_TO_MOVE"]; - this.title.style.cursor = "move"; - hh("X", 1, 200).ttip = Calendar._TT["CLOSE"]; - } - - row = Calendar.createElement("tr", thead); - row.className = "headrow"; - - hh("«", 1, -2).ttip = Calendar._TT["PREV_YEAR"]; - hh("‹", 1, -1).ttip = Calendar._TT["PREV_MONTH"]; - hh(Calendar._TT["TODAY"], 3, 0).ttip = Calendar._TT["GO_TODAY"]; - hh("›", 1, 1).ttip = Calendar._TT["NEXT_MONTH"]; - hh("»", 1, 2).ttip = Calendar._TT["NEXT_YEAR"]; - - // day names - row = Calendar.createElement("tr", thead); - row.className = "daynames"; - this.daynames = row; - for (var i = 7; i > 0; --i) { - cell = Calendar.createElement("td", row); - cell.appendChild(document.createTextNode("")); - if (!i) { - cell.navtype = 100; - cell.calendar = this; - Calendar._add_evs(cell); - } - } - this._displayWeekdays(); - - var tbody = Calendar.createElement("tbody", table); - this.tbody = tbody; - - for (i = 6; i > 0; --i) { - row = Calendar.createElement("tr", tbody); - for (var j = 7; j > 0; --j) { - cell = Calendar.createElement("td", row); - cell.appendChild(document.createTextNode("")); - cell.calendar = this; - Calendar._add_evs(cell); - } - } - - var tfoot = Calendar.createElement("tfoot", table); - - row = Calendar.createElement("tr", tfoot); - row.className = "footrow"; - - cell = hh(Calendar._TT["SEL_DATE"], 7, 300); - cell.className = "ttip"; - if (this.isPopup) { - cell.ttip = Calendar._TT["DRAG_TO_MOVE"]; - cell.style.cursor = "move"; - } - this.tooltips = cell; - - div = Calendar.createElement("div", this.element); - this.monthsCombo = div; - div.className = "combo"; - for (i = 0; i < Calendar._MN.length; ++i) { - var mn = Calendar.createElement("div"); - mn.className = "label"; - mn.month = i; - mn.appendChild(document.createTextNode(Calendar._MN3[i])); - div.appendChild(mn); - } - - div = Calendar.createElement("div", this.element); - this.yearsCombo = div; - div.className = "combo"; - for (i = 12; i > 0; --i) { - var yr = Calendar.createElement("div"); - yr.className = "label"; - yr.appendChild(document.createTextNode("")); - div.appendChild(yr); - } - - this._init(this.mondayFirst, this.date); - parent.appendChild(this.element); -}; - -/** - * (RE)Initializes the calendar to the given date and style (if mondayFirst is - * true it makes Monday the first day of week, otherwise the weeks start on - * Sunday. - */ -Calendar.prototype._init = function (mondayFirst, date) { - var today = new Date(); - var year = date.getFullYear(); - if (year < this.minYear) { - year = this.minYear; - date.setFullYear(year); - } else if (year > this.maxYear) { - year = this.maxYear; - date.setFullYear(year); - } - this.mondayFirst = mondayFirst; - this.date = new Date(date); - var month = date.getMonth(); - var mday = date.getDate(); - var no_days = date.getMonthDays(); - date.setDate(1); - var wday = date.getDay(); - var MON = mondayFirst ? 1 : 0; - var SAT = mondayFirst ? 5 : 6; - var SUN = mondayFirst ? 6 : 0; - if (mondayFirst) { - wday = (wday > 0) ? (wday - 1) : 6; - } - var iday = 1; - var row = this.tbody.firstChild; - var MN = Calendar._MN3[month]; - var hasToday = ((today.getFullYear() == year) && (today.getMonth() == month)); - var todayDate = today.getDate(); - for (var i = 0; i < 6; ++i) { - if (iday > no_days) { - row.className = "emptyrow"; - row = row.nextSibling; - continue; - } - var cell = row.firstChild; - row.className = "daysrow"; - for (var j = 0; j < 7; ++j) { - if ((!i && j < wday) || iday > no_days) { - cell.className = "emptycell"; - cell = cell.nextSibling; - continue; - } - cell.firstChild.data = iday; - cell.className = "day"; - cell.disabled = false; - if (typeof this.checkDisabled == "function") { - date.setDate(iday); - if (this.checkDisabled(date)) { - cell.className += " disabled"; - cell.disabled = true; - } - } - if (!cell.disabled) { - cell.caldate = iday; - cell.ttip = "_"; - if (iday == mday) { - cell.className += " selected"; - this.currentDateEl = cell; - } - if (hasToday && (iday == todayDate)) { - cell.className += " today"; - cell.ttip += Calendar._TT["PART_TODAY"]; - } - if (wday == SAT || wday == SUN) { - cell.className += " weekend"; - } - } - ++iday; - ((++wday) ^ 7) || (wday = 0); - cell = cell.nextSibling; - } - row = row.nextSibling; - } - this.title.firstChild.data = Calendar._MN[month] + ", " + year; - // PROFILE - // this.tooltips.firstChild.data = "Generated in " + ((new Date()) - today) + " ms"; -}; - -/** - * Calls _init function above for going to a certain date (but only if the - * date is different than the currently selected one). - */ -Calendar.prototype.setDate = function (date) { - if (!date.equalsTo(this.date)) { - this._init(this.mondayFirst, date); - } -}; - -/** Modifies the "mondayFirst" parameter (EU/US style). */ -Calendar.prototype.setMondayFirst = function (mondayFirst) { - this._init(mondayFirst, this.date); - this._displayWeekdays(); -}; - -/** - * Allows customization of what dates are enabled. The "unaryFunction" - * parameter must be a function object that receives the date (as a JS Date - * object) and returns a boolean value. If the returned value is true then - * the passed date will be marked as disabled. - */ -Calendar.prototype.setDisabledHandler = function (unaryFunction) { - this.checkDisabled = unaryFunction; -}; - -/** Customization of allowed year range for the calendar. */ -Calendar.prototype.setRange = function (a, z) { - this.minYear = a; - this.maxYear = z; -}; - -/** Calls the first user handler (selectedHandler). */ -Calendar.prototype.callHandler = function () { - if (this.onSelected) { - this.onSelected(this, this.date.print(this.dateFormat)); - } -}; - -/** Calls the second user handler (closeHandler). */ -Calendar.prototype.callCloseHandler = function () { - if (this.onClose) { - this.onClose(this); - } - this.hideShowCovered(); -}; - -/** Removes the calendar object from the DOM tree and destroys it. */ -Calendar.prototype.destroy = function () { - var el = this.element.parentNode; - el.removeChild(this.element); - Calendar._C = null; - delete el; -}; - -/** - * Moves the calendar element to a different section in the DOM tree (changes - * its parent). - */ -Calendar.prototype.reparent = function (new_parent) { - var el = this.element; - el.parentNode.removeChild(el); - new_parent.appendChild(el); -}; - -/** Shows the calendar. */ -Calendar.prototype.show = function () { - this.element.style.display = "block"; - this.hideShowCovered(); -}; - -/** - * Hides the calendar. Also removes any "hilite" from the class of any TD - * element. - */ -Calendar.prototype.hide = function () { - var trs = this.table.getElementsByTagName("td"); - for (var i = trs.length; i > 0; ) { - Calendar.removeClass(trs[--i], "hilite"); - } - this.element.style.display = "none"; -}; - -/** - * Shows the calendar at a given absolute position (beware that, depending on - * the calendar element style -- position property -- this might be relative - * to the parent's containing rectangle). - */ -Calendar.prototype.showAt = function (x, y) { - var s = this.element.style; - s.left = x + "px"; - s.top = y + "px"; - this.show(); -}; - -/** Shows the calendar near a given element. */ -Calendar.prototype.showAtElement = function (el) { - var p = Calendar.getAbsolutePos(el); - this.showAt(p.x, p.y + el.offsetHeight); -}; - -/** Customizes the date format. */ -Calendar.prototype.setDateFormat = function (str) { - this.dateFormat = str; -}; - -/** Customizes the tooltip date format. */ -Calendar.prototype.setTtDateFormat = function (str) { - this.ttDateFormat = str; -}; - -/** - * Tries to identify the date represented in a string. If successful it also - * calls this.setDate which moves the calendar to the given date. - */ -Calendar.prototype.parseDate = function (str, fmt) { - var y = 0; - var m = -1; - var d = 0; - var a = str.split(/\W+/); - if (!fmt) { - fmt = this.dateFormat; - } - var b = fmt.split(/\W+/); - var i = 0, j = 0; - for (i = 0; i < a.length; ++i) { - if (b[i] == "D" || b[i] == "DD") { - continue; - } - if (b[i] == "d" || b[i] == "dd") { - d = a[i]; - } - if (b[i] == "m" || b[i] == "mm") { - m = a[i]-1; - } - if (b[i] == "y") { - y = a[i]; - } - if (b[i] == "yy") { - y = parseInt(a[i]) + 1900; - } - if (b[i] == "M" || b[i] == "MM") { - for (j = 0; j < 12; ++j) { - if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } - } - } - } - if (y != 0 && m != -1 && d != 0) { - this.setDate(new Date(y, m, d)); - return; - } - y = 0; m = -1; d = 0; - for (i = 0; i < a.length; ++i) { - if (a[i].search(/[a-zA-Z]+/) != -1) { - var t = -1; - for (j = 0; j < 12; ++j) { - if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; } - } - if (t != -1) { - if (m != -1) { - d = m+1; - } - m = t; - } - } else if (parseInt(a[i]) <= 12 && m == -1) { - m = a[i]-1; - } else if (parseInt(a[i]) > 31 && y == 0) { - y = a[i]; - } else if (d == 0) { - d = a[i]; - } - } - if (y == 0) { - var today = new Date(); - y = today.getFullYear(); - } - if (m != -1 && d != 0) { - this.setDate(new Date(y, m, d)); - } -}; - -Calendar.prototype.hideShowCovered = function () { - var tags = new Array("applet", "iframe", "select"); - var el = this.element; - - var p = Calendar.getAbsolutePos(el); - var EX1 = p.x; - var EX2 = el.offsetWidth + EX1; - var EY1 = p.y; - var EY2 = el.offsetHeight + EY1; - - for (var k = tags.length; k > 0; ) { - var ar = document.getElementsByTagName(tags[--k]); - var cc = null; - - for (var i = ar.length; i > 0;) { - cc = ar[--i]; - - p = Calendar.getAbsolutePos(cc); - var CX1 = p.x; - var CX2 = cc.offsetWidth + CX1; - var CY1 = p.y; - var CY2 = cc.offsetHeight + CY1; - - if ((CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) { - cc.style.visibility = "visible"; - } else { - cc.style.visibility = "hidden"; - } - } - } -}; - -/** Internal function; it displays the bar with the names of the weekday. */ -Calendar.prototype._displayWeekdays = function () { - var MON = this.mondayFirst ? 0 : 1; - var SUN = this.mondayFirst ? 6 : 0; - var SAT = this.mondayFirst ? 5 : 6; - var cell = this.daynames.firstChild; - for (var i = 0; i < 7; ++i) { - cell.className = "day name"; - if (!i) { - cell.ttip = this.mondayFirst ? Calendar._TT["SUN_FIRST"] : Calendar._TT["MON_FIRST"]; - cell.navtype = 100; - cell.calendar = this; - Calendar._add_evs(cell); - } - if (i == SUN || i == SAT) { - Calendar.addClass(cell, "weekend"); - } - cell.firstChild.data = Calendar._DN3[i + 1 - MON]; - cell = cell.nextSibling; - } -}; - -/** Internal function. Hides all combo boxes that might be displayed. */ -Calendar.prototype._hideCombos = function () { - this.monthsCombo.style.display = "none"; - this.yearsCombo.style.display = "none"; -}; - -/** Internal function. Starts dragging the element. */ -Calendar.prototype._dragStart = function (ev) { - if (this.dragging) { - return; - } - this.dragging = true; - var posX; - var posY; - if (Calendar.is_ie) { - posY = window.event.clientY + document.body.scrollTop; - posX = window.event.clientX + document.body.scrollLeft; - } else { - posY = ev.clientY + window.scrollY; - posX = ev.clientX + window.scrollX; - } - var st = this.element.style; - this.xOffs = posX - parseInt(st.left); - this.yOffs = posY - parseInt(st.top); - with (Calendar) { - addEvent(document, "mousemove", calDragIt); - addEvent(document, "mouseover", stopEvent); - addEvent(document, "mouseup", calDragEnd); - } -}; - -// BEGIN: DATE OBJECT PATCHES - -/** Adds the number of days array to the Date object. */ -Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); - -/** Returns the number of days in the current month */ -Date.prototype.getMonthDays = function() { - var year = this.getFullYear(); - var month = this.getMonth(); - if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { - return 29; - } else { - return Date._MD[month]; - } -}; - -/** Checks dates equality (ignores time) */ -Date.prototype.equalsTo = function(date) { - return ((this.getFullYear() == date.getFullYear()) && - (this.getMonth() == date.getMonth()) && - (this.getDate() == date.getDate())); -}; - -/** Prints the date in a string according to the given format. */ -Date.prototype.print = function (frm) { - var str = new String(frm); - var m = this.getMonth(); - var d = this.getDate(); - var y = this.getFullYear(); - var w = this.getDay(); - var s = new Array(); - s["d"] = d; - s["dd"] = (d < 10) ? ("0" + d) : d; - s["m"] = 1+m; - s["mm"] = (m < 9) ? ("0" + (1+m)) : (1+m); - s["y"] = y; - s["yy"] = new String(y).substr(2, 2); - with (Calendar) { - s["D"] = _DN3[w]; - s["DD"] = _DN[w]; - s["M"] = _MN3[m]; - s["MM"] = _MN[m]; - } - var re = /(.*)(\W|^)(d|dd|m|mm|y|yy|MM|M|DD|D)(\W|$)(.*)/; - while (re.exec(str) != null) { - str = RegExp.$1 + RegExp.$2 + s[RegExp.$3] + RegExp.$4 + RegExp.$5; - } - return str; -}; - -// END: DATE OBJECT PATCHES Index: trunk/admin/category/addcategory_customfields.php =================================================================== diff -u -N --- trunk/admin/category/addcategory_customfields.php (revision 2853) +++ trunk/admin/category/addcategory_customfields.php (revision 0) @@ -1,161 +0,0 @@ -$value) -{ - $path = $pathtoroot. $value."admin/include/parser.php"; - if(file_exists($path)) - { - include_once($path); - } -} -unset($objEditItems); - -$objEditItems = new clsCatList(); -$objEditItems->SourceTable = $objSession->GetEditTable("Category"); -$objCustomFields = new clsCustomFieldList(TYPE_CATEGORY,$objSession->GetEditTable("CustomField")); - -//Multiedit init -$en = (int)$_GET["en"]; -$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable); -$itemcount=$objEditItems->NumItems(); -echo $itemcount . " items loaded..
\n"; -$c = $objEditItems->GetItemByIndex($en); - -if($itemcount>1) -{ - if ($en+1 == $itemcount) - $en_next = -1; - else - $en_next = $en+1; - - if ($en == 0) - $en_prev = -1; - else - $en_prev = $en-1; -} -$action = "m_edit_category"; - -$envar = "env=" . BuildEnv() . "&en=$en"; - -$section = 'in-portal:editcategory_custom'; - -$formaction = $adminURL."/category/addcategory_custom.php?".$envar; - -//echo $envar."
\n"; - -//Display header -$sec = $objSections->GetSection($section); - - $objCatToolBar = new clsToolBar(); - $objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('save_edit_buttons','".$admin."/browse.php',1);","tool_select.gif"); - $objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('save_edit_buttons','".$admin."/browse.php',2);","tool_cancel.gif"); - -if($en_prev or $en_next) -{ - if($en_prev>-1) - { - $MouseOver="swap('moveleft','toolbar/tool_prev_f2.gif');"; - $MouseOut="swap('moveleft', 'toolbar/tool_prev.gif');"; - $onClick= $sec->Get("onclick"); - $var="?env=".BuildEnv()."&en=$en_prev"; - $link=$_SERVER["PHP_SELF"].$var; - $objCatToolBar->Add("moveleft",admin_language("la_ToolTip_Previous")." ".admin_language("la_Text_Category"),$link,$MouseOver,$MouseOut,"","tool_prev.gif"); - } - else - { - $MouseOver=""; - $MouseOut=""; - $onClick=""; - $link="#"; - $objCatToolBar->Add("moveleft",admin_language("la_ToolTip_Previous")." ".admin_language("la_Text_Category"),"#","","","","tool_prev_f3.gif"); - - } - if($en_next>-1) - { - $MouseOver="swap('moveright','toolbar/tool_next_f2.gif');"; - $MouseOut="swap('moveright', 'toolbar/tool_next.gif');"; - $onClick=$sec->Get("onclick"); - $var="?env=".BuildEnv()."&en=$en_next"; - $link=$_SERVER["PHP_SELF"].$var; - $objCatToolBar->Add("moveright",admin_language("la_ToolTip_Next")." ".admin_language("la_Text_Category"),$link,$MouseOver,$MouseOut,"","tool_next.gif"); - } - else - { - $objCatToolBar->Add("moveright",admin_language("la_ToolTip_Next")." ".admin_language("la_Text_Category"),$link,$MouseOver,$MouseOut,"","tool_next_f3.gif"); - } - - - int_header($objCatToolBar,NULL,$title); -} -else - int_header($objCatToolBar,NULL,$title); - - -?> - - -Items as $f) - { - $o .= ""; - $o .= ""; - $o .= ""; - $o .= ""; - } -?> - - - - - -> - - - - - > - -
Get("CustomFieldId")."\">"; - $o .= $f->Get("FieldName")."".$f->Get("FieldLabel")."
- - -
-
- - - New Custom Field Name: - Label: - -
-
-
- - -
- \ No newline at end of file Index: trunk/admin/category/images/ddarrow_over.gif =================================================================== diff -u -N -r13 -r6428 Binary files differ Index: trunk/admin/category/addcategory_permissions.php =================================================================== diff -u -N --- trunk/admin/category/addcategory_permissions.php (revision 5180) +++ trunk/admin/category/addcategory_permissions.php (revision 0) @@ -1,226 +0,0 @@ - Home category live permissions editing -$item_resource_id = $application->GetVar('item'); -if (($item_resource_id !== false) && ((int)$item_resource_id === 0)) { - $objSession->SetVariable('IsHomeCategory', 1); -} - -require_once ($pathtoroot.$admin."/include/elements.php"); -require_once ($pathtoroot."kernel/admin/include/navmenu.php"); -//require_once ($pathtolocal."admin/include/navmenu.php"); -require_once($pathtoroot.$admin."/toolbar.php"); -require_once($pathtoroot.$admin."/listview/listview.php"); - -$m = GetModuleArray(); -foreach($m as $key=>$value) -{ - $path = $pathtoroot. $value."admin/include/parser.php"; - if(file_exists($path)) - { - include_once($path); - } -} - -unset($objEditItems); - -$objEditItems = new clsCatList(); -$objEditItems->SourceTable = $objSession->GetEditTable("Category"); - -$live_editing = $objSession->GetVariable('IsHomeCategory'); -if ($live_editing) { - $objEditItems->SourceTable = TABLE_PREFIX.'Category'; -} - -//Multiedit init -$en = (int)$_GET["en"]; -$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable.($objEditItems->isLiveTable() ? ' WHERE CategoryId = 0' : '')); -$itemcount = $objEditItems->NumItems(); -if(isset($_GET["en"])) -{ - $c = $objEditItems->GetItemByIndex($en); -} - -if(!is_object($c)) -{ - $c = new clsCategory($m_var_list["cat"]); - $c->Set("CategoryId",$m_var_list["cat"]); -} -if($itemcount>1) -{ - if ($en+1 == $itemcount) - $en_next = -1; - else - $en_next = $en+1; - - if ($en == 0) - $en_prev = -1; - else - $en_prev = $en-1; -} - -$action = "m_edit_category"; - -/* -------------------------------------- Section configuration ------------------------------------------- */ -$envar = "env=" . BuildEnv() . "&en=$en"; -$section = 'in-portal:editcategory_permissions'; - -$sec = $objSections->GetSection($section); -if($c->Get("CategoryId")==0) -{ - $sec->Set("left",NULL); - $sec->Set("right",NULL); - -} -if($c->Get("CategoryId")!=0) -{ - $title = admin_language("la_Text_Editing")." ".admin_language("la_Text_Category")." '".$c->Get("Name")."' - ".admin_language("la_tab_Permissions"); -} -else - $title = admin_language("la_Text_Editing")." ".admin_language("la_Text_Root")." ".admin_language("la_Text_Category")." - ".admin_language("la_tab_Permissions"); - -$SortFieldVar = "GroupPerm_SortField"; -$SortOrderVar = "GroupPerm_SortOrder"; -$DefaultSortField = "FullName"; -$PerPageVar = "Perpage_Grouplist"; -$CurrentPageVar = "Page_Grouplist"; -$CurrentFilterVar = "CatImg_View"; - -$ListForm = "permlistform"; -$CheckClass = "PermChecks"; -/* ------------------------------------- Configure the toolbar ------------------------------------------- */ -$saveURL = $admin."/category/category_maint.php"; -$cancelURL = $admin."/".$objSession->GetVariable('ReturnScript'); -$objListToolBar = new clsToolBar(); -$objListToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('save_edit_buttons','CatEditStatus','$saveURL',1);","tool_select.gif"); -$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('save_edit_buttons','CatEditStatus','".$cancelURL."',2);","tool_cancel.gif"); -if($itemcount == 1) $objListToolBar->Add("divider"); - -$objListToolBar->Set("section",$section); -$objListToolBar->Set("load_menu_func",""); -$objListToolBar->Set("CheckClass",$CheckClass); -$objListToolBar->Set("CheckForm",$ListForm); - -if ( isset($en_prev) || isset($en_next) ) -{ - $url = $RootUrl.$admin."/category/addcategory_permissions.php"; - $StatusField = "CatEditStatus"; - $form = "category"; - MultiEditButtons($objListToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'','la_PrevCategory','la_NextCategory'); - $objListToolBar->Add("divider"); -} - -$listImages = array(); - //$img, $alt, $link, $onMouseOver, $onMouseOut, $onClick - -$objListToolBar->Add("new_perm", "la_ToolTip_New_Permission","#","swap('new_perm','toolbar/tool_new_permission_f2.gif');", - "swap('new_perm', 'toolbar/tool_new_permission.gif');", - "OpenGroupSelector('$envar&source=addcategory_permissions&CatId=".$c->Get("CategoryId")."&destform=popup&destfield=itemlist');", - "tool_new_permission.gif"); - -$objListToolBar->Add("perm_edit","Edit","#", "if (PermChecks.itemChecked()) swap('perm_edit','toolbar/tool_edit_f2.gif');", - "if (PermChecks.itemChecked()) swap('perm_edit', 'toolbar/tool_edit.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addpermission_modules', '');", - "tool_edit.gif",TRUE,TRUE); -$listImages[] = "PermChecks.addImage('perm_edit','$imagesURL/toolbar/tool_edit.gif','$imagesURL/toolbar/tool_edit_f3.gif',1); "; - -$objListToolBar->Add("perm_del","Delete","#", "if (PermChecks.itemChecked()) swap('perm_del','toolbar/tool_delete_f2.gif');", - "if (PermChecks.itemChecked()) swap('perm_del', 'toolbar/tool_delete.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addcategory_permissions', 'm_perm_delete_group');", - "tool_delete.gif",FALSE,TRUE); -$listImages[] = "PermChecks.addImage('perm_del','$imagesURL/toolbar/tool_delete.gif','$imagesURL/toolbar/tool_delete_f3.gif',1); "; - -$objListToolBar->Add("divider"); -$objListToolBar->AddToInitScript($listImages); - -/* ------------------------------------ Build the SQL statement to populate the list ---------------------------*/ -$objGroupList = new clsGroupList(); -$order = $objConfig->Get("Group_SortOrder"); -$objGroupList->Clear(); - -$sql = 'SELECT ResourceId, g.name AS Name, ELT(g.Personal + 1,"Group ","User ") AS UserGroup - FROM '.TABLE_PREFIX.'Permissions p - LEFT JOIN '.TABLE_PREFIX.'PortalGroup g ON p.GroupId = g.GroupId - WHERE (p.CatId = '.(int)$c->Get('CategoryId').') AND (g.Personal = 0) AND (p.Type = 0) - GROUP BY Name'; -//$sql = "SELECT GroupId, count(*) as PermCount FROM ".GetTablePrefix()."Permissions WHERE CatId=".$c->Get("CategoryId")." GROUP BY GroupId"; -$objGroupList->Query_Item($sql); - -if($objSession->HasSystemPermission("DEBUG.LIST")) - echo htmlentities($sql,ENT_NOQUOTES)."
\n"; - -/* ---------------------------------------- Configure the list view ---------------------------------------- */ -$objListView = new clsListView($objListToolBar,$objGroupList); -$objListView->IdField = "ResourceId"; -$objListView->PageLinkTemplate = $pathtoroot. "admin/templates/user_page_link.tpl"; - -$objListView->ColumnHeaders->Add("Name",admin_language("la_prompt_Name"),1,0,$order,"width=\"20%\"",$SortFieldVar,$SortOrderVar,"Name"); -$objListView->ColumnHeaders->Add("UserGroup",admin_language("la_Colheader_GroupType"),1,0,$order,"width=\"30%\"",$SortFieldVar,$SortOrderVar,"UserGroup"); - -$objListView->ColumnHeaders->SetSort($objConfig->Get($SortFieldVar),$order); - -$objListView->PrintToolBar = FALSE; -$objListView->CurrentPageVar = $CurrentPageVar; -$objListView->PerPageVar = $PerPageVar; -$objListView->CheckboxName = "itemlist[]"; - -int_header($objListToolBar,NULL,$title); -if ($objSession->GetVariable("HasChanges") == 1) { -?> - - - - -
- -
- -
-PrintList(); -?> - -"> -
-
- - "> - -
- - - -
" name="viewmenu"> - - - - -
- - - - - Index: trunk/admin/category/category_maint.php =================================================================== diff -u -N --- trunk/admin/category/category_maint.php (revision 6093) +++ trunk/admin/category/category_maint.php (revision 0) @@ -1,128 +0,0 @@ -GetVariable('PermCache_UpdateRequired')) -{ - - $application->ApplicationDie(header('Location: '.$adminURL.'/'.$objSession->GetVariable('ReturnScript').'?env='.BuildEnv())); -} -if(isset($_GET['continue'])) -{ - $updater =& new clsCacheUpdater(1); - if(!intval($_GET['continue'])) - { - $updater->clearData(); - $application->ApplicationDie(header('Location: '.$adminURL.'/'.$objSession->GetVariable('ReturnScript').'?env='.BuildEnv())); - } -} -else -{ - $updater =& new clsCacheUpdater(); - $no_url = $_SERVER['PHP_SELF'].'?env='.BuildEnv().'&continue=0'; - $yes_url = $_SERVER['PHP_SELF'].'?env='.BuildEnv().'&continue=1'; - - - if(!isset($_GET['force'])) - if($updater->totalCats > CACHE_PERM_CHUNK_SIZE) - { - $updater->setData(); - $title = prompt_language("la_prompt_updating")." ".prompt_language("la_Text_Categories"); - int_header(NULL,NULL,$title); - flush(); -?> - - - - - - - - - - - - - -
- " onclick="javascript:goto_url('');" class="button"> - - " onclick="javascript:goto_url('');" class="button"> -
-ApplicationDie(); - } -} -$title = prompt_language("la_prompt_updating")." ".prompt_language("la_Text_Categories"); -int_header(NULL,NULL,$title); -flush(); -$percent=$updater->getDonePercent(); -echo ''; -if ($percent == 0) - echo ''; -else if ($percent < 60) - echo ''; -else if ($percent == 100) - echo ''; -else - echo ''; -echo '
'.$percent.'%
'.$percent.'%
'.$percent.'%
'.$percent.'%
'; -flush(); - -$needs_more = TRUE; -while ($needs_more && $updater->iteration < CACHE_PERM_CHUNK_SIZE) { - $needs_more = $updater->DoTheJob(); -} - -if ($needs_more) -{ - $updater->setData(); - $url=$adminURL.'/category/category_maint.php?env='.BuildEnv().'&continue=1'; -} -else -{ - $updater->clearData(); - $url = $adminURL.'/'.$objSession->GetVariable('ReturnScript').'?env='.BuildEnv(); - $objSession->SetVariable('PermCache_UpdateRequired', 0); -} -print ""; -int_footer(); -exit; -?> \ No newline at end of file Index: trunk/admin/category/addpermission_modules.php =================================================================== diff -u -N --- trunk/admin/category/addpermission_modules.php (revision 4446) +++ trunk/admin/category/addpermission_modules.php (revision 0) @@ -1,233 +0,0 @@ -$value) -{ - $path = $pathtoroot. $value."admin/include/parser.php"; - if(file_exists($path)) - { - include_once($path); - } -} - -unset($objEditItems); - -$objEditItems = new clsCatList(); -$objEditItems->SourceTable = $objSession->GetEditTable("Category"); - -$live_editing = $objSession->GetVariable('IsHomeCategory'); -if ($live_editing) { - $objEditItems->SourceTable = TABLE_PREFIX.'Category'; -} - -//Multiedit init -$en = (int)$_GET["en"]; -$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable.($objEditItems->isLiveTable() ? ' WHERE CategoryId = 0' : '')); -$itemcount=$objEditItems->NumItems(); - -if(isset($_GET["en"])) -{ - $c = $objEditItems->GetItemByIndex($en); -} -else -{ - $c = new clsCategory($m_var_list["cat"]); -} - -if(!is_object($c)) -{ - $c = new clsCategory(); - $c->Set("CategoryId",0); -} -if($itemcount>1) -{ - if ($en+1 == $itemcount) - $en_next = -1; - else - $en_next = $en+1; - - if ($en == 0) - $en_prev = -1; - else - $en_prev = $en-1; -} -$action = "m_edit_permissions"; - -$envar = "env=" . BuildEnv() . "&en=$en"; - -//$section = 'in-portal:editcategory_permissions'; -$section = 'in-portal:catperm_modules'; - -if(count($_POST)) -{ - if($_POST["Action"]=="m_edit_permissions") - { - $GroupId = $_POST["GroupId"]; - $g = $objGroups->GetItem($GroupId); - } - else - { - if(!is_array($_POST["itemlist"])) - { - $g = $objGroups->GetItemByField("ResourceId", $_POST["itemlist"]); - if(is_object($g)) - $GroupId = $g->Get("GroupId"); - } - else - { - $g = $objGroups->GetItemByField("ResourceId", $_POST["itemlist"][0]); - $GroupId = $g->Get("GroupId"); - } - } -} -else -{ - $GroupId = $_GET["GroupId"]; - $g = $objGroups->GetItem($GroupId); -} - -$objPermList = new clsPermList($c->Get("CategoryId"),$GroupId); - -$ado = &GetADODBConnection(); -$sql = "SELECT DISTINCT(ModuleId) FROM ".GetTablePrefix()."PermissionConfig"; -$rs = $ado->Execute($sql); -$Modules = array(); - -while($rs && !$rs->EOF) -{ - $data = $rs->fields; - $Modules[] = $data["ModuleId"]; - $rs->MoveNext(); -} -/* page header */ -$charset = GetRegionalOption('Charset'); -print << - - In-portal - - - - - - - - - - - -END; - -//int_SectionHeader(); -if($c->Get("CategoryId")!=0) -{ - $title = admin_language("la_Text_Editing")." ".admin_language("la_Text_Category")." '".$c->Get("Name")."' - ".admin_language("la_tab_Permissions"); - $title .= " ".admin_language("la_text_for")." '".$g->parsetag("group_name")."'"; -} -else -{ - $title = admin_language("la_Text_Editing")." ".admin_language("la_Text_Root")." ".admin_language("la_Text_Category")." - "."' - ".admin_language("la_tab_Permissions"); - $title .= " ".admin_language("la_text_for")." '".$g->parsetag("group_name")."'"; -} - -$objListToolBar = new clsToolBar(); -$objListToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('category','CatEditStatus','$admin/category/addcategory_permissions.php',0);",$imagesURL."/toolbar/tool_select.gif"); -$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('category','CatEditStatus','".$admin."/category/addcategory_permissions.php',-1);", $imagesURL."/toolbar/tool_cancel.gif"); - -$sec = $objSections->GetSection($section); -if($c->Get("CategoryId")==0) -{ - $sec->Set("left",NULL); - $sec->Set("right",NULL); -} - -int_header($objListToolBar,NULL,$title); -if ($objSession->GetVariable("HasChanges") == 1) { -?> - - - - -
- -
- - - - - - - -
- - - -"; - echo ""; - echo ""; - } - } -?> - -
"; - $getvar = "?env=".BuildEnv()."&module=$module&GroupId=$GroupId&en=".GetVar('en'); - echo "$module
- "> - "> - - - - -
- > - - - - -
- -
- - - - -
- - Index: trunk/admin/category/addcategory_images.php =================================================================== diff -u -N --- trunk/admin/category/addcategory_images.php (revision 3282) +++ trunk/admin/category/addcategory_images.php (revision 0) @@ -1,299 +0,0 @@ -$value) -{ - $path = $pathtoroot. $value."admin/include/parser.php"; - if(file_exists($path)) - { - include_once($path); - } -} - -/* ------------------------------------- Edit Table --------------------------------------------------- */ -unset($objEditItems); - -$objEditItems = new clsCatList(); -$objEditItems->SourceTable = $objSession->GetEditTable("Category"); - -$en = (int)$_GET["en"]; -$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable); -$itemcount=$objEditItems->NumItems(); -$c = $objEditItems->GetItemByIndex($en); - -if($itemcount>1) -{ - if ($en+1 == $itemcount) - $en_next = -1; - else - $en_next = $en+1; - - if ($en == 0) - $en_prev = -1; - else - $en_prev = $en-1; -} -$action = "m_item_image"; -/* -------------------------------------- Section configuration ------------------------------------------- */ -$envar = "env=" . BuildEnv() . "&en=$en"; -$section = 'in-portal:editcategory_images'; -$sec = $objSections->GetSection($section); -$title = admin_language("la_Text_Editing")." ".admin_language("la_Text_Category")." '".$c->Get("Name")."' - ".admin_language("la_tab_Images"); - -$SortFieldVar = "Image_LV_Sortfield"; -$SortOrderVar = "Image_LV_Sortorder"; -$DefaultSortField = "FullName"; -$PerPageVar = "Perpage_Images"; -$CurrentPageVar = "Page_Images"; -$CurrentFilterVar = "CatImg_View"; - -$ListForm = "imagelistform"; -$CheckClass = "PermChecks"; -/* ------------------------------------- Configure the toolbar ------------------------------------------- */ -$objListToolBar = new clsToolBar(); -$saveURL = $admin."/category/category_maint.php"; -$cancelURL = $admin."/".$objSession->GetVariable('ReturnScript'); -$objListToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('save_edit_buttons','CatEditStatus','$saveURL',1);","tool_select.gif"); -$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('save_edit_buttons','CatEditStatus','".$cancelURL."',2);","tool_cancel.gif"); -if($itemcount == 1) $objListToolBar->Add("divider"); -$objListToolBar->Set("section",$section); -$objListToolBar->Set("load_menu_func",""); -$objListToolBar->Set("CheckClass",$CheckClass); -$objListToolBar->Set("CheckForm",$ListForm); - -if ( isset($en_prev) || isset($en_next) ) -{ - $url = $RootUrl.$admin."/category/addcategory_images.php"; - $StatusField = "CatEditStatus"; - $form = "category"; - MultiEditButtons($objListToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'','la_PrevCategory','la_NextCategory'); - $objListToolBar->Add("divider"); -} - -$listImages = array(); -$objListToolBar->Add("new_img", "la_ToolTip_New_Image",$adminURL."/category/addimage.php?".$envar,"swap('new_img','toolbar/tool_new_image_f2.gif');", - "swap('new_img', 'toolbar/tool_new_image.gif');", - "","tool_new_image.gif"); - -$objListToolBar->Add("img_edit","la_ToolTip_Edit","#", "if (PermChecks.itemChecked()) swap('img_edit','toolbar/tool_edit_f2.gif');", - "if (PermChecks.itemChecked()) swap('img_edit', 'toolbar/tool_edit.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addimage', '');", - "tool_edit.gif",TRUE,TRUE); -$listImages[] = "PermChecks.addImage('img_edit','$imagesURL/toolbar/tool_edit.gif','$imagesURL/toolbar/tool_edit_f3.gif',1);\n"; - -$objListToolBar->Add("img_del","la_ToolTip_Delete","#", "if (PermChecks.itemChecked()) swap('img_del','toolbar/tool_delete_f2.gif');", - "if (PermChecks.itemChecked()) swap('img_del', 'toolbar/tool_delete.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addcategory_images', 'm_img_delete');", - "tool_delete.gif",FALSE,TRUE); -$listImages[] = "PermChecks.addImage('img_del','$imagesURL/toolbar/tool_delete.gif','$imagesURL/toolbar/tool_delete_f3.gif',1);\n "; - -$objListToolBar->Add("divider"); - -$objListToolBar->Add("img_move_up","la_ToolTip_Move_Up","#", "if (PermChecks.itemChecked()) swap('img_move_up','toolbar/tool_move_up_f2.gif');", - "if (PermChecks.itemChecked()) swap('img_move_up', 'toolbar/tool_move_up.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addcategory_images', 'm_img_move_up');", - "tool_move_up.gif",FALSE,TRUE); -$listImages[] = "PermChecks.addImage('img_move_up','$imagesURL/toolbar/tool_move_up.gif','$imagesURL/toolbar/tool_move_up_f3.gif',1);\n "; - -$objListToolBar->Add("img_move_down","la_ToolTip_Move_Down","#", "if (PermChecks.itemChecked()) swap('img_move_down','toolbar/tool_move_down_f2.gif');", - "if (PermChecks.itemChecked()) swap('img_move_down', 'toolbar/tool_move_down.gif');","if (PermChecks.itemChecked()) PermChecks.check_submit('addcategory_images', 'm_img_move_down');", - "tool_move_down.gif",FALSE,TRUE); -$listImages[] = "PermChecks.addImage('img_move_down','$imagesURL/toolbar/tool_move_down.gif','$imagesURL/toolbar/tool_move_down_f3.gif',1);\n "; - -$objListToolBar->Add("divider"); - -$objListToolBar->Add("viewmenubutton", "la_ToolTip_View","#","swap('viewmenubutton','toolbar/tool_view_f2.gif'); ", - "swap('viewmenubutton', 'toolbar/tool_view.gif');", - "ShowViewMenu();","tool_view.gif"); - -$objListToolBar->AddToInitScript($listImages); - -/* ----------------------------------------- Set the View Filter ---------------------------------------- */ -$Img_AllValue = 3; -$Bit_Enabled=1; -$Bit_Disabled=2; -$FilterLabels = array(); - -$FilterLabels[0] = admin_language("la_Text_Enabled"); -$FilterLabels[1] = admin_language("la_Text_Disabled"); - -$ImgView = $objConfig->Get($CurrentFilterVar); - -if(!is_numeric($ImgView)) -{ - $ImgView = $Img_AllValue; -} -else -{ - if($ImgView & $Bit_Enabled) - $Filters[] = "img.Enabled=1"; - - if($ImgView & $Bit_Disabled) - $Filters[] = "img.Enabled=0"; - - if(count($Filters)) - { - $imgFilter = implode(" OR ",$Filters); - } - else - $imgFilter = "ImageId = -1"; -} - -/* ------------------------------------ Build the SQL statement to populate the list ---------------------------*/ -$objImageList = new clsImageList(); -$objImageList->SourceTable = $objSession->GetEditTable("Images"); - -$sql = "SELECT ELT(img.Enabled+1,'".admin_language("la_Text_Disabled")." ','".admin_language("la_Text_Enabled")." ') as Status, "; -$sql .="img.AltName as AltName, img.ImageId as ImageId, img.Enabled as Enabled, img.Priority as Priority, "; -$sql .="concat(img.Name,ELT(img.DefaultImg+1,'','
(".admin_language("la_prompt_Primary").") ')) as FullName, "; -$sql .="if(img.LocalImage=1,'(".admin_language("la_Text_Local").") ',img.Url) as ShowURL, concat( '') AS Preview "; - -$sql .="FROM ".$objImageList->SourceTable." as img WHERE img.ResourceId=".$c->Get("ResourceId"); - -if(strlen($imgFilter)) - $sql .= " AND ($imgFilter)"; - -$order = trim($objConfig->Get($SortFieldVar)." ".$objConfig->Get($SortOrderVar)); - -$sql .=" ORDER BY Priority DESC"; -if(strlen($order)) - $sql .= ", ".$order; - -$sql .=" ".GetLimitSQL($objSession->GetVariable($CurrentPageVar),$objConfig->Get($PerPageVar)); - -$objImageList->Query_Item($sql); -if($objSession->HasSystemPermission("DEBUG.LIST")) - echo htmlentities($sql,ENT_NOQUOTES)."
\n"; - -for($i=0;$iItems);$i++) -{ - $img =& $objImageList->GetItemRefByIndex($i); - $icon = $imagesURL."/itemicons/icon16_image_disabled.gif"; - - if($img->Get("Enabled")=="1") - { - $icon = $imagesURL."/itemicons/icon16_image.gif"; - } - $img->Set("Icon",$icon); -} - -/* ---------------------------------------- Configure the list view ---------------------------------------- */ - $objListView = new clsListView($objListToolBar,$objImageList); - $objListView->IdField = "ImageId"; - $SortOrder=0; - - if($objConfig->Get($SortOrderVar)=="asc") - $SortOrder=1; - - $objListView->ColumnHeaders->Add("FullName",language("la_ColHeader_Image"),1,0,$order,"width=\"10%\"",$SortFieldVar,$SortOrderVar,"FullName"); - $objListView->ColumnHeaders->Add("AltName",language("la_ColHeader_AltValue"),1,0,$order,"width=\"20%\"",$SortFieldVar,$SortOrderVar,"AltName"); - $objListView->ColumnHeaders->Add("ShowURL",language("la_ColHeader_Url"),1,0,$order,"width=\"20%\"",$SortFieldVar,$SortOrderVar,"ShowURL"); - $objListView->ColumnHeaders->Add("Status",language("la_ColHeader_Enabled"),1,0,$order,"width=\"10%\"",$SortFieldVar,$SortOrderVar,"Status"); - $objListView->ColumnHeaders->Add("Preview",language("la_ColHeader_Preview"),1,0,$order,"width=\"40%\"",$SortFieldVar,$SortOrderVar,"Preview"); - $objListView->ColumnHeaders->SetSort($objConfig->Get($SortFieldVar), $objConfig->Get($SortOrderVar)); - - $objListView->PrintToolBar = FALSE; - $objListView->CurrentPageVar = "Page_Images"; - $objListView->PerPageVar = "Perpage_Images"; - $objListView->CheckboxName = "itemlist[]"; - - $objListView->ConfigureViewMenu($SortFieldVar,$SortOrderVar,$DefaultSortField, - $CurrentFilterVar,$ImgView,$Img_AllValue); - - foreach($FilterLabels as $Bit=>$Label) - { - $objListView->AddViewMenuFilter($Label,$Bit); - } - for($i=0;$iItems);$i++) - { - $img =& $objImageList->GetItemRefByIndex($i); - $objListView->RowIcons[] = $img->Get("Icon"); - } - -$objListToolBar->AddToInitScript("fwLoadMenus();\n"); - -$filter = false; // always initialize variables before use -if ($ImgView != $Img_AllValue) { - $filter = true; -} - -$h = "\n\n\n"; -int_header($objListToolBar,NULL, $title,NULL,$h); -if ($objSession->GetVariable("HasChanges") == 1) { -?> - - - - -
- -
- - - - - - -
- -
- -
" method=POST> - - -PrintList(); -?> - "> - - - -
-
- - "> - -
-
- - -
- -
" name="viewmenu"> - - - - -
- - - - - \ No newline at end of file Index: trunk/admin/category/js/main.js =================================================================== diff -u -N --- trunk/admin/category/js/main.js (revision 13) +++ trunk/admin/category/js/main.js (revision 0) @@ -1,134 +0,0 @@ -var jsPath = "js/"; -var cssPath = "css/"; -var imgPath = "images/"; - -var preloadImages = new Array(); -cbPath = imgPath + "ddarrow.gif"; -cbPathO = imgPath + "ddarrow_over.gif"; -cbPathA = imgPath + "ddarrow_active.gif"; - -preloadImage(cbPath); -preloadImage(cbPathO); -preloadImage(cbPathA); - -addScript("core.js"); -addScript("lang.js"); - -addCss("wnd.css"); -addCss("calendar.css"); - -function initCalendar(id, dateFormat) -{ - var input = document.getElementById(id); - if (!input) return; - input.dateFormat = dateFormat; - - var inputContainer = document.createElement("DIV"); - inputContainer.className = "dpContainer"; - inputContainer.noWrap = true; - var pNode = input.parentNode; - pNode.insertBefore(inputContainer, input); - inputContainer.appendChild(pNode.removeChild(input)); - - var calendarButton = document.createElement("IMG"); - calendarButton.setAttribute("width", "24"); - calendarButton.setAttribute("height", "24"); - calendarButton.style.width=24 - calendarButton.style.height=24 - calendarButton.style.cursor = "hand"; - - calendarButton.setAttribute("hspace", 2); - calendarButton.src = cbPath; - calendarButton.onmouseover = cbMouseOver; - calendarButton.onmouseout = cbMouseOut; - calendarButton.onmouseup = calendarButton.onmouseout; - calendarButton.onmousedown = cbMouseDown; - calendarButton.showCalendar = wnd_showCalendar; - inputContainer.appendChild(calendarButton); -} - -var calendar; - -function cbMouseOver(e) -{ - this.src = cbPathO; - var evt = (e) ? e : event; if (evt) evt.cancelBubble = true; -} - -function cbMouseOut(e) -{ - this.src = cbPath; - var evt = (e) ? e : event; if (evt) evt.cancelBubble = true; -} - -function cbMouseDown(e) -{ - this.src = cbPathA; - var evt = (e) ? e : event; if (evt) evt.cancelBubble = true; - this.showCalendar(); -} - -function wnd_showCalendar() -{ - var el = this.parentNode.firstChild; - if (calendar != null) calendar.hide(); - else - { - var calendarObject = new Calendar(false, null, dateSelected, closeHandler); - calendar = calendarObject; - calendarObject.setRange(1900, 2070); - calendarObject.create(); - } - calendar.setDateFormat(this.parentNode.firstChild.dateFormat); - calendar.parseDate(el.value); - calendar.sel = el; - calendar.showAtElement(el); - - Calendar.addEvent(document, "mousedown", checkCalendar); - return false; -} - -function dateSelected(calendarObject, date) -{ - calendarObject.sel.value = date; - calendarObject.callCloseHandler(); -} - -function closeHandler(calendarObject) -{ - calendarObject.hide(); - Calendar.removeEvent(document, "mousedown", checkCalendar); -} - -function checkCalendar(ev) -{ - var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); - - for (; el != null; el = el.parentNode) - if (el == calendar.element || el.tagName == "A") break; - - if (el == null) - { - calendar.callCloseHandler(); - Calendar.stopEvent(ev); - } -} - -function preloadImage(path) -{ - var img = new Image(); - img.src = path; - preloadImages[preloadImages.length] = img; -} - -function addScript(path) -{ - path = jsPath + path; - document.write(""); -} - -function addCss(path) -{ - path = cssPath + path; - document.write(""); -} Index: trunk/admin/category/addrelation.php =================================================================== diff -u -N --- trunk/admin/category/addrelation.php (revision 2853) +++ trunk/admin/category/addrelation.php (revision 0) @@ -1,212 +0,0 @@ -$value) -{ - $path = $pathtoroot. $value."admin/include/parser.php"; - if(file_exists($path)) - { - include_once($path); - } -} - -unset($objEditCat); - -$objEditCat = new clsCatList(); -$objEditCat->SourceTable = $objSession->GetEditTable("Category"); - -//Multiedit init -$en = (int)$_GET["en"]; -$objEditCat->Query_Item("SELECT * FROM ".$objEditCat->SourceTable); -$itemcount=$objEditCat->NumItems(); -$c = $objEditCat->GetItemByIndex($en); - -unset($objEditItems); - -$objEditItems = new clsRelationshipList(); -$objEditItems->SourceTable = $objSession->GetEditTable("Relationship"); - -if(isset($_POST["itemlist"])) -{ - if(is_array($_POST["itemlist"])) - { - $RelationId = $_POST["itemlist"][0]; - } - else - { - $RelationId = $_POST["itemlist"]; - } - - - $Rel = new clsRelationship(); - $Rel->tablename = $objEditItems->SourceTable; - $Rel->LoadExpanded($RelationId); - $action = "m_edit_relation"; -} -else -{ - $Rel = new clsRelationship(); - $Rel->Set("SourceType","1"); - $Rel->Set("SourceId",$c->Get("ResourceId")); - $Rel->Set("TargetId",$_POST["TargetId"]); - $Rel->Set("TargetType",$_POST["TargetType"]); - $Rel->Set("Type","0"); - $Rel->Set("Enabled","1"); - $action = "m_add_relation"; -} - -$item = $Rel->GetTargetItemData(); -$envar = "env=" . BuildEnv() . "&en=$en"; - -$section = 'in-portal:editcategory_relation'; - -$ado = &GetADODBConnection(); - -/* page header */ -$charset = GetRegionalOption('Charset'); -print << - - In-portal - - - - - - - - - - - -END; - - -$title = prompt_language("la_Text_Editing")." ".prompt_language("la_Text_Category")." '".$c->Get("Name")."' - ".prompt_language("la_Text_Relation"); -$title .= " ".prompt_language("la_Text_to")." '".$item["TitleField"]."'"; - - -$objCatToolBar = new clsToolBar(); -$objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('category','CatEditStatus','".$admin."/category/addcategory_relations.php',0);",$imagesURL."/toolbar/tool_select.gif"); -$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('category','CatEditStatus','".$admin."/category/addcategory_relations.php',-1);",$imagesURL."/toolbar/tool_cancel.gif"); - -int_header($objCatToolBar,NULL,$title); -if ($objSession->GetVariable("HasChanges") == 1) { -?> - - - - -
- -
- - - - - > - - - - - > - - - - - > - - - - - > - - - - - > - - - - - "> - "> - "> - "> - "> - - - -
- ".$Rel->Get("RelationshipId"); ?> -  
- () -  
-Get("Type")=="1") - { - $Recip = " CHECKED"; - } - else - $OneWay = " CHECKED"; -?> - > - > -  
- Get("Enabled")=="1") - { - $checked = " CHECKED"; - } - ?> - > -  
- "> -  
-
- > - - - - -
- -
- - - - -
- - Index: trunk/admin/category/addimage.php =================================================================== diff -u -N --- trunk/admin/category/addimage.php (revision 4645) +++ trunk/admin/category/addimage.php (revision 0) @@ -1,289 +0,0 @@ -$value) -{ - $path = $pathtoroot. $value."admin/include/parser.php"; - if(file_exists($path)) - { - include_once($path); - } -} - -unset($objEditCat); - -$objEditCat = new clsCatList(); -$objEditCat->SourceTable = $objSession->GetEditTable("Category"); - -//Multiedit init -$en = (int)$_GET["en"]; -$objEditCat->Query_Item("SELECT * FROM ".$objEditCat->SourceTable); -$itemcount=$objEditCat->NumItems(); -$c = $objEditCat->GetItemByIndex($en); - -unset($objEditItems); - -$objEditItems = new clsImageList(); -$objEditItems->SourceTable = $objSession->GetEditTable("Images"); - -if(isset($_POST["itemlist"])) -{ - if(is_array($_POST["itemlist"])) - { - $ImageId = $_POST["itemlist"][0]; - } - else - { - $ImageId = $_POST["itemlist"]; - } - $img = $objEditItems->GetItem($ImageId); - $img->Pending=TRUE; - $action = "m_img_edit"; - $name = $img->Get("Name"); -} -else -{ - $img = new clsImage(); - $img->Set("ResourceId",$c->Get("ResourceId")); - $img->Set("ImageId",$img->FieldMin("ImageId")-1); - $img->Pending=TRUE; - $img->tablename = $objEditItems->SourceTable; - $action = "m_img_add"; - $name = "'New Image'"; - -} - -$envar = "env=" . BuildEnv() . "&en=$en"; -$section = 'in-portal:cat_imageedit'; -$ado = &GetADODBConnection(); - -/* page header */ -$charset = GetRegionalOption('Charset'); -print << - - In-portal - - - - - - - - - - - -END; - -$objListToolBar = new clsToolBar(); - -$objListToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","edit_submit('category','CatEditStatus','".$admin."/category/addcategory_images.php',0);",$imagesURL."/toolbar/tool_select.gif"); -$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('category','CatEditStatus','".$admin."/category/addcategory_images.php',-1);", $imagesURL."/toolbar/tool_cancel.gif"); - -$title = prompt_language("la_Text_Editing")." ".prompt_language("la_Text_Category")." '".$c->Get("Name")."' - ".prompt_language("la_Text_Image"); -$title .= " '".$name."'"; -int_header($objListToolBar,NULL,$title); -if ($objSession->GetVariable("HasChanges") == 1) { -?> - - - - -
- -
- - - - - - > - - - - - - > - - - - - - > - - - - - - > - - - - - - > - - - - - - > - - - - - - - - - > - - Get("LocalThumb")==1 || strlen($img->Get("LocalThumb"))==0) - { - $local="checked"; - $remote = ""; - } - else - { - $remote="checked"; - $local = ""; - } - ?> - - - - - - - - -> - - Get("SameImages")=="1") || !$img->Get("ImageId") || ($img->Get("ImageId") == "-1")) - { - - $checked = "CHECKED"; - $disabled = "DISABLED=\"true\""; - } - ?> - - - -> - - Get("LocalImage")==1 || strlen($img->Get("LocalImage"))==0) - { - $local="checked"; - $remote = ""; - } - else - { - $remote="checked"; - $local = ""; - } - ?> - - - - - - - "> - "> - -
Get("ImageId") != -1) echo $img->Get("ImageId"); ?>
">
">
- Get("Enabled")==1) echo "CHECKED"; ?> VALUE="1"> - Get("Enabled")==0) echo "CHECKED"; ?> VALUE="0"> -
Get("DefaultImg")==1) echo "CHECKED"; ?> VALUE="1">
">
- - - - - - - - - -
- VALUE="1">: - -
-
- VALUE="0"> : - -
-
-
- -
ONCLICK="enableFullImage(this);">
- - - - - - - - - -
- VALUE="1">: - -
-
- VALUE="0"> : - -
-
-
- -
- - -
- - - - -
- - - - Index: trunk/admin/category/addpermission.php =================================================================== diff -u -N --- trunk/admin/category/addpermission.php (revision 4446) +++ trunk/admin/category/addpermission.php (revision 0) @@ -1,344 +0,0 @@ -$value) -{ - $path = $pathtoroot. $value."admin/include/parser.php"; - if(file_exists($path)) - { - include_once($path); - } -} - -unset($objEditItems); - -$objEditItems = new clsCatList(); -$objEditItems->SourceTable = $objSession->GetEditTable('Category'); - -$live_editing = $objSession->GetVariable('IsHomeCategory'); -if ($live_editing) { - $objEditItems->SourceTable = TABLE_PREFIX.'Category'; -} - -//Multiedit init -$en = (int)$_GET["en"]; -$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable.($objEditItems->isLiveTable() ? ' WHERE CategoryId = 0' : '')); -$itemcount=$objEditItems->NumItems(); - -$c = $objEditItems->GetItemByIndex($en); - -if(!is_object($c)) -{ - $c = new clsCategory(); - $c->Set("CategoryId",0); -} -if($itemcount>1) -{ - if ($en+1 == $itemcount) - $en_next = -1; - else - $en_next = $en+1; - - if ($en == 0) - $en_prev = -1; - else - $en_prev = $en-1; -} -$action = "m_edit_permissions"; - -$envar = "env=" . BuildEnv() . "&en=$en"; - -$section = 'in-portal:catperm_setperm'; -$Module = $_GET["module"]; -$GroupId = $_GET["GroupId"]; - -$g = $objGroups->GetItem($GroupId); - -$objPermList = new clsPermList($c->Get("CategoryId"),$GroupId); -$objPermList->LoadPermTree($c); - -$objParentPerms = new clsPermList($c->Get("ParentId"),$GroupId); -$p = $objCatList->GetCategory($c->Get("ParentId")); -$objParentPerms->LoadPermTree($p); - -$ado = &GetADODBConnection(); - -/* page header */ -$charset = GetRegionalOption('Charset'); -print << - - In-portal - - - - - - - - - - - -END; - -//int_SectionHeader(); -//$back_url = $rootURL."admin/category/addpermission_modules.php?env=".BuildEnv()."&GroupId=$GroupId"; -$back_url = "javascript:do_edit_save('category','CatEditStatus','".$admin."/category/addpermission_modules.php',0);"; - -if($c->Get("CategoryId")>0) -{ - $title = prompt_language("la_Text_Editing")." ".prompt_language("la_Text_Category")." '".$c->Get("Name")."' - ".prompt_language("la_tab_Permissions"); - $title .= " ".prompt_language("la_text_for")." '".$g->parsetag("group_name")."'"; -} -else -{ - $title = prompt_language("la_Text_Editing")." ".prompt_language("la_Text_Root")." ".prompt_language("la_Text_Category")." - "."' - ".prompt_language("la_tab_Permissions"); - $title .= " ".prompt_language("la_text_for")." '".$g->parsetag("group_name")."'"; -} - -$objListToolBar = new clsToolBar(); - -$objListToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('category','CatEditStatus','".$admin."/category/addpermission_modules.php',0);",$imagesURL."/toolbar/tool_select.gif"); -//$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('category','admin/category/addpermission_modules.php',-1);", $imagesURL."/toolbar/tool_cancel.gif"); -$objListToolBar->Add("img_cancel", "la_Cancel",$back_url,"swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","", $imagesURL."/toolbar/tool_cancel.gif"); -$sec = $objSections->GetSection($section); - -if($c->Get("CategoryId")==0) -{ - $sec->Set("left",NULL); - $sec->Set("right",NULL); - -} -int_header($objListToolBar,NULL,$title); -if ($objSession->GetVariable("HasChanges") == 1) { -?> - - - - -
- -
- - - - - - - -
- - - - - - ".prompt_language("la_prompt_Description").""; - if($c->Get("CategoryId")!=0) - { - echo ""; - } - echo "\n"; - if($c->Get("CategoryId")!=0) - { - echo ""; - } - ?> - -Get("CategoryId")>0) - { - $ParentCatList = "0".$c->Get("ParentPath"); - } - else - $ParentCatList = "0".$c->GetParentField("ParentPath","",""); - $ParentCats = explode("|",$ParentCatList); - $ParentCats = array_reverse($ParentCats); - - $sql = "SELECT * FROM ".GetTablePrefix()."PermissionConfig WHERE ModuleId='$Module'"; - $rs = $ado->Execute($sql); - while($rs && !$rs->EOF) - { - $perm = $rs->fields; - $Permission = $perm["PermissionName"]; - $Desc = $perm["Description"]; - echo "\n"; - echo ""; - $p = $objPermList->GetPermByName($Permission); - $checked = ""; - $MatchCatPath = ""; - if(is_object($p)) - { - //echo $p->Get("Permission")." Found
\n"; - if($p->Inherited) - { - $checked = " CHECKED"; - $MatchCatPath = ""; - if($c->Get("CategoryId")>0) - { - $MatchedCat = $objPermList->GetDefinedCategory($Permission,$GroupId); - } - else - $MatchedCat = $objParentPerms->GetDefinedCategory($Permission,$GroupId); - - if(is_numeric($MatchedCat)) - { - if($MatchedCat!=0) - { - $mcat = $objCatList->GetCategory($MatchedCat); - $MatchCatPath = language($objConfig->Get("Root_Name")).">".$mcat->Get("CachedNavbar"); - } - else - $MatchCatPath = language($objConfig->Get("Root_Name")); - } - else - $MatchCatPath = ""; - } - } - else - $checked = " CHECKED"; - if($c->Get("CategoryId")!=0) - { - echo " \n"; - } - else - { - if(is_object($p)) - $p->Inherited = FALSE; - } - $checked = ""; - $imgsrc="red"; - if(is_object($p)) - { - if($p->Get("PermissionValue")) - { - $checked = " CHECKED"; - $imgsrc = "green"; - $current = "true"; - } - else - { - $imgsrc = "red"; - $current = "false"; - } - $disabled = ""; - if($p->Inherited) - { - if($c->Get("CategoryId")!=0) - { - $InheritValue = $current; - $UnInheritValue = "false"; - $disabled = "DISABLED=\"true\""; - } - else - { - $disabled = ""; - $UnInheritValue = "false"; - $InheritValue="false"; - - } - } - else - { - $disabled = ""; - if($p->Get("PermissionValue")) - { - $InheritValue = "false"; //need to look this up! - } - else - $InheritValue = "false"; - $UnInheritValue = $current; - } - - } - else - { - if($c->Get("CategoryId")!=0) - { - $disabled = "DISABLED=\"true\""; - $InheritValue = "false"; - $UnInheritValue = "false"; - $Matched = FALSE; - $MatchCatPath = ""; - $MatchedCat = $objPermList->GetDefinedCategory($Permission,$GroupId); - if(is_numeric($MatchedCat)) - { - if($MatchedCat>0) - { - $mcat = $objCatList->GetCategory($MatchedCat); - $MatchCatPath =language($objConfig->Get("Root_Name")).">".$mcat->Get("CachedNavbar"); - } - else - $MatchCatPath = language($objConfig->Get("Root_Name")); - } - else - $MatchCatPath = ""; - } - else - { - $disabled = ""; - $UnInheritValue = "false"; - $InheritValue="false"; - } - } - echo " \n"; - if($c->Get("CategoryId")!=0) - echo ""; - echo "\n"; - $rs->MoveNext(); - } -?> - - - - "> - - - -
".prompt_language("la_ColHeader_PermInherited")."".prompt_language("la_ColHeader_PermAccess")."".prompt_language("la_ColHeader_InheritFrom")."
".prompt_language("$Desc")." [$Permission]"; - - echo " "; - echo " $MatchCatPath
- -
- - - - -
- - Index: trunk/admin/category/images/ddarrow_active.gif =================================================================== diff -u -N -r13 -r6428 Binary files differ Index: trunk/admin/category/permcacheupdate.php =================================================================== diff -u -N --- trunk/admin/category/permcacheupdate.php (revision 5253) +++ trunk/admin/category/permcacheupdate.php (revision 0) @@ -1,383 +0,0 @@ -Stack = Array(); - } - - function Push($values) - { - array_push($this->Stack, $values); - } - - function Pop() - { - if ($this->Count() > 0) { - return array_pop($this->Stack); - } - else { - return false; - } - } - - function Get() - { - if ($this->Count() > 0) { -// return end($this->Stack); - return $this->Stack[count($this->Stack)-1]; - } - else { - return false; - } - } - - function Update($values) - { - $this->Stack[count($this->Stack)-1] = $values; - } - - function Count() - { - return count($this->Stack); - } -} - - -class clsCachedPermissions -{ - var $Allow = Array(); - var $Deny = Array(); - var $CatId; - - function clsCachedPermissions($CatId) - { - $this->CatId = $CatId; - } - - function SetCatId($CatId) - { - $this->CatId = $CatId; - } - - function CheckPermArray($Perm) - { - if (!isset($this->Allow[$Perm])) { - $this->Allow[$Perm] = array(); - $this->Deny[$Perm] = array(); - } - } - - function AddAllow($Perm, $GroupId) - { - $this->CheckPermArray($Perm); - if (!in_array($GroupId, $this->Allow[$Perm])) { - array_push($this->Allow[$Perm], $GroupId); - $this->RemoveDeny($Perm, $GroupId); - } - } - - function AddDeny($Perm, $GroupId) - { - $this->CheckPermArray($Perm); - if (!in_array($GroupId, $this->Deny[$Perm])) { - array_push($this->Deny[$Perm], $GroupId); - $this->RemoveAllow($Perm, $GroupId); - } - } - - function RemoveDeny($Perm, $GroupId) - { - if (in_array($GroupId, $this->Deny[$Perm])) { - array_splice($this->Deny[$Perm], array_search($GroupId, $this->Deny[$Perm]), 1); - } - } - - function RemoveAllow($Perm, $GroupId) - { - if (in_array($GroupId, $this->Allow[$Perm])) { - array_splice($this->Allow[$Perm], array_search($GroupId, $this->Allow[$Perm]), 1); - } - } - - function GetInsertSQL() - { - $values = array(); - - $has_deny = array(); - - /*foreach ($this->Deny as $perm => $groups) { - if (count($groups) > 0) { - $values[] = '('.$this->CatId.', '.$perm.', "", "'.join(',', $groups).'")'; - $has_deny[] = $perm; - } - }*/ - - foreach ($this->Allow as $perm => $groups) { -// if (in_array($perm, $has_deny)) continue; - if (count($groups) > 0) { - $values[] = '(' .$this->CatId. ', ' .$perm. ', "' .join(',', $groups). '", "")'; - } - } - if (!$values) return ''; - $sql = 'INSERT INTO '.GetTablePrefix().'PermCache (CategoryId, PermId, ACL, DACL) VALUES '.join(',', $values); - return $sql; - } -} - -class clsCacheUpdater -{ - var $Stack; - var $iteration; - var $totalCats; - var $doneCats; - var $table; - - var $root_prefixes = Array(); - - /** - * Kernel Application - * - * @var kApplication - */ - var $Application = null; - /** - * Enter description here... - * - * @var kDBConnection - */ - var $Conn = null; - - function clsCacheUpdater($continuing=false) - { - $this->Application =& kApplication::Instance(); - $this->Conn =& $this->Application->GetADODBConnection(); - - foreach ($this->Application->ModuleInfo as $module_name => $module_info) { - $this->root_prefixes[ $module_info['RootCat'] ] = $module_info['Var']; - } - - $this->conn =& GetADODBConnection(); - $this->iteration = 0; - $this->table=$GLOBALS['objSession']->GetEditTable('permCacheUpdate'); - - if (!$continuing) { - $this->Stack =& new clsRecursionStack(); - $sql = 'DELETE FROM '.GetTablePrefix().'PermCache'; - $this->conn->Execute($sql); - $this->initData(); - } - else { - $this->getData(); -// $this->SetStack($data); - } - } - - function getDonePercent() - { - if(!$this->totalCats)return 0; - return intval( round( $this->doneCats / $this->totalCats * 100 ) ); - } - - function getData() - { - $sql='SELECT data FROM '.$this->table; - if( $rs = $this->conn->Execute($sql) ) - $tmp = unserialize($rs->fields['data']); - - $this->totalCats = isset($tmp['totalCats']) ? $tmp['totalCats'] : 0; - $this->doneCats = isset($tmp['doneCats']) ? $tmp['doneCats'] : 0; - if(isset($tmp['stack'])) - $this->Stack = $tmp['stack']; - else - $this->Stack = & new clsRecursionStack(); - - } - - function setData() - { - $tmp=Array - ( - 'totalCats' =>$this->totalCats, - 'doneCats' =>$this->doneCats, - 'stack' =>$this->Stack, - - ); - $sql='DELETE FROM '.$this->table; - $this->conn->Execute($sql); - $sql='INSERT '.$this->table.' SET data="'.addslashes(serialize($tmp)).'"'; - $this->conn->Execute($sql); - } - - function initData() - { - $this->clearData(); // drop table before starting anyway - - $sql = 'CREATE TABLE '.$this->table.'(data LONGTEXT)'; - $this->conn->Execute($sql); - - $sql='SELECT COUNT(*) as count FROM '.GetTablePrefix().'Category'; - if( $rs = $this->conn->Execute($sql) ) - $this->totalCats=$rs->fields['count']; - - $this->doneCats=0; - } - - function clearData() - { - $sql='DROP TABLE IF EXISTS '.$this->table; - $this->conn->Execute($sql); - } - - function DoTheJob() - { - $data = $this->Stack->Get(); - if ($data === false) { //If Stack is empty - $data['current_id'] = 0; - $data['title'] = Array(); - $data['named_path'] = Array(); - $data['category_template'] = ''; - $data['item_template'] = ''; - $this->Stack->Push($data); - } - - if (!isset($data['queried'])) { - - $this->QueryTitle($data); - $this->QueryChildren($data); - $this->QueryPermissions($data); - $data['queried'] = 1; - - if($sql = $data['perms']->GetInsertSQL()) - { - $this->conn->Execute($sql); - $this->doneCats++; - } - $this->iteration++; - } - - // start with first child if we haven't started yet - if (!isset($data['current_child'])) $data['current_child'] = 0; - - // if we have more children - if (isset($data['children'][$data['current_child']])) - { - $next_data = Array(); - $next_data['title'] = $data['title']; - $next_data['named_path'] = $data['named_path']; - $next_data['category_template'] = $data['category_template']; - $next_data['item_template'] = $data['item_template']; - $next_data['current_id'] = $data['children'][$data['current_child']]; //next iteration should process child - $next_data['perms'] = $data['perms']; //we should copy our permissions to child - inheritance - $next_data['perms']->SetCatId($next_data['current_id']); - $data['current_child']++; - $this->Stack->Update($data); //we need to update ourself for the iteration after the next (or further) return to next child - $this->Stack->Push($next_data); //next iteration should process this child - return true; - } - else { - $this->UpdateCachedPath($data); - $this->Stack->Pop(); //remove ourself from stack if we have finished all the childs (or there are none) - // we are getting here if we finished with current level, so check if it's first level - then bail out. - return $this->Stack->Count() > 0; - } - } - - function UpdateCachedPath(&$data) - { - $fields_hash = Array( 'CachedNavbar' => implode('>', $data['title']), - 'NamedParentPath' => implode('/', $data['named_path'] ), - 'CachedCategoryTemplate'=> $data['category_template'], - 'CachedItemTemplate' => $data['item_template'], - ); - - $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$data['current_id']); - } - - function QueryTitle(&$data) - { - $category_id = $data['current_id']; - - $sql = 'SELECT Name, Filename, CategoryTemplate, ItemTemplate - FROM '.GetTablePrefix().'Category - WHERE CategoryId = '.$category_id; - - $rs = $this->conn->Execute($sql); - - if ($rs && !$rs->EOF) - { - $data['title'][] = $rs->fields['Name']; - $data['named_path'][] = $rs->fields['Filename']; - - // it is one of the modules root category - $root_prefix = isset($this->root_prefixes[$category_id]) ? $this->root_prefixes[$category_id] : false; - if ($root_prefix) { - $fields_hash = Array(); - if (!$rs->fields['CategoryTemplate']) { - $rs->fields['CategoryTemplate'] = $this->Application->ConfigValue($root_prefix.'_CategoryTemplate'); - $fields_hash['CategoryTemplate'] = $rs->fields['CategoryTemplate']; - } - - if (!$rs->fields['ItemTemplate']) { - $rs->fields['ItemTemplate'] = $this->Application->ConfigValue($root_prefix.'_ItemTemplate'); - $fields_hash['ItemTemplate'] = $rs->fields['ItemTemplate']; - } - - $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$category_id); - } - - // if explicitly set, then use it; use parent template otherwise - if ($rs->fields['CategoryTemplate']) { - $data['category_template'] = $rs->fields['CategoryTemplate']; - } - - if ($rs->fields['ItemTemplate']) { - $data['item_template'] = $rs->fields['ItemTemplate']; - } - } - } - - function QueryChildren(&$data) - { - $sql = sprintf('SELECT CategoryId FROM '.GetTablePrefix().'Category WHERE ParentId = %s', - $data['current_id']); - $rs = $this->conn->Execute($sql); - - $data['children'] = Array(); - while ($rs && !$rs->EOF) - { - $data['children'][] = $rs->fields['CategoryId']; - $rs->MoveNext(); - } - } - - function QueryPermissions(&$data) - { - // don't search for section "view" permissions here :) - $sql = sprintf('SELECT ipc.PermissionConfigId, ip.GroupId, ip.PermissionValue FROM '.GetTablePrefix().'Permissions AS ip - LEFT JOIN '.GetTablePrefix().'PermissionConfig AS ipc - ON ipc.PermissionName = ip.Permission - WHERE (CatId = %s) AND (Permission LIKE "%%.VIEW") AND (ipc.PermissionConfigId IS NOT NULL)', - $data['current_id']); - $rs = $this->conn->Execute($sql); - - //create permissions array only if we don't have it yet (set by parent) - if (!isset($data['perms'])) { - $data['perms'] = new clsCachedPermissions($data['current_id']); - } - - while ($rs && !$rs->EOF) - { - if ($rs->fields['PermissionValue'] == 1) { - $data['perms']->AddAllow($rs->fields['PermissionConfigId'], $rs->fields['GroupId']); - } - else { - $data['perms']->AddDeny($rs->fields['PermissionConfigId'], $rs->fields['GroupId']); - } - $rs->MoveNext(); - } - } -} -?> \ No newline at end of file Index: trunk/admin/category/category_items.php =================================================================== diff -u -N --- trunk/admin/category/category_items.php (revision 4427) +++ trunk/admin/category/category_items.php (revision 0) @@ -1,54 +0,0 @@ -SourceTable = $objSession->GetEditTable("Category"); - - $application->SetVar('c_mode', 't'); - - // Multiedit init - $en = (int)$_GET['en']; - $objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable); - - $itemcount=$objEditItems->NumItems(); - $c = $objEditItems->GetItemByIndex($en); - - if ($itemcount > 1) { - $en_next = ($en + 1 == $itemcount) ? -1 : $en + 1; - $en_prev = ($en == 0) ? -1 : $en - 1; - } - - $TitleVerb = prompt_language('la_Text_Editing'); - - $envar = 'env='.BuildEnv().'&en='.$en; - $section = 'in-portal:editcategory_items'; - - $editing_category_title = $c->Get('Name') ? "'".$c->Get('Name')."'" : ''; - $title = $TitleVerb.' '.prompt_language('la_Text_Category').' '.$editing_category_title.' - '.prompt_language('la_tab_General'); - - //$saveURL = $admin."/browse.php"; - $saveURL = $admin.'/category/category_maint.php'; - $cancelURL = $admin.'/'.$objSession->GetVariable('ReturnScript'); - - //Display header - $sec = $objSections->GetSection($section); - - $additional_env = '&t=category/category_items&prefix=c'; - - $objCatToolBar = new clsToolBar(); - $objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","edit_submit('category','CatEditStatus','$saveURL',1,'$additional_env');","tool_select.gif"); - $objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('category','CatEditStatus','$cancelURL',2,'$additional_env');","tool_cancel.gif"); - - if (isset($en_prev) || isset($en_next)) { - $url = 'admin/index4_direct.php'; - $StatusField = 'CatEditStatus'; - $form = 'category'; - MultiEditButtons($objCatToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"), $additional_env,'la_PrevCategory','la_NextCategory'); - } - - define('REQUIRED_BASE_HREF', 1); - int_header($objCatToolBar,NULL,$title); -?> \ No newline at end of file Index: trunk/kernel/units/users/users_event_handler.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6093) +++ trunk/kernel/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6428) @@ -121,7 +121,9 @@ if ($this->Application->IsAdmin() && ($login_value == 'root')) { // logging in "root" (admin only) $root_password = $this->Application->ConfigValue('RootPass'); - if ($root_password != md5($password)) { + $password_formatter =& $this->Application->recallObject('kPasswordFormatter'); + $test = $password_formatter->EncryptPassword($password, 'b38'); + if ($root_password != $test) { $object->SetError('ValidateLogin', 'invalid_password', 'lu_invalid_password'); $event->status = erFAIL; return false; Index: trunk/core/kernel/parser/template_parser.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/kernel/parser/template_parser.php (.../template_parser.php) (revision 6093) +++ trunk/core/kernel/parser/template_parser.php (.../template_parser.php) (revision 6428) @@ -429,6 +429,7 @@ } if ( !$this->GetParam('from_inportal') && strpos($output, 'Application->recallObject('Inp1Parser'); +// $name = $this->Application->TemplatesCache->GetTemplateFileName($name) . '-block:' . $name; // may be is needed (by Alex) $output = $inp1_parser->Parse($name, $output); } return $output; Index: trunk/kernel/units/general/helpers/mod_rewrite_helper.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 6093) +++ trunk/kernel/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 6428) @@ -34,7 +34,7 @@ $res = true; } - $this->Application->VerifyLanguageId(); +// $this->Application->VerifyLanguageId(); if (!$res) { array_unshift($url_parts, $url_part); } @@ -54,7 +54,7 @@ $vars['m_theme'] = $theme_id; $res = true; } - $this->Application->VerifyThemeId(); // verify anyway - will set default if not found!!! +// $this->Application->VerifyThemeId(); // verify anyway - will set default if not found!!! if (!$res) { array_unshift($url_parts, $url_part); } @@ -98,6 +98,20 @@ return $res; } + function ProcessPage(&$url_parts, &$vars) + { + if (!is_numeric($url_parts[0]) || count($url_parts) > 1) return false; + + // set module pages for all modules, since we don't know which module will need it + foreach ($this->Application->ModuleInfo as $module_name => $module_data) + { + $vars[ $module_data['Var'].'_id'] = 0; + $vars[ $module_data['Var'].'_Page'] = $url_parts[0]; + $vars[ $module_data['Var'].'_Reviews_Page'] = 0; + } + return true; + } + function ProcessModuleIndex(&$url_parts, &$vars) { if ( count($url_parts) > 1) return false; // if no more parts or only 1 part left @@ -107,14 +121,7 @@ if( $url_parts ) { // if parts are left, it can only be module page if (!is_numeric($url_parts[0])) return false; - - // set module pages for all modules, since we don't know which module will need it - foreach ($this->Application->ModuleInfo as $module_name => $module_data) - { - $vars[ $module_data['Var'].'_id'] = 0; - $vars[ $module_data['Var'].'_Page'] = $url_parts[0]; - $vars[ $module_data['Var'].'_Reviews_Page'] = 0; - } + $this->ProcessPage($url_parts, $vars); } // try to find CMS index page of the category @@ -279,7 +286,7 @@ */ function ProcessVirtualTemplate(&$url_parts, &$vars) { - if (!isset($url_parts[0]) || !$this->Application->isModuleEnabled('In-CMS')) return false; + if (!isset($url_parts[0]) || !$this->Application->isModuleEnabled('In-Edit')) return false; $template_path = implode('/', $url_parts); $sql = 'SELECT p.PageId, ci.CategoryId FROM '.TABLE_PREFIX.'Pages AS p @@ -326,15 +333,15 @@ { $this->HTTPQuery->Set($name,$value); } - if ($restored) { +// if ($restored) { $this->InitAll(); - } +// } $this->HTTPQuery->finalizeParsing($passed); } function InitAll() { - $this->Application->Phrases = new PhrasesCache(); +// $this->Application->Phrases = new PhrasesCache(); $this->Application->VerifyLanguageId(); $this->Application->Phrases->Init('phrases'); $this->Application->VerifyThemeId(); @@ -380,8 +387,6 @@ $this->ProcessCategory($url_parts, $vars); - - if ( $this->ProcessModuleIndex($url_parts, $vars) ) { foreach ($this->Application->ModuleInfo as $module_name => $info) { $passed[] = $info['Var']; @@ -423,11 +428,25 @@ } } + if ( $this->ProcessPage($url_parts, $vars) ) { + return $vars; + } + if ( $module_prefix = $this->ProcessModuleItem($url_parts, $vars, false) ) { $passed[] = $module_prefix; return $vars; } + if ( $this->Application->isModuleEnabled('In-Edit') && $this->Application->GetVar('admin') == 1) { + $adm_ses =& $this->Application->recallObject('Session.admin'); + $user = $adm_ses->RecallVar('user_id'); + $perm_helper =& $this->Application->recallObject('PermissionsHelper'); + if ($perm_helper->CheckUserPermission($user, 'PAGE.ADD', 0)) { + $vars['t'] = implode('/', $url_parts); + return $vars; + } + } + $not_found = $this->Application->ConfigValue('ErrorTemplate'); $vars['t'] = $not_found ? $not_found : 'error_notfound'; Index: trunk/kernel/units/admin/admin_config.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/units/admin/admin_config.php (.../admin_config.php) (revision 6093) +++ trunk/kernel/units/admin/admin_config.php (.../admin_config.php) (revision 6428) @@ -124,16 +124,6 @@ 'type' => stTREE, ), - /*'in-portal:service' => Array( - 'parent' => 'in-portal:tools', - 'icon' => 'conf_general', - 'label' => 'la_tab_Service', - 'url' => Array('t' => 'tools/system_tools', 'pass' => 'm'), - 'permissions' => Array('view'), - 'priority' => 10, - 'type' => stTREE, - ),*/ - 'in-portal:backup' => Array( 'parent' => 'in-portal:tools', 'icon' => 'tool_backup', @@ -198,4 +188,18 @@ ); + + $application =& kApplication::Instance(); + if ($application->isDebugMode()) { + $config['Sections']['in-portal:service'] = Array( + 'parent' => 'in-portal:tools', + 'icon' => 'conf_general', + 'label' => 'la_tab_Service', + 'url' => Array('t' => 'tools/system_tools', 'pass' => 'm'), + 'permissions' => Array('view'), + 'priority' => 10, + 'type' => stTREE, + ); + } + ?> \ No newline at end of file Index: trunk/core/kernel/db/dblist.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/kernel/db/dblist.php (.../dblist.php) (revision 6093) +++ trunk/core/kernel/db/dblist.php (.../dblist.php) (revision 6428) @@ -436,7 +436,7 @@ $fields = $this->getCalculatedFields($aggregated); if (is_array($fields) && count($fields) > 0) { foreach ($fields as $field_name => $field_expression) { - $clause = preg_replace('/[,` ]{1}'.$field_name.'[` ]{1}/', $field_expression, $clause); + $clause = preg_replace('/[,` ]{1}'.$field_name.'[` ]{1}/', ' '.$field_expression.' ', $clause); } } return $clause; Index: trunk/kernel/admin/include/toolbar/editcategory_relationselect.php =================================================================== diff -u -N --- trunk/kernel/admin/include/toolbar/editcategory_relationselect.php (revision 6093) +++ trunk/kernel/admin/include/toolbar/editcategory_relationselect.php (revision 0) @@ -1,799 +0,0 @@ -Get("CatTab_Hide"); - -$CategoryView = $objConfig->Get("Category_View"); -if(!is_numeric($CategoryView)) -{ - $CategoryView = 127; -} - -$Category_Sortfield = $objConfig->Get("Category_Sortfield"); -if(!strlen($Category_Sortfield)) - $Category_Sortfield = "Name"; - -$Category_Sortorder = $objConfig->Get("Category_Sortorder"); -if(!strlen($Category_Sortorder)) - $Category_Sortorder = "desc"; - -$Perpage_Category = (int)$objConfig->Get("Perpage_Category"); -if(!$Perpage_Category) - $Perpage_Category="'all'"; - - -if($CategoryView == 127) -{ - $Category_ShowAll = 1; -} -else -{ - $Category_ShowAll=0; - $Status = array(); - $Mod = array(); - if($CategoryView & $Bit_Pending) - $Status[] = STATUS_PENDING; - - if($CategoryView & $Bit_Active) - $Status[] = STATUS_ACTIVE; - - - if($CategoryView & $Bit_Disabled) - $Status[] = STATUS_DISABLED; - - if(count($Status)) - { - $CategoryFilter .= " AND (Status IN (".implode(",",$Status).") "; - } - else - $CategoryFilter .= " AND ((Status=-1) "; - - if($CategoryView & $Bit_Ed) - { - $CategoryFilter .= " OR (EditorsPick=1) "; - } - - if($CategoryView & $Bit_New) - { - $cutoff = adodb_date("U") - ($objConfig->Get("Category_DaysNew") * 86400); - $CategoryFilter .= " OR (CreatedOn > ".$cutoff.") "; - } - $CategoryFilter .= ")"; -} - -$list = $objSession->GetVariable("SearchWord"); -if(strlen($list)) -{ - $CatScope = $objSession->GetVariable("SearchScope"); - switch($CatScope) - { - case 0 : - $CatScopeClause = ""; - break; - case 1: - $cat = $objCatList->CurrentCategoryID(); - if($cat>0) - { - $allcats = $objCatList->AllSubCats($cat); - if(count($allcats)>0) - { - $catlist = implode(",",$allcats); - $CatScopeClause = " CategoryId IN ($catlist) "; - } - } - break; - case 2: - $CatScopeClause = "CategoryId=".$objCatList->CurrentCategoryID(); - break; - } -} -else - $CatScopeClause=""; - -$mnuClearSearch = language("la_SearchMenu_Clear"); -$mnuNewSearch = language("la_SearchMenu_New"); -$mnuSearchCategory = language("la_SearchMenu_Categories"); - -$lang_New = language("la_Text_New"); -$lang_Hot = language("la_Text_Hot"); -$lang_EdPick = language("la_prompt_EditorsPick"); -$lang_Pop = language("la_Text_Pop"); - -$lang_Rating = language("la_prompt_Rating"); -$lang_Hits = language("la_prompt_Hits"); -$lang_Votes = language("la_prompt_Votes"); -$lang_Name = language("la_prompt_Name"); - -$lang_Categories = language("la_ItemTab_Categories"); -$lang_Description = language("la_prompt_Description"); -$lang_MetaKeywords = language("la_prompt_MetaKeywords"); -$lang_SubSearch = language("la_prompt_SubSearch"); -$lang_Within = language("la_Text_Within"); -$lang_Current = language("la_Text_Current"); -$lang_Active = language("la_Text_Active"); -$lang_SubCats = language("la_Text_SubCats"); -$lang_SubItems = language("la_Text_Subitems"); - -$selector = isset($_GET['Selector']) ? '&Selector='.$_GET['Selector'] : ''; -$destform = GetVar('destform'); -print << -var Category_Sortfield = '$Category_Sortfield'; -var Category_Sortorder = '$Category_Sortorder'; -var Category_Perpage = $Perpage_Category; -var Category_ShowAll = $Category_ShowAll; -var CategoryView = $CategoryView; -var default_tab = "$DefaultTab"; - -//JS Language variables -var lang_New = "$lang_New"; -var lang_Hot = "$lang_Hot"; -var lang_EdPick = "$lang_EdPick"; - -var lang_Pop = "$lang_Pop"; -var lang_Rating = "$lang_Rating"; -var lang_Hits = "$lang_Hits"; -var lang_Votes = "$lang_Votes"; -var lang_Name = "$lang_Name"; -var lang_Categories = "$lang_Categories"; -var lang_Description = "$lang_Description"; -var lang_MetaKeywords = "$lang_MetaKeywords"; -var lang_SubSearch = "$lang_SubSearch"; -var lang_Within="$lang_Within"; -var lang_Current = "$lang_Current"; -var lang_Active = "$lang_Active"; -var lang_SubCats = "$lang_SubCats"; -var lang_SubItems = "$lang_SubItems"; - -var m_tab_CatTab_hide = $m_tab_CatTab_Hide; -var hostname = '$rootURL'; -var env = '$envar'; -var actionlist = new Array(); -var homeURL = "$homeURL$selector&destform=$destform"; -var upURL = "$upURL$selector&destform=$destform"; -var Categories_Paste = false; - - // K4 code for handling toolbar operations: begin - var \$TabRegistry = Array(); - - function InpGrid(tab) - { - this.TabId = tab; - } - - InpGrid.prototype.ClearSelection = function(force,called_from) - { - unselectAll(this.TabId, 1); //1 means don't upate toolbar - } - - function registerTab(\$tab_id) - { - var \$tab = document.getElementById(\$tab_id); - var \$index = \$TabRegistry.length; - - \$TabRegistry[\$index] = new Array(); - \$TabRegistry[\$index]['tab_id'] = \$tab_id; - \$TabRegistry[\$index]['prefix_special'] = \$tab.getAttribute('PrefixSpecial'); - \$TabRegistry[\$index]['edit_template'] = \$tab.getAttribute('EditURL'); - } - - function queryTabRegistry(\$search_key, \$search_value, \$return_key) - { - var \$i = 0; - while(\$i < \$TabRegistry.length) - { - if(\$TabRegistry[\$i][\$search_key] == \$search_value) - { - return \$TabRegistry[\$i][\$return_key]; - break; - } - \$i++; - } - return '<'+\$search_key+'='+\$search_value+'>'; - } - - function k4_actionHandler(action, prefix_special) - { - var k4_action = ''; - switch (action) - { - case 'edit': - k4_action = 'edit_item("'+prefix_special+'")'; - break; - case 'delete': - k4_action = 'delete_items("'+prefix_special+'")'; - break; - case 'unselect': - k4_action = 'unselect("'+prefix_special+'")'; - break; - case 'approve': - k4_action = 'approve_items("'+prefix_special+'")'; - break; - case 'decline': - k4_action = 'decine_items("'+prefix_special+'")'; - break; - - case 'copy': - k4_action = 'copy_items("'+prefix_special+'")'; - break; - case 'cut': - k4_action = 'cut_items("'+prefix_special+'")'; - break; - case 'move_up': - k4_action = 'move_up("'+prefix_special+'")'; - break; - case 'move_down': - k4_action = 'move_down("'+prefix_special+'")'; - break; - } - - if (k4_action != '') - { - \$form_name = queryTabRegistry('prefix_special', prefix_special, 'tab_id') + '_form'; - eval(k4_action); - } - else alert(action+' not implemented'); - - } - - function approve_items(prefix_special) - { - set_hidden_field('remove_specials['+prefix_special+']',1); - submit_event(prefix_special,'OnMassApprove','') - } - - function decine_items(prefix_special) - { - set_hidden_field('remove_specials['+prefix_special+']',1); - submit_event(prefix_special,'OnMassDecline','') - } - - function edit() - { - edit_item( queryTabRegistry('tab_id', activeTab.id, 'prefix_special') ); - } - - function edit_item(prefix_special) - { - opener_action('d'); - set_hidden_field(prefix_special+'_mode', 't'); - submit_event(prefix_special, 'OnEdit', queryTabRegistry('prefix_special', prefix_special, 'edit_template'), '../../admin/index.php'); - } - - function delete_items(prefix_special) - { - set_hidden_field('remove_specials['+prefix_special+']',1); - submit_event(prefix_special,'OnMassDelete','') - } - - function copy_items(prefix_special) - { - submit_event(prefix_special,'OnCopy','') - } - - function cut_items(prefix_special) - { - submit_event(prefix_special,'OnCut','') - } - - function move_up(prefix_special) - { - submit_event(prefix_special,'OnMassMoveUp','') - } - - function move_down(prefix_special) - { - submit_event(prefix_special,'OnMassMoveDown','') - } - - function unselect(prefix_special) - { - Grids[prefix_special].ClearSelection(null,'Inp_AdvancedView.Unselect'); - } - // K4 code for handling toolbar operations: end - - function InitPage() - { - var main_form='kernel_form'; - if('$destform') main_form='$destform'; - addCommonActions(main_form); - initToolbar('mainToolBar', actionHandler); - initCheckBoxes(); - //toggleMenu(); - } - - function AddButtonAction(actionname,actionval) - { - var item = new Array(actionname,actionval); - actionlist[actionlist.length] = item; - } - - function actionHandler(button) - { - //alert('a button has been pressed!'); - for(i=0; i0) - path = path + '?'+attr; - - //alert(path); - window.location.href=path; - return true; - } - - function check_submit(main_form) - { - var formname = ''; - - if ((activeTab) && (!isAnyChecked('categories'))) - { - form_name = activeTab.id; - } - else - { - form_name = 'categories'; - } - var f = document.getElementsByName(form_name+'_form')[0]; - var bf = window.opener.document.getElementById(main_form); - - if(bf) - { - if(typeof(LastCheckedItem.value) != 'undefined') - { - try{ - item_id = LastCheckedItem.value; - item_type = LastCheckedItem.ItemType; - } - catch(err) - { - } - bf.TargetId.value = item_id; - bf.TargetType.value = item_type; - bf.submit(); - window.close(); - } - else { - theMainScript.Alert(lang_Selection_Empty); - } - } - } // check submit - - function flip_current(field_suffix) - { - if(activeTab) - { - field = activeTab.getAttribute("tabTitle")+field_suffix; - return flip(eval(field)); - } - } - - function config_current(field_suffix,value) - { - if(activeTab) - { - field = activeTab.getAttribute("tabTitle")+field_suffix; - config_val(field,value); - } - } - - function getSType(type,value) - { - f = document.getElementById("admin_search"); - if(f) - { - if (f.SearchType.value == type) return 2; else return 0; - } else return 0; - - } - - function getSScope(scope) - { - f = document.getElementById("admin_search"); - if(f) - { - if (f.SearchScope.value == scope) return 2; else return 0; - } else return 0; - - } - -// function setSearchMenu() -// { -// -// window.SearchMenu = new Menu("search"); -// SearchMenu.addMenuItem(lang_All,"SetSearchType('all');",getSType('all')); -// SearchMenu.addMenuSeparator() -// -// SearchMenu.addMenuItem(lang_Categories, "SetSearchType('categories');",getSType('categories')); -// param = ""; -// -// for (var i = 0; i < tabIDs.length; i++) -// { -// d = document.getElementById(tabIDs[i]); -// if(d) -// { -// tabname = d.getAttribute("tabTitle"); -// param = "SetSearchType('"+tabname+"');"; -// -// SearchMenu.addMenuItem(tabname,param,getSType(tabname)); -// } -// } -// -// SearchMenu.addMenuSeparator(); -// SearchMenu.addMenuItem(lang_All+' '+lang_Categories,"SetSearchScope('0');",getSScope(0)); -// SearchMenu.addMenuItem(lang_SubSearch,"ToggleNewSearch();",isNewSearch()); -// SearchMenu.addMenuItem(lang_Current+' '+lang_Categories,"SetSearchScope('2');",getSScope(2)); -// SearchMenu.addMenuItem(lang_Within+' '+lang_Categories,"SetSearchScope('1');",getSScope(1)); -// -// SearchMenu.addMenuSeparator(); -// -// window.SearchMenu.addMenuItem('$mnuClearSearch',"ClearSearch();",""); -// window.triedToWriteMenus = false; -// window.SearchMenu.writeMenus(); -// } - - function Category_SortMenu(caption) - { - menu_sorting = new Menu(caption); - - menu_sorting.addMenuItem(lang_Asc,"config_val('Category_Sortorder','asc');",RadioIsSelected(Category_Sortorder,'asc')); - menu_sorting.addMenuItem(lang_Desc,"config_val('Category_Sortorder','desc');",RadioIsSelected(Category_Sortorder,'desc')); - menu_sorting.addMenuSeparator(); - - menu_sorting.addMenuItem(lang_Default,"config_val('Category_Sortfield','Name');",""); - menu_sorting.addMenuItem(lang_Name,"config_val('Category_Sortfield','Name');",RadioIsSelected(Category_Sortfield,'Name')); - menu_sorting.addMenuItem(lang_Description,"config_val('Category_Sortfield','Description');",RadioIsSelected(Category_Sortfield,'Description')); - - menu_sorting.addMenuItem(lang_CreatedOn,"config_val('Category_Sortfield','CreatedOn');",RadioIsSelected(Category_Sortfield,'CreatedOn')); - menu_sorting.addMenuItem(lang_SubCats,"config_val('Category_Sortfield','CachedDescendantCatsQty');",RadioIsSelected(Category_Sortfield,'CachedDescendantCatsQty')); - menu_sorting.addMenuItem(lang_SubItems,"config_val('Category_Sortfield','SubItems');",RadioIsSelected(Category_Sortfield,'SubItems')); - - return menu_sorting; - - } - - - function Category_FilterMenu(caption) - { - menu_filter = new Menu(caption); - menu_filter.addMenuItem(lang_All,"config_val('Category_View', 127);",CategoryView==127); - menu_filter.addMenuSeparator(); - menu_filter.addMenuItem(lang_Active,"FlipBit('Category_View',CategoryView,6);",BitStatus(CategoryView,6)); - menu_filter.addMenuItem(lang_Pending,"FlipBit('Category_View',CategoryView,5);", BitStatus(CategoryView,5)); - menu_filter.addMenuItem(lang_Disabled,"FlipBit('Category_View',CategoryView,4);",BitStatus(CategoryView,4)); - - menu_filter.addMenuSeparator(); - menu_filter.addMenuItem(lang_New,"FlipBit('Category_View',CategoryView,3);",BitStatus(CategoryView,3)); - menu_filter.addMenuItem(lang_EdPick,"FlipBit('Category_View',CategoryView,0);",BitStatus(CategoryView,0)); - - return menu_filter; - } - - function toggleMenu() - { - //var tab_title = GetTabTitle(activeTab.id); - //alert(tab_title); - if ((document.getElementById('categories').active) && (activeTab)) - { - filterfunc = activeTab.getAttribute("tabTitle")+'_FilterMenu();'; - - window.cat_menu_filter_sub = Category_FilterMenu(lang_Categories); - window.sub_menu_filter_sub = eval(filterfunc); - - window.cat_menu_filter = new Menu(lang_View); - cat_menu_filter.addMenuItem(cat_menu_filter_sub); - cat_menu_filter.addMenuItem(sub_menu_filter_sub); - } - else - { - if (document.getElementById('categories').active) - { - window.cat_menu_filter = Category_FilterMenu(lang_View); - } - if (activeTab) - { - filterfunc = activeTab.getAttribute("tabTitle")+'_FilterMenu();'; - window.cat_menu_filter = eval(filterfunc); - } - } // Filter - - //Sorting - if ((document.getElementById('categories').active) && (activeTab)) - { - //Sort->Categories - sortfunc = activeTab.getAttribute("tabTitle")+'_SortMenu();'; - - window.cat_menu_sorting_sub = Category_SortMenu(lang_Categories); - window.sub_menu_sorting_sub = eval(sortfunc); - - window.cat_menu_sorting = new Menu(lang_Sort); - cat_menu_sorting.addMenuItem(cat_menu_sorting_sub); - cat_menu_sorting.addMenuItem(sub_menu_sorting_sub); - } - else - { - if (document.getElementById('categories').active) - { - window.cat_menu_sorting = Category_SortMenu(lang_Sort); - - } // categories - if (activeTab) - { - window.cat_menu_sorting = Category_SortMenu(lang_Sort); - } - - } // && Sorting - if ((document.getElementById('categories').active) && (activeTab)) - { - window.cat_menu_select_sub = new Menu(lang_Categories); - cat_menu_select_sub.addMenuItem(lang_All,"javascript:selectAll('categories');",""); - cat_menu_select_sub.addMenuItem(lang_Unselect,"javascript:unselectAll('categories');",""); - cat_menu_select_sub.addMenuItem(lang_Invert,"javascript:invert('categories');",""); - - selectfunc = activeTab.getAttribute("tabTitle")+"_SelectMenu();"; - - window.sub_menu_select_sub = eval(selectfunc); -// sub_menu_select_sub.addMenuItem(lang_All,"javascript:selectAll('"+activeTab.id+"');",""); -// sub_menu_select_sub.addMenuItem(lang_Unselect,"javascript:unselectAll('"+activeTab.id+"');",""); -// sub_menu_select_sub.addMenuItem(lang_Invert,"javascript:invert('"+activeTab.id+"');",""); - -END; -if (!$hideSelectAll) { -echo " - window.cat_menu_select = new Menu(lang_Select); - cat_menu_select.addMenuItem(cat_menu_select_sub); - cat_menu_select.addMenuItem(sub_menu_select_sub);"; -} -print << - -END; -?> Index: trunk/kernel/admin/include/toolbar/editcategory_relations.php =================================================================== diff -u -N --- trunk/kernel/admin/include/toolbar/editcategory_relations.php (revision 1566) +++ trunk/kernel/admin/include/toolbar/editcategory_relations.php (revision 0) @@ -1,32 +0,0 @@ - - - - -END; -?> Index: trunk/admin/install/upgrades/inportal_upgrade_v1.3.0.sql =================================================================== diff -u -N --- trunk/admin/install/upgrades/inportal_upgrade_v1.3.0.sql (revision 0) +++ trunk/admin/install/upgrades/inportal_upgrade_v1.3.0.sql (revision 6428) @@ -0,0 +1,3 @@ +UPDATE ConfigurationValues SET VariableValue = MD5(CONCAT(VariableValue, 'b38')) WHERE VariableName = 'RootPass'; + +UPDATE Modules SET Version = '1.3.0' WHERE Name = 'In-Portal'; \ No newline at end of file Index: trunk/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6093) +++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6428) @@ -376,8 +376,6 @@ $excepts_and_filter_h =& $this->Application->makeClass('kMultipleFilter'); $excepts_and_filter_h->setType(FLT_TYPE_AND); - $except_types_array = explode(',', $types); - if ($types) { $types_array = explode(',', $types); for ($i = 0; $i < sizeof($types_array); $i++) { @@ -681,10 +679,11 @@ $object =& $event->getObject(); $this->Application->SetVar($event->getPrefixSpecial().'_Page', 1); $lang = $this->Application->GetVar('m_lang'); - $product_table = $this->Application->getUnitOption('p', 'TableName'); + $items_table = $this->Application->getUnitOption($event->Prefix, 'TableName'); + $module_name = $this->Application->findModule('Var', $event->Prefix, 'Name'); $sql = ' SELECT * FROM '.$this->Application->getUnitOption('confs', 'TableName').' - WHERE ModuleName="In-Commerce" + WHERE ModuleName="'.$module_name.'" AND SimpleSearch=1'; $search_config = $this->Conn->Query($sql, 'FieldName'); $field_list = array_keys($search_config); @@ -699,7 +698,7 @@ $custom_fields = $this->Application->getUnitOption($event->Prefix, 'CustomFields'); if ($custom_fields) { $custom_table = $this->Application->getUnitOption($event->Prefix.'-cdata', 'TableName'); - $join_clauses[] = ' LEFT JOIN '.$custom_table.' custom_data ON '.$product_table.'.ResourceId = custom_data.ResourceId'; + $join_clauses[] = ' LEFT JOIN '.$custom_table.' custom_data ON '.$items_table.'.ResourceId = custom_data.ResourceId'; } // what field in search config becomes what field in sql (key - new field, value - old field (from searchconfig table)) @@ -740,17 +739,31 @@ } else { + $multi_lingual = false; + if ($exploded[0] == 'MULTI') + { + $multi_lingual = true; + $foreign_field = $exploded[1]; + } $exploded = explode('.', $foreign_field); // format: table.field_name $foreign_table = TABLE_PREFIX.$exploded[0]; $alias_counter++; $alias = 't'.$alias_counter; - $field_list[$key] = $alias.'.'.$exploded[1]; - $search_config_map[ $field_list[$key] ] = $field; + if ($multi_lingual) { + $field_list[$key] = $alias.'.'.'l'.$lang.'_'.$exploded[1]; + $field_list[$key.'_primary'] = 'l'.$this->Application->GetDefaultLanguageId().'_'.$field; + $search_config_map[ $field_list[$key] ] = $field; + $search_config_map[ $field_list[$key.'_primary'] ] = $field; + } + else { + $field_list[$key] = $alias.'.'.$exploded[1]; + $search_config_map[ $field_list[$key] ] = $field; + } $join_clause = str_replace('{ForeignTable}', $alias, $search_config[$field]['JoinClause']); - $join_clause = str_replace('{LocalTable}', $product_table, $join_clause); + $join_clause = str_replace('{LocalTable}', $items_table, $join_clause); $join_clauses[] = ' LEFT JOIN '.$foreign_table.' '.$alias.' ON '.$join_clause; @@ -771,20 +784,20 @@ $search_helper =& $this->Application->recallObject('SearchHelper'); $where_clause = $search_helper->buildWhereClause($keywords, $field_list); - $where_clause = $where_clause.' AND '.$product_table.'.Status=1'; + $where_clause = $where_clause.' AND '.$items_table.'.Status=1'; if($this->Application->GetVar('Action') == 'm_simple_subsearch') // subsearch, In-portal { if( $event->getEventParam('ResultIds') ) { - $where_clause .= ' AND '.$product_table.'.ResourceId IN ('.implode(',', $event->specificParams['ResultIds']).')'; + $where_clause .= ' AND '.$items_table.'.ResourceId IN ('.implode(',', $event->specificParams['ResultIds']).')'; } } if( $event->MasterEvent && $event->MasterEvent->Name == 'OnListBuild' ) // subsearch, k4 { if( $event->MasterEvent->getEventParam('ResultIds') ) { - $where_clause .= ' AND '.$product_table.'.ResourceId IN ('.implode(',', $event->MasterEvent->getEventParam('ResultIds')).')'; + $where_clause .= ' AND '.$items_table.'.ResourceId IN ('.implode(',', $event->MasterEvent->getEventParam('ResultIds')).')'; } } @@ -801,34 +814,45 @@ $revelance_parts[] = 'IF('.$field.' LIKE "%'.$keyword.'%", '.$weight.', 0)'; } } - $rel_keywords = $this->Application->ConfigValue('SearchRel_Keyword_products') / 100; - $rel_pop = $this->Application->ConfigValue('SearchRel_Pop_products') / 100; - $rel_rating = $this->Application->ConfigValue('SearchRel_Rating_products') / 100; + $conf_postfix = $this->Application->getUnitOption($event->Prefix, 'SearchConfigPostfix'); + $rel_keywords = $this->Application->ConfigValue('SearchRel_Keyword_'.$conf_postfix) / 100; + $rel_pop = $this->Application->ConfigValue('SearchRel_Pop_'.$conf_postfix) / 100; + $rel_rating = $this->Application->ConfigValue('SearchRel_Rating_'.$conf_postfix) / 100; $relevance_clause = '('.implode(' + ', $revelance_parts).') / '.$weight_sum.' * '.$rel_keywords; - $relevance_clause .= ' + (Hits + 1) / (MAX(Hits) + 1) * '.$rel_pop; - $relevance_clause .= ' + (CachedRating + 1) / (MAX(CachedRating) + 1) * '.$rel_rating; + if ($rel_pop && isset($object->Fields['Hits'])) { + $relevance_clause .= ' + (Hits + 1) / (MAX(Hits) + 1) * '.$rel_pop; + } + if ($rel_rating && isset($object->Fields['CachedRating'])) { + $relevance_clause .= ' + (CachedRating + 1) / (MAX(CachedRating) + 1) * '.$rel_rating; + } // building final search query - if (!$this->Application->GetVar('INPORTAL_ON')) { + if (!$this->Application->GetVar('do_not_drop_search_table') && !$this->Application->GetVar('INPORTAL_ON')) { $this->Conn->Query('DROP TABLE IF EXISTS '.$search_table); // erase old search table if clean k4 event + $this->Application->SetVar('do_not_drop_search_table', true); } - if ($this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"')) { + + $search_table_exists = $this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"'); + if ($search_table_exists) { $select_intro = 'INSERT INTO '.$search_table.' (Relevance, ItemId, ResourceId, ItemType, EdPick) '; } else { $select_intro = 'CREATE TABLE '.$search_table.' AS '; } + $edpick_clause = $this->Application->getUnitOption($event->Prefix.'.EditorsPick', 'Fields') ? $items_table.'.EditorsPick' : '0'; + + $sql = $select_intro.' SELECT '.$relevance_clause.' AS Relevance, - '.$product_table.'.ProductId AS ItemId, - '.$product_table.'.ResourceId, - 11 AS ItemType, - '.$product_table.'.EditorsPick AS EdPick + '.$items_table.'.'.$this->Application->getUnitOption($event->Prefix, 'IDField').' AS ItemId, + '.$items_table.'.ResourceId, + '.$this->Application->getUnitOption($event->Prefix, 'ItemType').' AS ItemType, + '.$edpick_clause.' AS EdPick FROM '.$object->TableName.' '.implode(' ', $join_clauses).' WHERE '.$where_clause.' - GROUP BY '.$product_table.'.ProductId'; + GROUP BY '.$items_table.'.'.$this->Application->getUnitOption($event->Prefix, 'IDField'); $res = $this->Conn->Query($sql); } @@ -1887,7 +1911,6 @@ } } } - } ?> \ No newline at end of file Index: trunk/core/kernel/utility/debugger.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/kernel/utility/debugger.php (.../debugger.php) (revision 6093) +++ trunk/core/kernel/utility/debugger.php (.../debugger.php) (revision 6428) @@ -244,14 +244,14 @@ $div_width['left'] = round((($total - $total_before - $runtime) / $total) * $total_width); $ret = 'Name: '.$Data['description'].'
'; - + if (isset($Data['file'])) { $ret .= '[Runtime: '.$runtime.'s] [File: '.$Data['file'].']
'; } else { $ret .= 'Runtime: '.$runtime.'s
'; } - + $ret .= '
'; $ret .= '
'; $ret .= '
'; @@ -310,7 +310,7 @@ function print_r(&$array, $return_output = false, $cut_first = -1, $cut_min_length = -1) { static $first_line = true, $tab_count = -1; - + if (is_null($array)) { return 'NULL'; }elseif (!is_array($array)) { @@ -319,15 +319,15 @@ } return $array; } - + $output = ''; - + $tab_count++; $output .= "Array\n".str_repeat(' ', $tab_count)."(\n"; - + $tab_count++; $tabsign = $tab_count ? str_repeat(' ', $tab_count) : ''; - + $array_keys = array_keys($array); foreach ($array_keys as $key) { @@ -348,11 +348,11 @@ } $output .= $tabsign.'['.$key.'] = '.$array[$key]."\n"; break; - + case 'NULL': $output .= $tabsign.'['.$key."] = NULL\n"; break; - + case 'object': $attribute_names = get_class_vars( get_class($array[$key]) ); if (!$attribute_names) { @@ -363,7 +363,7 @@ $output .= $tabsign.'['.$key.'] = SKIPPED (class: '.get_class($array[$key]).")\n"; break; } - + // $attribute_value - default value for this attribute, not used here foreach ($attribute_names as $attribute_name => $attribute_value) { if (is_object($array[$key]->$attribute_name)) { @@ -375,7 +375,7 @@ $output .= $tabsign.'['.$attribute_name.'] = SKIPPED (class: '.$object_class.")\n"; continue; } - + array_push($this->RecursionStack, $object_class); $output .= $this->print_r($array[$key]->$attribute_name, true, 50, 200); array_pop($this->RecursionStack); @@ -391,30 +391,30 @@ } } break; - + default: $output .= $tabsign.'['.$key.'] unknown = '.gettype($array[$key])."\n"; break; } } - + $tab_count--; $output .= str_repeat(' ', $tab_count).")\n"; - + if ($first_line) { $first_line = false; $output .= "\n"; } - + $tab_count--; - + if ($return_output) { return $output; } else { echo $output; } - + return true; } @@ -510,7 +510,7 @@ { $trace = debug_backtrace(); array_shift($trace); - + $this->Data[] = Array('trace' => $trace, 'debug_type' => 'trace'); } @@ -661,7 +661,7 @@ $this->ProfilerData[$key]['file'] = $trace_file.':'.$trace_results[$i]['line']; unset($trace_results); } - + $this->Data[] = Array('profile_key' => $key, 'debug_type' => 'profiler'); } @@ -751,7 +751,7 @@ // don't print same report twice (in case if shutdown function used + compression + fatal error) return ''; } - + $this->profileFinish('script_runtime'); $this->breakOutofBuffering(); @@ -766,12 +766,12 @@ // defined here, because user can define this contant while script is running, not event before debugger is started $this->safeDefine('DBG_RAISE_ON_WARNINGS', 0); $this->safeDefine('DBG_TOOLBAR_BUTTONS', 1); - + $this->appendSession(); // show php session if any // ensure, that 1st line of debug output always is this one: $top_line = '
[Reload Frame] [Hide Debugger][Current Time: '.date('H:i:s').'] [File Size: #DBG_FILESIZE#]
'; - + $this->appendHTML($top_line); $this->moveToBegin(1); @@ -822,14 +822,14 @@ $this->appendHTML('Grand Total: '.' Mem: '.sprintf("%.4f Kb", ($totals['mem']+$totals_configs['mem'])/1024).' Time: '.sprintf("%.4f", $totals['time']+$totals_configs['time'])); } }*/ - + $is_ajax = isset($_GET['ajax']) && $_GET['ajax'] == 'yes'; $skip_reporting = $this->constOn('DBG_SKIP_REPORTING') || $this->constOn('DBG_ZEND_PRESENT'); - + if ($is_ajax || !$skip_reporting) { $debug_file = $this->tempFolder.'/debug_'.$this->rowSeparator.'.txt'; if (file_exists($debug_file)) unlink($debug_file); - + $i = 0; $fp = fopen($debug_file, 'a'); $lineCount = count($this->Data); @@ -839,13 +839,13 @@ } fclose($fp); } - + if ($skip_reporting) { // let debugger write report and then don't output anything $this->reportDone = true; return ''; } - + ob_start(); ?> @@ -946,7 +946,7 @@ break; } } - + return '
'.$ret.'
'; } @@ -996,7 +996,7 @@ die( $this->breakOutofBuffering(false) . $this->printReport(true) ); } } - + function breakOutofBuffering($flush = true) { $buffer_content = Array(); Index: trunk/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 6093) +++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 6428) @@ -364,7 +364,14 @@ { $object = &$event->getObject(); $top_prefix = $this->Application->GetTopmostPrefix($event->Prefix); - return $this->Application->GetVar($top_prefix.'_mode') == 't'; + + return ( + $this->Application->GetVar(rtrim($top_prefix.'_'.$event->Special, '_')) == 't' + || + $this->Application->GetVar(rtrim($top_prefix.'.'.$event->Special, '.')) == 't' + || + $this->Application->GetVar($top_prefix.'_mode') == 't' + ); } /** @@ -1480,8 +1487,17 @@ if(!$field_type) $field_type = 'string'; // default LIKE filter for all fields without type $filter_value = ''; - $table_name = ($filter_type == 'where') ? '`'.$object->TableName.'`.' : ''; + if (preg_match('/(.*)\.(.*)/', $search_field, $regs)) { + $table_name = '`'.$regs[1].'`.'; + $search_field = $regs[2]; + } + elseif ($filter_type == 'where') { + $table_name = '`'.$object->TableName.'`.'; + } + + $table_name = ($filter_type == 'where') ? $table_name : ''; + // get field clause by formatter name and/or parameters $formatter = getArrayValue($object->Fields[$search_field],'formatter'); switch($formatter) Index: trunk/tools/debug_sample.php =================================================================== diff -u -N -r4940 -r6428 --- trunk/tools/debug_sample.php (.../debug_sample.php) (revision 4940) +++ trunk/tools/debug_sample.php (.../debug_sample.php) (revision 6428) @@ -1,60 +1,72 @@ '0', ?? - $params = array_merge($params, array('pass'=>'m,'.$this->Prefix)); - $item_id = getArrayValue($params,$this->Prefix.'_id'); + $params = array_merge($params, Array('pass' => 'm,'.$this->Prefix) ); + + $item_id = isset($params[$id_prefix.'_id']) && $params[$id_prefix.'_id']; if (!$item_id) { - $item_id = $this->Application->GetVar($this->Prefix.'_id'); + $item_id = $this->Application->GetVar($this->getPrefixSpecial().'_id'); + if (!$item_id) { + $item_id = $this->Application->GetVar($this->Prefix.'_id'); + } } $params[$this->Prefix.'_id'] = $item_id; - $item =& $this->Application->recallObject($this->getPrefixSpecial()); - $params['m_cat_id'] = $item->GetDBField('CategoryId'); + $object =& $this->getObject($params); + $params['m_cat_id'] = $object->GetDBField('CategoryId'); + $params['pass_category'] = 1; - $main_processor =& $this->Application->recallObject('m_TagProcessor'); - return $main_processor->T($params); + return $this->Application->ProcessParsedTag('m', 't', $params); } /** Index: trunk/kernel/admin_templates/incs/form_blocks.tpl =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 6093) +++ trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 6428) @@ -119,7 +119,7 @@ "> error"> - *:
+ *:
', '', 'popups/translator');" title=""> Index: trunk/kernel/admin/include/toolbar/browse.php =================================================================== diff -u -N --- trunk/kernel/admin/include/toolbar/browse.php (revision 6093) +++ trunk/kernel/admin/include/toolbar/browse.php (revision 0) @@ -1,942 +0,0 @@ -Get("CatTab_Hide"); - -$CategoryView = $objConfig->Get("Category_View"); -if(!is_numeric($CategoryView)) -{ - $CategoryView = 127; -} - -$Category_Sortfield = $objConfig->Get("Category_Sortfield"); -if(!strlen($Category_Sortfield)) - $Category_Sortfield = "Name"; - -$Category_Sortorder = $objConfig->Get("Category_Sortorder"); -if(!strlen($Category_Sortorder)) - $Category_Sortorder = "desc"; - -$Perpage_Category = (int)$objConfig->Get("Perpage_Category"); -if(!$Perpage_Category) - $Perpage_Category="'all'"; - - -if($CategoryView == 127) -{ - $Category_ShowAll = 1; -} -else -{ - $Category_ShowAll=0; - $Status = array(); - $Mod = array(); - if($CategoryView & $Bit_Pending) - $Status[] = STATUS_PENDING; - - if($CategoryView & $Bit_Active) - $Status[] = STATUS_ACTIVE; - - - if($CategoryView & $Bit_Disabled) - $Status[] = STATUS_DISABLED; - - if(count($Status)) - { - $CategoryFilter .= " AND (Status IN (".implode(",",$Status).") "; - } - else - $CategoryFilter .= " AND ((Status=-1) "; - - if($CategoryView & $Bit_Ed) - { - $CategoryFilter .= " OR (EditorsPick=1) "; - } - - if($CategoryView & $Bit_New) - { - $cutoff = adodb_date("U") - ($objConfig->Get("Category_DaysNew") * 86400); - $CategoryFilter .= " OR (CreatedOn > ".$cutoff.") "; - } - $CategoryFilter .= ")"; -} - -$list = $objSession->GetVariable("SearchWord"); -if(strlen($list)) -{ - $CatScope = $objSession->GetVariable("SearchScope"); - switch($CatScope) - { - case 0 : - $CatScopeClause = ""; - break; - case 1: - $cat = $objCatList->CurrentCategoryID(); - if($cat>0) - { - $allcats = $objCatList->AllSubCats($cat); - if(count($allcats)>0) - { - $catlist = implode(",",$allcats); - $CatScopeClause = " CategoryId IN ($catlist) "; - } - } - break; - case 2: - $CatScopeClause = "CategoryId=".$objCatList->CurrentCategoryID(); - break; - } -} -else - $CatScopeClause=""; - -$Cat_Paste = "false"; -if($objCatList->ItemsOnClipboard()>0) - $Cat_Paste = "true"; - -$CurrentCat = $objCatList->CurrentCategoryID(); -if($CurrentCat>0) -{ - $c = $objCatList->GetItem($CurrentCat); - $CurrentRes = (int)$c->Get("ResourceId"); -} -else - $CurrentRes =0; -$mnuClearSearch = language("la_SearchMenu_Clear"); -$mnuNewSearch = language("la_SearchMenu_New"); -$mnuSearchCategory = language("la_SearchMenu_Categories"); - -$lang_New = language("la_Text_New"); -$lang_Hot = language("la_Text_Hot"); -$lang_EdPick = language("la_prompt_EditorsPick"); -$lang_Pop = language("la_Text_Pop"); - -$lang_Rating = language("la_prompt_Rating"); -$lang_Hits = language("la_prompt_Hits"); -$lang_Votes = language("la_prompt_Votes"); -$lang_Name = language("la_prompt_Name"); - -$lang_Categories = language("la_ItemTab_Categories"); -$lang_Description = language("la_prompt_Description"); -$lang_MetaKeywords = language("la_prompt_MetaKeywords"); -$lang_SubSearch = language("la_prompt_SubSearch"); -$lang_Within = language("la_Text_Within"); -$lang_Current = language("la_Text_Current"); -$lang_Active = language("la_Text_Active"); -$lang_SubCats = language("la_Text_SubCats"); -$lang_SubItems = language("la_Text_Subitems"); - -// View, Sort, Select, Per Page -$lang_View = language('la_Text_View'); -$lang_Sort = language('la_Text_Sort'); -$lang_PerPage = language('la_prompt_PerPage'); -$lang_Select = language('la_Text_Select'); -$lang_InDevelopment = language('la_Text_InDevelopment'); - -print << -// global usage phrases -var lang_View = '$lang_View'; -var lang_Sort = '$lang_Sort'; -var lang_PerPage = '$lang_PerPage'; -var lang_Select = '$lang_Select'; - -// local usage phrases -var Category_Sortfield = '$Category_Sortfield'; -var Category_Sortorder = '$Category_Sortorder'; -var Category_Perpage = $Perpage_Category; -var Category_ShowAll = $Category_ShowAll; -var CategoryView = $CategoryView; -var default_tab = "$DefaultTab"; -var Categories_Paste = $Cat_Paste; -var CurrentCat = $CurrentCat; -var CurrentRes = $CurrentRes; - -PasteButton = PasteButton || Categories_Paste; - -//JS Language variables -var lang_New = "$lang_New"; -var lang_Hot = "$lang_Hot"; -var lang_EdPick = "$lang_EdPick"; - -var lang_Pop = "$lang_Pop"; -var lang_Rating = "$lang_Rating"; -var lang_Hits = "$lang_Hits"; -var lang_Votes = "$lang_Votes"; -var lang_Name = "$lang_Name"; -var lang_Categories = "$lang_Categories"; -var lang_Description = "$lang_Description"; -var lang_MetaKeywords = "$lang_MetaKeywords"; -var lang_SubSearch = "$lang_SubSearch"; -var lang_Within="$lang_Within"; -var lang_Current = "$lang_Current"; -var lang_Active = "$lang_Active"; -var lang_SubCats = "$lang_SubCats"; -var lang_SubItems = "$lang_SubItems"; -var lang_InDevelopment = "$lang_InDevelopment"; - -var m_tab_CatTab_hide = $m_tab_CatTab_Hide; -var hostname = '$rootURL'; -var env = '$envar'; -var actionlist = new Array(); -var homeURL = "$homeURL"; -var upURL = "$upURL"; - - - // K4 code for handling toolbar operations: begin - var \$TabRegistry = Array(); - - function InpGrid(tab) - { - this.TabId = tab; - } - - InpGrid.prototype.ClearSelection = function(force,called_from) - { - unselectAll(this.TabId, 1); //1 means don't upate toolbar - } - - function registerTab(\$tab_id) - { - var \$tab = document.getElementById(\$tab_id); - var \$index = \$TabRegistry.length; - - \$TabRegistry[\$index] = new Array(); - \$TabRegistry[\$index]['tab_id'] = \$tab_id; - \$TabRegistry[\$index]['prefix_special'] = \$tab.getAttribute('PrefixSpecial'); - \$TabRegistry[\$index]['edit_template'] = \$tab.getAttribute('EditURL'); - } - - function queryTabRegistry(\$search_key, \$search_value, \$return_key) - { - var \$i = 0; - while(\$i < \$TabRegistry.length) - { - if(\$TabRegistry[\$i][\$search_key] == \$search_value) - { - return \$TabRegistry[\$i][\$return_key]; - break; - } - \$i++; - } - return '<'+\$search_key+'='+\$search_value+'>'; - } - - function k4_actionHandler(action, prefix_special) - { - var k4_action = ''; - switch (action) - { - case 'edit': - k4_action = 'edit_item("'+prefix_special+'")'; - break; - case 'delete': - k4_action = 'delete_items("'+prefix_special+'")'; - break; - case 'unselect': - k4_action = 'unselect("'+prefix_special+'")'; - break; - - case 'approve': - k4_action = 'approve_items("'+prefix_special+'")'; - break; - case 'decline': - k4_action = 'decine_items("'+prefix_special+'")'; - break; - - case 'm_rebuild_cache': - k4_action = 'rebuild_cache("c")'; - break; - -// case 'import': -// k4_action = 'import_items("'+prefix_special+'")'; -// break; - - case 'export': - k4_action = 'export_items("'+prefix_special+'")'; - break; - - case 'copy': - k4_action = 'copy_items("'+prefix_special+'")'; - break; - case 'cut': - k4_action = 'cut_items("'+prefix_special+'")'; - break; - - case 'move_up': - k4_action = 'move_up("'+prefix_special+'")'; - break; - case 'move_down': - k4_action = 'move_down("'+prefix_special+'")'; - break; - } - - if (k4_action != '') - { - \$form_name = queryTabRegistry('prefix_special', prefix_special, 'tab_id') + '_form'; - eval(k4_action); - } - else alert(action+' not implemented'); - - } - - function approve_items(prefix_special) - { - set_hidden_field('remove_specials['+prefix_special+']',1); - submit_event(prefix_special,'OnMassApprove','') - } - - function decine_items(prefix_special) - { - set_hidden_field('remove_specials['+prefix_special+']',1); - submit_event(prefix_special,'OnMassDecline','') - } - -// function import_items(prefix_special) -// { -// set_hidden_field('remove_specials['+prefix_special+']',1); -// submit_event(prefix_special,'OnImport','') -// } - - function export_items(prefix_special) - { - set_hidden_field('remove_specials['+prefix_special+']',1); - submit_event(prefix_special,'OnExport','') - } - - function edit() - { - edit_item( queryTabRegistry('tab_id', activeTab.id, 'prefix_special') ); - } - - function edit_item(prefix_special) - { - opener_action('d'); - set_hidden_field(prefix_special+'_mode', 't'); - submit_event(prefix_special, 'OnEdit', queryTabRegistry('prefix_special', prefix_special, 'edit_template'), '../../admin/index.php'); - } - - function delete_items(prefix_special) - { - set_hidden_field('remove_specials['+prefix_special+']',1); - submit_event(prefix_special,'OnMassDelete','') - } - - function copy_items(prefix_special) - { - submit_event(prefix_special,'OnCopy','') - } - - function cut_items(prefix_special) - { - submit_event(prefix_special,'OnCut','') - } - - function move_up(prefix_special) - { - submit_event(prefix_special,'OnMassMoveUp','') - } - - function move_down(prefix_special) - { - submit_event(prefix_special,'OnMassMoveDown','') - } - - function unselect(prefix_special) - { - Grids[prefix_special].ClearSelection(null,'Inp_AdvancedView.Unselect'); - } - - function rebuild_cache(prefix_special) - { - submit_event(prefix_special,'OnRebuildCache','') - } - // K4 code for handling toolbar operations: end - - - - function InitPage() - { - addCommonActions(); - initToolbar('mainToolBar', actionHandler); - initCheckBoxes(); - //toggleMenu(); - } - - function AddButtonAction(action_name,action_value) - { - actionlist[actionlist.length] = new Array(action_name, action_value); - } - - function actionHandler(button) - { -// alert('a button has been pressed!'); - for(i=0; i0) - path = path + '?'+attr; - - window.location.href=path; - return true; - } - - function check_submit(page, actionValue) - { - if (actionValue.match(/delete$/)) - { - if (!theMainScript.Confirm(lang_DeleteConfirm)) return; - } - - var formname = ''; - var action_prefix =''; - - var isCategoryExport = activeTab && isAnyChecked('categories') && (actionValue == 'export'); - - // skip news & topics for export operations (not to raise js errors) - if ((actionValue == 'export') && (activeTab.getAttribute("PrefixSpecial") == 'n' || activeTab.getAttribute("PrefixSpecial") == 'bb')) { - alert(lang_InDevelopment); - return false; - } - - if (activeTab && (!isAnyChecked('categories') || isCategoryExport)) - { - form_name = activeTab.id; - action_prefix = activeTab.getAttribute("ActionPrefix"); - if (page.length == 0) page = activeTab.getAttribute("EditURL"); - - if (actionValue == 'export') { - save_selected_categories('export_categories'); - } - - if ( action_prefix.match("k4:(.*)") ) - { - act = RegExp.$1; - act = act.replace('$\$event$$', actionValue); - act = act.replace('$\$prefix$$', activeTab.getAttribute("PrefixSpecial") ); - eval(act); - return; - } - else if(actionValue == 'export') // || actionValue == 'import' - { - return k4_actionHandler(actionValue, activeTab.getAttribute("PrefixSpecial")); - } - } - else - { - form_name = 'categories'; - action_prefix = 'm_cat_'; - if (page.length == 0) page = "$admin" + '/category/addcategory'; - } - - var f = document.getElementsByName(form_name+'_form')[0]; - if(f) - { - if (actionValue.substring(0,2) == 'm_') - { - f.Action.value = actionValue; - } - else - { - f.Action.value = action_prefix + actionValue; - } - - f.action = '$rootURL' + page + '.php?'+ env; -// alert(f.name+ ' is submitting to '+ f.action + ' action=' + f.Action.value); - f.submit(); - } - } // check submit - - function save_selected_categories(field_name) - { - var result = ''; - var checkboxes = document.getElementsByName('catlist[]'); - - for (var i = 0; i < checkboxes.length; i++) - { - if (checkboxes[i].checked == true) - { - result += checkboxes[i].value + ','; - } - } - result = result.replace(/(.*),\$/, '\$1'); - if (activeTab) \$form_name = activeTab.id + '_form'; - set_hidden_field(field_name, result); - } - - function edit_current() - { - if(CurrentCat==0) - { - get_to_server('$adminURL/category/addcategory_permissions.php',env+'&item=0'); - } - else - get_to_server('$adminURL/category/addcategory.php',env+'&item=$CurrentRes'); - } - - function flip_current(field_suffix) - { - if(activeTab) - { - field = activeTab.getAttribute("tabTitle")+field_suffix; - return flip(eval(field)); - } - } - - function config_current(field_suffix,value) - { - if(activeTab) - { - field = activeTab.getAttribute("tabTitle")+field_suffix; - config_val(field,value); - } - } - - function getSType(type,value) - { - f = document.getElementById("admin_search"); - if(f) - { - if (f.SearchType.value == type) return 2; else return 0; - } else return 0; - - } - - function getSScope(scope) - { - f = document.getElementById("admin_search"); - if(f) - { - if (f.SearchScope.value == scope) return 2; else return 0; - } else return 0; - - } - - function setSearchMenu() - { - - window.SearchMenu = new Menu("search"); - SearchMenu.addMenuItem(lang_All,"SetSearchType('all');",getSType('all')); - SearchMenu.addMenuSeparator() - - SearchMenu.addMenuItem(lang_Categories, "SetSearchType('categories');",getSType('categories')); - param = ""; - - for (var i = 0; i < tabIDs.length; i++) - { - d = document.getElementById(tabIDs[i]); - if(d) - { - tabname = d.getAttribute("tabTitle"); - param = "SetSearchType('"+tabname+"');"; - - SearchMenu.addMenuItem(tabname,param,getSType(tabname)); - } - } - - SearchMenu.addMenuSeparator(); - SearchMenu.addMenuItem(lang_All+' '+lang_Categories,"SetSearchScope('0');",getSScope(0)); - SearchMenu.addMenuItem(lang_SubSearch,"ToggleNewSearch();",isNewSearch()); - SearchMenu.addMenuItem(lang_Current+' '+lang_Categories,"SetSearchScope('2');",getSScope(2)); - SearchMenu.addMenuItem(lang_Within+' '+lang_Categories,"SetSearchScope('1');",getSScope(1)); - - SearchMenu.addMenuSeparator(); - - window.SearchMenu.addMenuItem('$mnuClearSearch',"ClearSearch();",""); - window.triedToWriteMenus = false; - window.SearchMenu.writeMenus(); - } - - \$fw_menus['c_view_menu'] = function() - { - // filtering menu - \$Menus['c_filtring_menu'] = new Menu(lang_View); - \$Menus['c_filtring_menu'].addMenuItem(lang_All,"config_val('Category_View', 127);",CategoryView==127); - \$Menus['c_filtring_menu'].addMenuSeparator(); - \$Menus['c_filtring_menu'].addMenuItem(lang_Active,"FlipBit('Category_View',CategoryView,6);",BitStatus(CategoryView,6)); - \$Menus['c_filtring_menu'].addMenuItem(lang_Pending,"FlipBit('Category_View',CategoryView,5);", BitStatus(CategoryView,5)); - \$Menus['c_filtring_menu'].addMenuItem(lang_Disabled,"FlipBit('Category_View',CategoryView,4);",BitStatus(CategoryView,4)); - \$Menus['c_filtring_menu'].addMenuSeparator(); - \$Menus['c_filtring_menu'].addMenuItem(lang_New,"FlipBit('Category_View',CategoryView,3);",BitStatus(CategoryView,3)); - \$Menus['c_filtring_menu'].addMenuItem(lang_EdPick,"FlipBit('Category_View',CategoryView,0);",BitStatus(CategoryView,0)); - - // sorting menu - \$Menus['c_sorting_menu'] = new Menu(lang_Sort); - \$Menus['c_sorting_menu'].addMenuItem(lang_Asc,"config_val('Category_Sortorder','asc');",RadioIsSelected(Category_Sortorder,'asc')); - \$Menus['c_sorting_menu'].addMenuItem(lang_Desc,"config_val('Category_Sortorder','desc');",RadioIsSelected(Category_Sortorder,'desc')); - \$Menus['c_sorting_menu'].addMenuSeparator(); - \$Menus['c_sorting_menu'].addMenuItem(lang_Default,"config_val('Category_Sortfield','Name');",""); - \$Menus['c_sorting_menu'].addMenuItem(lang_Name,"config_val('Category_Sortfield','Name');",RadioIsSelected(Category_Sortfield,'Name')); - \$Menus['c_sorting_menu'].addMenuItem(lang_Description,"config_val('Category_Sortfield','Description');",RadioIsSelected(Category_Sortfield,'Description')); - \$Menus['c_sorting_menu'].addMenuItem(lang_CreatedOn,"config_val('Category_Sortfield','CreatedOn');",RadioIsSelected(Category_Sortfield,'CreatedOn')); - \$Menus['c_sorting_menu'].addMenuItem(lang_SubCats,"config_val('Category_Sortfield','CachedDescendantCatsQty');",RadioIsSelected(Category_Sortfield,'CachedDescendantCatsQty')); - - // perpage menu - - // select menu - \$Menus['c_select_menu'] = new Menu(lang_Select); - \$Menus['c_select_menu'].addMenuItem(lang_All,"javascript:selectAllC('categories');",""); - \$Menus['c_select_menu'].addMenuItem(lang_Unselect,"javascript:unselectAll('categories');",""); - \$Menus['c_select_menu'].addMenuItem(lang_Invert,"javascript:invert('categories');",""); - - // view menu - \$Menus['c_view_menu'] = new Menu(lang_Categories); - \$Menus['c_view_menu'].addMenuItem( \$Menus['c_filtring_menu'] ); - \$Menus['c_view_menu'].addMenuItem( \$Menus['c_sorting_menu'] ); - \$Menus['c_view_menu'].addMenuItem( \$Menus['c_select_menu'] ); - } - - function toggleMenu() - { - var \$ViewMenus = new Array(); - - // prepare categories menu - if (document.getElementById('categories').active) - { - \$fw_menus['c_view_menu'](); - \$ViewMenus.push('c'); - } - - if (activeTab) - { - var prefix_special = activeTab.getAttribute('PrefixSpecial'); - \$fw_menus[prefix_special+'_view_menu'](); - \$ViewMenus.push(prefix_special); - } - - if(\$ViewMenus.length == 1) - { - prefix_special = \$ViewMenus[\$ViewMenus.length-1]; - window.cat_menu = \$Menus[prefix_special+'_view_menu']; - } - else - { - window.cat_menu = new Menu('ViewMenu_mixed'); - - // merge menus into new one - for(var i in \$ViewMenus) - { - prefix_special = \$ViewMenus[i]; - window.cat_menu.addMenuItem( \$Menus[prefix_special+'_view_menu'] ); - } - } - - window.triedToWriteMenus = false; - window.cat_menu.writeMenus(); - } - -function toggleCategoriesA(tabHeader, instant) -{ - var categories = document.getElementById('categories'); - if (!categories) return; - toggleCategories(instant); - - tabHeader.setAttribute("background", '$imagesURL'+'/itemtabs/' + ((categories.active) ? "tab_active" : "tab_inactive") + ".gif") - var images = tabHeader.getElementsByTagName("IMG"); - if (images.length < 1) return; - images[0].src = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "divider_up" : "divider_dn") + ".gif"; -} - -function toggleCategoriesB(tabHeader, instant) -{ - var categories = document.getElementById('categories'); - if (!categories) return; - toggleCategories(instant); - var active_str = '$imagesURL'+'/itemtabs/' + (categories.active ? 'tab_active' : 'tab_inactive'); - SetBackground('l_cat', active_str + '_l.gif'); - SetBackground('m_cat', active_str + '.gif'); - SetBackground('m1_cat', active_str + '.gif'); - SetBackground('r_cat', active_str + '_r.gif'); - - var images = tabHeader.getElementsByTagName("IMG"); - if (images.length < 1) return; - images[0].src = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "divider_up" : "divider_dn") + ".gif"; -} - -function toggleTabA(tabId, atm) -{ - var hl = document.getElementById("hidden_line"); - var activeTabId; - - - if (activeTab) activeTabId = activeTab.id; - if (activeTabId == tabId) - { - var devider = document.getElementById("tabsDevider"); - devider.style.display = ""; - - unselectAll(tabId); - var tab = document.getElementById(tabId); - tab.active = false; - activeTab = null; - collapseTab = tab; - toolbar.setTab(null); - showTab(); - } - - else - { - if (activeTab) toggleTab(tabId, true) - else toggleTab(tabId, atm) - - if (hl) hl.style.display = "none"; - } - tab_hdr = document.getElementById('tab_headers'); - if (!tab_hdr) return; - for (var i = 0; i < tabIDs.length; i++) - { - var tabHeader; - TDs = tab_hdr.getElementsByTagName("TD"); - for (var j = 0; j < TDs.length; j++) - if (TDs[j].getAttribute("tabHeaderOf") == tabIDs[i]) - { - tabHeader = TDs[j]; - break; - } - if (!tabHeader) continue; - - var tab = document.getElementById(tabIDs[i]); - if (!tab) continue; - - tabHeader.setAttribute("background", "$imagesURL/itemtabs/" + ((tab.active) ? "tab_active" : "tab_inactive") + ".gif") - - var images = tabHeader.getElementsByTagName("IMG"); - if (images.length < 1) continue; - - images[0].src = "$imagesURL/itemtabs/" + ((tab.active) ? "divider_up" : "divider_dn") + ".gif"; - } -} - - function toggleTabB(tabId, atm) - { - var hl = document.getElementById("hidden_line"); - var activeTabId; - - if (activeTab) activeTabId = activeTab.id; - if (activeTabId == tabId) - { - var devider = document.getElementById("tabsDevider"); - devider.style.display = ""; - - unselectAll(tabId); - var tab = document.getElementById(tabId); - tab.active = false; - activeTab = null; - collapseTab = tab; - toolbar.setTab(null); - showTab(); - } - else - { - if (activeTab) - toggleTab(tabId, true) - else - toggleTab(tabId, atm) - if (hl) hl.style.display = "none"; - } - tab_hdr = document.getElementById('tab_headers'); - if (!tab_hdr) return; - - // process all module tabs - var active_str = ''; - for(var i = 0; i < tabIDs.length; i++) - { - var tabHeader; - TDs = tab_hdr.getElementsByTagName("TD"); - for (var j = 0; j < TDs.length; j++) - if (TDs[j].getAttribute("tabHeaderOf") == tabIDs[i]) - { - tabHeader = TDs[j]; - break; - } - if (!tabHeader) continue; - - var tab = document.getElementById(tabIDs[i]); - if (!tab) continue; - active_str = (tab.active) ? "tab_active" : "tab_inactive"; - - if (TDs[j].getAttribute("tabHeaderOf") == tabId) { - // module tab is selected - SetBackground('l_' + tabId, "$imagesURL/itemtabs/" + active_str + "_l.gif"); - SetBackground('m_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif"); - SetBackground('m1_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif"); - SetBackground('r_' + tabId, "$imagesURL/itemtabs/" + active_str + "_r.gif"); - } - else - { - // module tab is not selected - SetBackground('l_' +tabIDs[i], "$imagesURL/itemtabs/" + active_str + "_l.gif"); - SetBackground('m_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + ".gif"); - SetBackground('m1_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + ".gif"); - SetBackground('r_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + "_r.gif"); - } - - var images = tabHeader.getElementsByTagName("IMG"); - if (images.length < 1) continue; - - images[0].src = "$imagesURL/itemtabs/" + ((tab.active) ? "divider_up" : "divider_dn") + ".gif"; - } - } - - function SetBackground(element_id, img_url) - { - // set background image of element specified by id - var el = document.getElementById(element_id); - el.style.backgroundImage = 'url('+img_url+')'; - } - - -END; -?> Index: trunk/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 6093) +++ trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 6428) @@ -190,6 +190,8 @@ } unset($params['cat_id']); + $params['pass_category'] = 1; + $main_processor =& $this->Application->recallObject('m_TagProcessor'); return $main_processor->T($params); } Index: trunk/kernel/include/modules.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/include/modules.php (.../modules.php) (revision 6093) +++ trunk/kernel/include/modules.php (.../modules.php) (revision 6428) @@ -4,9 +4,13 @@ */ $ado =& GetADODBConnection(); -$session_cookie_name = $ado->GetOne('SELECT VariableValue FROM '.$g_TablePrefix.'ConfigurationValues WHERE VariableName = "SessionCookieName"'); -define('SESSION_COOKIE_NAME', $session_cookie_name ? $session_cookie_name : 'sid'); +$application =& kApplication::Instance(); +define('SESSION_COOKIE_NAME', $application->Session->CookieName); + +/*$session_cookie_name = $ado->GetOne('SELECT VariableValue FROM '.$g_TablePrefix.'ConfigurationValues WHERE VariableName = "SessionCookieName"'); +define('SESSION_COOKIE_NAME', $session_cookie_name ? $session_cookie_name : 'sid'); +*/ set_cookie('cookies_on', '1', adodb_mktime() + 31104000); // if branches that uses if($mod_prefix) or like that will never be executed @@ -222,6 +226,15 @@ if ( substr($t, 0, strlen('kernel4:') ) == 'kernel4:' ) $t = substr($t, strlen('kernel4:') ); $url_params = Array('t' => $t); + // sicne 1.3.0 the category is not passed by default when mod_rewrite is on + // enable pass category for module templates (they usually need it) and suggest_cat. + // platform templates usually do not need category + if ( + preg_match('/^inlink|^inbulletin|^innews/', $t) || + in_array(preg_replace('/\.tpl$/', '', $t), array('suggest_cat')) + ) { + $url_params['pass_category'] = 1; + } $app =& kApplication::Instance(); $app->SetVar('prefixes_passed', Array() ); @@ -339,72 +352,72 @@ function admin_login() { - global $objSession,$login_error, $objConfig,$g_Allow,$g_Deny; -// echo "
"; print_r($objSession); echo "
"; + global $objSession,$login_error, $objConfig,$g_Allow,$g_Deny; + // echo "
"; print_r($objSession); echo "
"; if( GetVar('help_usage') == 'install' ) return true; - $env_arr = explode('-', $_GET['env']); - $get_session_key = $env_arr[0]; - $admin_login = isset($_POST['adminlogin']) && $_POST['adminlogin']; - if(!$objSession->ValidSession() || ($objSession->GetSessionKey() != $get_session_key && !$admin_login)) { - if( isset($_GET['expired']) && ($_GET['expired'] == 1) ) - $login_error = admin_language("la_text_sess_expired"); + $env_arr = explode('-', $_GET['env']); + $get_session_key = $env_arr[0]; + $admin_login = isset($_POST['adminlogin']) && $_POST['adminlogin']; + if(!$objSession->ValidSession()) { // || ($objSession->GetSessionKey() != $get_session_key && !$admin_login) + if( isset($_GET['expired']) && ($_GET['expired'] == 1) ) + $login_error = admin_language("la_text_sess_expired"); - return FALSE; - //echo "Expired
"; - } + return FALSE; + //echo "Expired
"; + } if ($objSession->HasSystemPermission("ADMIN") == 1) - return TRUE; + return TRUE; - if(count($_POST)==0 || $_POST["adminlogin"]!=1) - return FALSE; - $login=$_POST["login"]; - $password = $_POST["password"]; + if(count($_POST)==0 || $_POST["adminlogin"]!=1) + return FALSE; + $login=$_POST["login"]; + $password = $_POST["password"]; - if (strlen($login) && strlen($password)) - { - if(!_IpAccess($_SERVER['REMOTE_ADDR'],$g_Allow,$g_Deny)) - { - $login_error = admin_language("la_text_address_denied"); - return FALSE; - } - $valid = $objSession->Login($login, md5($password)); - $hasperm = ($objSession->HasSystemPermission("ADMIN") == 1); - if (($login=="root" || $hasperm) && $valid) - { - if(_ValidateModules()) - { - return TRUE; - } - else - $login_error = "Missing or invalid In-Portal License"; - } - else - { - if(!$hasperm && $valid) - { - $login_error = admin_language("la_text_nopermissions"); - } - else - { - $login_error = admin_language("la_Text_Access_Denied"); - } - return FALSE; - } + if (strlen($login) && strlen($password)) + { + if(!_IpAccess($_SERVER['REMOTE_ADDR'],$g_Allow,$g_Deny)) + { + $login_error = admin_language("la_text_address_denied"); + return FALSE; + } + $valid = $objSession->Login($login, md5($password)); + $hasperm = ($objSession->HasSystemPermission("ADMIN") == 1); + if (($login=="root" || $hasperm) && $valid) + { + if(_ValidateModules()) + { + return TRUE; + } + else + $login_error = "Missing or invalid In-Portal License"; + } + else + { + if(!$hasperm && $valid) + { + $login_error = admin_language("la_text_nopermissions"); + } + else + { + $login_error = admin_language("la_Text_Access_Denied"); + } + return FALSE; + } } - else - { - if(!strlen($login)) - { - $login_error = admin_language("la_Text_Missing_Username"); - } - else - if(!strlen($password)) - $login_error = admin_language("la_Text_Missing_Password"); - return FALSE; - } + else + { + if(!strlen($login)) + { + $login_error = admin_language("la_Text_Missing_Username"); + } + else + if(!strlen($password)) + $login_error = admin_language("la_Text_Missing_Password"); + return FALSE; + } } @@ -813,8 +826,12 @@ $SessionQueryString = false; // by default assume, that SID is located in cookie if( !isset($FrontEnd) ) $FrontEnd = false; // if frontend not explicitly defined, than -if($FrontEnd != 1) + $SessionQueryString = $application->Session->NeedQueryString(); + + +/*if($FrontEnd != 1) { $SessionQueryString = true; +}*/ if (is_array($mod_prefix)) { ParseEnv(); @@ -834,26 +851,26 @@ if ( !isset($var_list['sid']) ) $var_list['sid'] = ''; if ( !isset($_GET['env']) ) $_GET['env'] = ''; -if(strlen($var_list["sid"])==0 && strlen($_GET["env"])>0 && $objConfig->Get("CookieSessions")==2) +if(strlen($var_list["sid"])==0 && strlen($_GET["env"])>0 && $objConfig->Get("CookieSessions")==smCOOKIES_ONLY) { - if(_IsSpider($_SERVER["HTTP_USER_AGENT"])) - { - $UseSession = FALSE; - } - else - { - /* switch user to GET session var */ - if (!$_COOKIE[SESSION_COOKIE_NAME]) { - $SessionQueryString = TRUE; - } - //else { - //$cg = '--code--'; - //} - $UseSession = TRUE; - } + if(_IsSpider($_SERVER["HTTP_USER_AGENT"])) + { + $UseSession = FALSE; + } + else + { + /* switch user to GET session var */ + if (!$_COOKIE[SESSION_COOKIE_NAME]) { + $SessionQueryString = TRUE; + } + //else { + //$cg = '--code--'; + //} + $UseSession = TRUE; + } } else { - $UseSession = TRUE; + $UseSession = TRUE; } if($var_list["sid"]=="_") @@ -864,7 +881,7 @@ if($Action == 'm_logout') { - $u = new clsUserSession($var_list['sid'] ,($SessionQueryString && $FrontEnd==1)); + $u = new clsUserSession($var_list['sid']); // ,($SessionQueryString && $FrontEnd==1) $application =& kApplication::Instance(); $application->HandleEvent( new kEvent('u:OnInpLogout') ); @@ -888,13 +905,13 @@ $HTTP_REFERER = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; -if ( ($CookieTest == 1) /*|| !strstr($HTTP_REFERER, $_SERVER['HTTP_HOST'].$objConfig->Get("Site_Path"))*/) { +/*if ( ($CookieTest == 1) ) { // || !strstr($HTTP_REFERER, $_SERVER['HTTP_HOST'].$objConfig->Get("Site_Path")) $SessionQueryString = FALSE; } if ($FrontEnd != 1) { $SessionQueryString = TRUE; -} +}*/ // SID detecting engine: end @@ -914,7 +931,7 @@ $objSession->SetThemeName($m_var_list["theme"]); if($objConfig->Get("CookieSessions")>0 && !$SessionQueryString && !headers_sent()) { - set_cookie(SESSION_COOKIE_NAME, $var_list['sid'], 0); +// set_cookie(SESSION_COOKIE_NAME, $var_list['sid'], 0); } //echo "New Session: ".$objSession->GetSessionKey()."
\n"; if(isset($_COOKIE["login"]) && $Action != "m_logout" && $FrontEnd==1) Index: trunk/kernel/admin_templates/incs/config_blocks.tpl =================================================================== diff -u -N -r5037 -r6428 --- trunk/kernel/admin_templates/incs/config_blocks.tpl (.../config_blocks.tpl) (revision 5037) +++ trunk/kernel/admin_templates/incs/config_blocks.tpl (.../config_blocks.tpl) (revision 6428) @@ -1,5 +1,5 @@ - " name="" value="" /> + " name="" value="" /> @@ -32,7 +32,7 @@ - + Index: trunk/core/kernel/session/session.php =================================================================== diff -u -N -r5219 -r6428 --- trunk/core/kernel/session/session.php (.../session.php) (revision 5219) +++ trunk/core/kernel/session/session.php (.../session.php) (revision 6428) @@ -412,13 +412,7 @@ function CheckIfCookiesAreOn() { // $this->CheckDuplicateCookies(); - if ($this->Mode == smGET_ONLY || - ( defined('INPORTAL_ENV') && - INPORTAL_ENV && - $this->Application->IsAdmin() - && - !$this->Application->GetVar('front')) - ) + if ($this->Mode == smGET_ONLY) { //we don't need to bother checking if we would not use it $this->CookiesEnabled = false; @@ -529,9 +523,6 @@ } } - if ($this->Application->GetVar('front')) { - $this->CookiesEnabled = false; - } $this->CachedSID = $sid; return $this->CachedSID; @@ -698,6 +689,7 @@ $last_env = $this->Application->BuildEnv($t, Array('m_opener' => 'u', '__URLENCODE__' => 1), 'all'); $last_template = basename($_SERVER['PHP_SELF']).'|'.substr($last_env, strlen(ENV_VAR_NAME) + 1); $this->StoreVar('last_template', $last_template); + $this->StoreVar('last_url', $_SERVER['REQUEST_URI']); $this->StoreVar('last_env', substr($this->Application->BuildEnv($t, Array('__URLENCODE__' => 1), 'all'), strlen(ENV_VAR_NAME)+1)); } Index: trunk/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 6093) +++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 6428) @@ -570,7 +570,10 @@ if( !$this->HasParam($params, 'no_special') ) $value = htmlspecialchars($value); if( getArrayValue($params,'checked' ) ) $value = ($value == ( isset($params['value']) ? $params['value'] : 1)) ? 'checked' : ''; - if( getArrayValue($params,'as_label') ) $value = $this->Application->Phrase($value); + if( isset($params['plus_or_as_label']) ) { + $value = substr($value, 0,1) == '+' ? substr($value, 1) : $this->Application->Phrase($value); + } + elseif( getArrayValue($params,'as_label') ) $value = $this->Application->Phrase($value); $first_chars = $this->SelectParam($params,'first_chars,cut_first'); if($first_chars) @@ -668,6 +671,13 @@ $field = $params['field']; $object =& $this->getObject($params);; + $formatter_class = getArrayValue($object->Fields, $field, 'formatter'); + if ($formatter_class == 'kMultiLanguage') + { + $formatter =& $this->Application->recallObject($formatter_class); + $field = $formatter->LangFieldName($field); + } + $options = $object->GetFieldOptions($field); return getArrayValue($options,'required'); } @@ -1252,6 +1262,7 @@ break; default: + return $object->GetField($info_type); break; } } @@ -1557,7 +1568,7 @@ function DisplayOriginal($params) { return false; - } + } function MultipleEditing($params) { @@ -1572,9 +1583,10 @@ $ret .= $this->Application->ParseBlock($params); } } - + return $ret; } + } ?> \ No newline at end of file Index: trunk/core/units/general/helpers/mod_rewrite_helper.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 6093) +++ trunk/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 6428) @@ -34,7 +34,7 @@ $res = true; } - $this->Application->VerifyLanguageId(); +// $this->Application->VerifyLanguageId(); if (!$res) { array_unshift($url_parts, $url_part); } @@ -54,7 +54,7 @@ $vars['m_theme'] = $theme_id; $res = true; } - $this->Application->VerifyThemeId(); // verify anyway - will set default if not found!!! +// $this->Application->VerifyThemeId(); // verify anyway - will set default if not found!!! if (!$res) { array_unshift($url_parts, $url_part); } @@ -98,6 +98,20 @@ return $res; } + function ProcessPage(&$url_parts, &$vars) + { + if (!is_numeric($url_parts[0]) || count($url_parts) > 1) return false; + + // set module pages for all modules, since we don't know which module will need it + foreach ($this->Application->ModuleInfo as $module_name => $module_data) + { + $vars[ $module_data['Var'].'_id'] = 0; + $vars[ $module_data['Var'].'_Page'] = $url_parts[0]; + $vars[ $module_data['Var'].'_Reviews_Page'] = 0; + } + return true; + } + function ProcessModuleIndex(&$url_parts, &$vars) { if ( count($url_parts) > 1) return false; // if no more parts or only 1 part left @@ -107,14 +121,7 @@ if( $url_parts ) { // if parts are left, it can only be module page if (!is_numeric($url_parts[0])) return false; - - // set module pages for all modules, since we don't know which module will need it - foreach ($this->Application->ModuleInfo as $module_name => $module_data) - { - $vars[ $module_data['Var'].'_id'] = 0; - $vars[ $module_data['Var'].'_Page'] = $url_parts[0]; - $vars[ $module_data['Var'].'_Reviews_Page'] = 0; - } + $this->ProcessPage($url_parts, $vars); } // try to find CMS index page of the category @@ -279,7 +286,7 @@ */ function ProcessVirtualTemplate(&$url_parts, &$vars) { - if (!isset($url_parts[0]) || !$this->Application->isModuleEnabled('In-CMS')) return false; + if (!isset($url_parts[0]) || !$this->Application->isModuleEnabled('In-Edit')) return false; $template_path = implode('/', $url_parts); $sql = 'SELECT p.PageId, ci.CategoryId FROM '.TABLE_PREFIX.'Pages AS p @@ -326,15 +333,15 @@ { $this->HTTPQuery->Set($name,$value); } - if ($restored) { +// if ($restored) { $this->InitAll(); - } +// } $this->HTTPQuery->finalizeParsing($passed); } function InitAll() { - $this->Application->Phrases = new PhrasesCache(); +// $this->Application->Phrases = new PhrasesCache(); $this->Application->VerifyLanguageId(); $this->Application->Phrases->Init('phrases'); $this->Application->VerifyThemeId(); @@ -380,8 +387,6 @@ $this->ProcessCategory($url_parts, $vars); - - if ( $this->ProcessModuleIndex($url_parts, $vars) ) { foreach ($this->Application->ModuleInfo as $module_name => $info) { $passed[] = $info['Var']; @@ -423,11 +428,25 @@ } } + if ( $this->ProcessPage($url_parts, $vars) ) { + return $vars; + } + if ( $module_prefix = $this->ProcessModuleItem($url_parts, $vars, false) ) { $passed[] = $module_prefix; return $vars; } + if ( $this->Application->isModuleEnabled('In-Edit') && $this->Application->GetVar('admin') == 1) { + $adm_ses =& $this->Application->recallObject('Session.admin'); + $user = $adm_ses->RecallVar('user_id'); + $perm_helper =& $this->Application->recallObject('PermissionsHelper'); + if ($perm_helper->CheckUserPermission($user, 'PAGE.ADD', 0)) { + $vars['t'] = implode('/', $url_parts); + return $vars; + } + } + $not_found = $this->Application->ConfigValue('ErrorTemplate'); $vars['t'] = $not_found ? $not_found : 'error_notfound'; Index: trunk/kernel/admin/include/toolbar/advanced_view.php =================================================================== diff -u -N --- trunk/kernel/admin/include/toolbar/advanced_view.php (revision 6093) +++ trunk/kernel/admin/include/toolbar/advanced_view.php (revision 0) @@ -1,555 +0,0 @@ -RecallVar('force_tab'); -if ($force_tab) { - $DefaultTab = $force_tab; - $application->RemoveVar('force_tab'); -} - - -// category list filtering stuff: begin - -$CategoryView = $objConfig->Get("Category_View"); -if(!is_numeric($CategoryView)) -{ - $CategoryView = 127; -} - -$Category_Sortfield = $objConfig->Get("Category_Sortfield"); -if( !strlen($Category_Sortfield) ) $Category_Sortfield = "Name"; - -$Category_Sortorder = $objConfig->Get("Category_Sortorder"); -if( !strlen($Category_Sortorder) ) $Category_Sortorder = "desc"; - -$Perpage_Category = (int)$objConfig->Get("Perpage_Category"); -if(!$Perpage_Category) - $Perpage_Category="'all'"; - - -if($CategoryView == 127) -{ - $Category_ShowAll = 1; -} -else -{ - $Category_ShowAll = 0; - // FILTERING CODE V. 1.2 - $where_clauses = Array(); $q = ''; - - //Group #1: Category Statuses (active,pending,disabled) - $Status = array(-1); - if($CategoryView & $Bit_Pending) $Status[] = STATUS_PENDING; - if($CategoryView & $Bit_Active) $Status[] = STATUS_ACTIVE; - if($CategoryView & $Bit_Disabled) $Status[] = STATUS_DISABLED; - if( count($Status) ) $where_clauses[] = 'Status IN ('.implode(',', $Status).')'; - - //Group #2: Category Statistics (new,pick) - $Status = array(); - if(!($CategoryView & $Bit_New)) - { - $cutoff = adodb_date("U") - ($objConfig->Get("Category_DaysNew") * 86400); - if($cutoff > 0) $q = 'CreatedOn > '.$cutoff; - $q .= (!empty($q) ? ' OR ' : '').'NewItem = 1'; - $Status[] = "NOT ($q)"; - } - if(!($CategoryView & $Bit_Ed)) $Status[] = 'NOT (EditorsPick = 1)'; - - if( count($Status) ) - $where_clauses[] = '('.implode(') AND (', $Status).')'; - - $CategoryFilter = count($where_clauses) ? '('.implode(') AND (', $where_clauses).')' : ''; -} - -// category list filtering stuff: end - - $OrderBy = $objCatList->QueryOrderByClause(TRUE,TRUE,TRUE); - $objCatList->Clear(); - $IsSearch = FALSE; - - $list = $objSession->GetVariable("m_adv_view_search"); - $SearchQuery = $objCatList->AdminSearchWhereClause($list); - if(strlen($SearchQuery)) - { - $SearchQuery = " (".$SearchQuery.")".($CategoryFilter ? 'AND ('.$CategoryFilter.')' : ''); - $objCatList->LoadCategories($SearchQuery,$OrderBy, false, 'set_last'); - $IsSearch = TRUE; - } - else - $objCatList->LoadCategories($CategoryFilter,$OrderBy, false, 'set_last'); - - $TotalItemCount += $objCatList->QueryItemCount; - - -$CatTotal = TableCount($objCatList->SourceTable,null,false); - -$mnuClearSearch = language("la_SearchMenu_Clear"); -$mnuNewSearch = language("la_SearchMenu_New"); -$mnuSearchCategory = language("la_SearchMenu_Categories"); - -$lang_New = language("la_Text_New"); -$lang_Hot = language("la_Text_Hot"); -$lang_EdPick = language("la_prompt_EditorsPick"); -$lang_Pop = language("la_Text_Pop"); - -$lang_Rating = language("la_prompt_Rating"); -$lang_Hits = language("la_prompt_Hits"); -$lang_Votes = language("la_prompt_Votes"); -$lang_Name = language("la_prompt_Name"); - -$lang_Categories = language("la_ItemTab_Categories"); -$lang_Description = language("la_prompt_Description"); -$lang_MetaKeywords = language("la_prompt_MetaKeywords"); -$lang_SubSearch = language("la_prompt_SubSearch"); -$lang_Within = language("la_Text_Within"); -$lang_Current = language("la_Text_Current"); -$lang_Active = language("la_Text_Active"); -$lang_SubCats = language("la_Text_SubCats"); -$lang_SubItems = language("la_Text_Subitems"); - -// View, Sort, Select, Per Page -$lang_View = language('la_Text_View'); -$lang_Sort = language('la_Text_Sort'); -$lang_PerPage = language('la_prompt_PerPage'); -$lang_Select = language('la_Text_Select'); - -$ItemTabs->AddTab(language("la_ItemTab_Categories"),"category",$objCatList->QueryItemCount, $m_tab_Categories_hide, $CatTotal); - -print << -// global usage phrases -var lang_View = '$lang_View'; -var lang_Sort = '$lang_Sort'; -var lang_PerPage = '$lang_PerPage'; -var lang_Select = '$lang_Select'; - -// local usage phrases -var default_tab = "$DefaultTab"; -var Category_Sortfield = '$Category_Sortfield'; -var Category_Sortorder = '$Category_Sortorder'; -var Category_Perpage = $Perpage_Category; -var Category_ShowAll = $Category_ShowAll; -var CategoryView = $CategoryView; - -//JS Language variables -var lang_New = "$lang_New"; -var lang_Hot = "$lang_Hot"; -var lang_EdPick = "$lang_EdPick"; - -var lang_Pop = "$lang_Pop"; -var lang_Rating = "$lang_Rating"; -var lang_Hits = "$lang_Hits"; -var lang_Votes = "$lang_Votes"; -var lang_Name = "$lang_Name"; -var lang_Categories = "$lang_Categories"; -var lang_Description = "$lang_Description"; -var lang_MetaKeywords = "$lang_MetaKeywords"; -var lang_SubSearch = "$lang_SubSearch"; -var lang_Within="$lang_Within"; -var lang_Current = "$lang_Current"; -var lang_Active = "$lang_Active"; -var lang_SubCats = "$lang_SubCats"; -var lang_SubItems = "$lang_SubItems"; - -var hostname = '$rootURL'; -var env = '$envar'; -var actionlist = new Array(); - - - - // K4 code for handling toolbar operations: begin - var \$TabRegistry = Array(); - - function InpGrid(tab) - { - this.TabId = tab; - } - - InpGrid.prototype.ClearSelection = function(force,called_from) - { - unselectAll(this.TabId, 1); //1 means don't upate toolbar - } - - function registerTab(\$tab_id) - { - var \$tab = document.getElementById(\$tab_id); - var \$index = \$TabRegistry.length; - - \$TabRegistry[\$index] = new Array(); - \$TabRegistry[\$index]['tab_id'] = \$tab_id; - \$TabRegistry[\$index]['prefix_special'] = \$tab.getAttribute('PrefixSpecial'); - \$TabRegistry[\$index]['edit_template'] = \$tab.getAttribute('EditURL'); - } - - function queryTabRegistry(\$search_key, \$search_value, \$return_key) - { - var \$i = 0; - while(\$i < \$TabRegistry.length) - { - if(\$TabRegistry[\$i][\$search_key] == \$search_value) - { - return \$TabRegistry[\$i][\$return_key]; - break; - } - \$i++; - } - return '<'+\$search_key+'='+\$search_value+'>'; - } - - function k4_actionHandler(action, prefix_special) - { - var k4_action = ''; - switch (action) - { - case 'edit': - k4_action = 'edit_item("'+prefix_special+'")'; - break; - case 'delete': - k4_action = 'delete_items("'+prefix_special+'")'; - break; - case 'unselect': - k4_action = 'unselect("'+prefix_special+'")'; - break; - case 'approve': - k4_action = 'approve_items("'+prefix_special+'")'; - break; - case 'decline': - k4_action = 'decine_items("'+prefix_special+'")'; - break; - } - if (k4_action != '') - { - \$form_name = queryTabRegistry('prefix_special', prefix_special, 'tab_id') + '_form'; - eval(k4_action); - } - else alert(action+' not implemented'); - - } - - function approve_items(prefix_special) - { - set_hidden_field('remove_specials['+prefix_special+']',1); - submit_event(prefix_special,'OnMassApprove','') - } - - function decine_items(prefix_special) - { - set_hidden_field('remove_specials['+prefix_special+']',1); - submit_event(prefix_special,'OnMassDecline','') - } - - function edit() - { - edit_item( queryTabRegistry('tab_id', activeTab.id, 'prefix_special') ); - } - - function edit_item(prefix_special) - { - opener_action('d'); - set_hidden_field(prefix_special+'_mode', 't'); - set_hidden_field('remove_specials['+prefix_special+']',1); - - submit_event(prefix_special, 'OnEdit', queryTabRegistry('prefix_special', prefix_special, 'edit_template'), '../../admin/index.php'); - } - - function delete_items(prefix_special) - { - set_hidden_field('remove_specials['+prefix_special+']',1); - submit_event(prefix_special,'OnMassDelete','') - } - - function unselect(prefix_special) - { - Grids[prefix_special].ClearSelection(null,'Inp_AdvancedView.Unselect'); - } - // K4 code for handling toolbar operations: end - - - - // Common function for all "Advanced View" page - function InitPage() - { - addCommonActions(); - initToolbar('mainToolBar', actionHandler); - initCheckBoxes(null, false); - //toggleMenu(); - } - - function AddButtonAction(actionname,actionval) - { - var item = new Array(actionname,actionval); - actionlist[actionlist.length] = item; - } - - function actionHandler(button) - { - for(i=0; i - -END; -?> \ No newline at end of file Index: trunk/admin/install/upgrades/readme_1_3_0.txt =================================================================== diff -u -N --- trunk/admin/install/upgrades/readme_1_3_0.txt (revision 0) +++ trunk/admin/install/upgrades/readme_1_3_0.txt (revision 6428) @@ -0,0 +1,4 @@ +Readme notes for In-Portal 1.3.0 +Intechnic Corporation, Sep 26, 2006 + +This release is a maintenance release to support the newly released In-edit module. \ No newline at end of file Index: trunk/core/units/users/users_event_handler.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6093) +++ trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6428) @@ -121,7 +121,9 @@ if ($this->Application->IsAdmin() && ($login_value == 'root')) { // logging in "root" (admin only) $root_password = $this->Application->ConfigValue('RootPass'); - if ($root_password != md5($password)) { + $password_formatter =& $this->Application->recallObject('kPasswordFormatter'); + $test = $password_formatter->EncryptPassword($password, 'b38'); + if ($root_password != $test) { $object->SetError('ValidateLogin', 'invalid_password', 'lu_invalid_password'); $event->status = erFAIL; return false; Index: trunk/core/units/admin/admin_config.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/units/admin/admin_config.php (.../admin_config.php) (revision 6093) +++ trunk/core/units/admin/admin_config.php (.../admin_config.php) (revision 6428) @@ -124,16 +124,6 @@ 'type' => stTREE, ), - /*'in-portal:service' => Array( - 'parent' => 'in-portal:tools', - 'icon' => 'conf_general', - 'label' => 'la_tab_Service', - 'url' => Array('t' => 'tools/system_tools', 'pass' => 'm'), - 'permissions' => Array('view'), - 'priority' => 10, - 'type' => stTREE, - ),*/ - 'in-portal:backup' => Array( 'parent' => 'in-portal:tools', 'icon' => 'tool_backup', @@ -198,4 +188,18 @@ ); + + $application =& kApplication::Instance(); + if ($application->isDebugMode()) { + $config['Sections']['in-portal:service'] = Array( + 'parent' => 'in-portal:tools', + 'icon' => 'conf_general', + 'label' => 'la_tab_Service', + 'url' => Array('t' => 'tools/system_tools', 'pass' => 'm'), + 'permissions' => Array('view'), + 'priority' => 10, + 'type' => stTREE, + ); + } + ?> \ No newline at end of file Index: trunk/kernel/admin_templates/regional/phrases_edit.tpl =================================================================== diff -u -N -r5979 -r6428 --- trunk/kernel/admin_templates/regional/phrases_edit.tpl (.../phrases_edit.tpl) (revision 5979) +++ trunk/kernel/admin_templates/regional/phrases_edit.tpl (.../phrases_edit.tpl) (revision 6428) @@ -21,7 +21,7 @@ submit_event('phrases','OnCancel'); } ) ); - + a_toolbar.Render(); @@ -33,25 +33,24 @@ "> - - - - - - - - - - - + + + + + + + + + + + - - + + -
+ - \ No newline at end of file Index: trunk/kernel/units/general/helpers/permissions_helper.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 6093) +++ trunk/kernel/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 6428) @@ -305,6 +305,7 @@ if (!$this->Application->LoggedIn()) { $redirect_template = $params['login_template']; + if (!$redirect_template && $this->Application->IsAdmin()) $redirect_template = 'login'; $redirect_params = Array('next_template' => $t); } else { @@ -335,7 +336,13 @@ */ function CheckPermission($name, $type = 1, $cat_id = null) { - if ($this->Application->GetVar('u_id') == -1) { + $user_id = $this->Application->GetVar('u_id'); + return $this->CheckUserPermission($user_id, $name, $type, $cat_id); + } + + function CheckUserPermission($user_id, $name, $type = 1, $cat_id = null) + { + if ($user_id == -1) { // "root" is allowed anywhere return $name == 'SYSTEM_ACCESS.READONLY' ? 0 : 1; } @@ -371,7 +378,16 @@ WHERE (PermId = '.$perm_id.') AND (CategoryId = '.$cat_id.')'; $view_filters = Array(); - $groups = explode(',', $this->Application->RecallVar('UserGroups')); + if ($user_id == $this->Application->GetVar('u_id')) { + $groups = explode(',', $this->Application->RecallVar('UserGroups')); + } + else { // checking not current user + $sql = 'SELECT GroupId FROM '.TABLE_PREFIX.'UserGroup + WHERE (PortalUserId = '.$user_id.') AND + ( (MembershipExpires IS NULL) OR ( MembershipExpires >= UNIX_TIMESTAMP() ) )'; + $groups = $this->Conn->GetCol($sql); + array_push($groups, $this->Application->ConfigValue('User_LoggedInGroup') ); + } foreach ($groups as $group) { $view_filters[] = 'FIND_IN_SET('.$group.', ACL)'; } Index: trunk/kernel/units/email_events/email_events_event_handler.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 6093) +++ trunk/kernel/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 6428) @@ -124,7 +124,7 @@ $message_object = &$this->Application->recallObject('emailmessages', null, Array('skip_autoload' => true)); $event_table = $this->Application->getUnitOption('emailevents', 'TableName'); - $event_object = &$event->getObject(); + $event_object =& $event->getObject( Array('skip_autoload' => true) ); $event_object->Load(array('Event'=>$email_event, 'Type'=>$email_event_type)); $event_id = $event_object->GetDBField('EventId'); @@ -165,7 +165,7 @@ $message_template = $message_object->GetDBField('Template')."\r\n".$footer; // add footer: end - $from_user_object = &$this->Application->recallObject('u.-email'.$from_user_id, null, Array('skip_autoload' => true)); + $from_user_object = &$this->Application->recallObject('u.email-from', null, Array('skip_autoload' => true)); $from_user_object->Load($from_user_id); // here if we don't have from_user loaded, it takes a default user from config values if ( $from_user_object->IsLoaded() ) { @@ -176,7 +176,7 @@ $from_user_email = $this->Application->ConfigValue('Smtp_AdminMailFrom'); } - $to_user_object = &$this->Application->recallObject('u.-email'.$to_user_id, null, Array('skip_autoload' => true)); + $to_user_object = &$this->Application->recallObject('u.email-to', null, Array('skip_autoload' => true)); $to_user_object->Load($to_user_id); $to_user_email = $to_user_object->GetDBField('Email'); $to_user_name = trim($to_user_object->GetDBField('FirstName').' '.$to_user_object->GetDBField('LastName')); @@ -263,6 +263,8 @@ $this->Conn->Query($sql); } + $this->Application->removeObject('u.email-from'); + $this->Application->removeObject('u.email-to'); return $event; } } Index: trunk/admin/help/manual.pdf =================================================================== diff -u -N -r6093 -r6428 Binary files differ Index: trunk/kernel/admin_templates/tools/system_tools.tpl =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/admin_templates/tools/system_tools.tpl (.../system_tools.tpl) (revision 6093) +++ trunk/kernel/admin_templates/tools/system_tools.tpl (.../system_tools.tpl) (revision 6428) @@ -6,43 +6,24 @@ - + "> - - - - - - "> - - - - + + - "> - - - - - - - "> - - - - - - +
- : + + :  
- : + + ]" value="Go">   
- : -  
- : -  
+ + + +
\ No newline at end of file Index: trunk/themes/default/common/head.tpl =================================================================== diff -u -N -r2946 -r6428 --- trunk/themes/default/common/head.tpl (.../head.tpl) (revision 2946) +++ trunk/themes/default/common/head.tpl (.../head.tpl) (revision 6428) @@ -140,7 +140,7 @@ { d.style.color = highlight_color; } - } + } <inp:m_page_title /> @@ -150,7 +150,13 @@ + + + + + + Index: trunk/kernel/units/general/main_event_handler.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/units/general/main_event_handler.php (.../main_event_handler.php) (revision 6093) +++ trunk/kernel/units/general/main_event_handler.php (.../main_event_handler.php) (revision 6428) @@ -83,10 +83,14 @@ $ret .= $theme_name.'/'; } - if ($processed_params['m_cat_id'] > 0) { + if ($processed_params['m_cat_id'] > 0 && isset($url_params['pass_category']) && $url_params['pass_category']) { $ret .= $this->Application->getFilename('c', $processed_params['m_cat_id']).'/'; $url_params['category_processed'] = true; } + else { +// $url_params['no_category'] = 1; // for debugging + } + unset($url_params['pass_category']); // unset it just in case $force_page_adding = false; if (getArrayValue($url_params, 'reset')) Index: trunk/kernel/units/general/inp_ses_storage.php =================================================================== diff -u -N -r4758 -r6428 --- trunk/kernel/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 4758) +++ trunk/kernel/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 6428) @@ -7,18 +7,25 @@ $this->SessionTimeout = $this->Application->ConfigValue('SessionTimeout'); $path = (BASE_PATH == '') ? '/' : BASE_PATH; - if ( $this->Application->IsAdmin() ) $path = rtrim($path, '/').'/admin'; +// if ( $this->Application->IsAdmin() ) $path = rtrim($path, '/').'/admin'; $this->SetCookiePath($path); $cookie_name = $this->Application->ConfigValue('SessionCookieName'); - $this->SetCookieName($cookie_name ? $cookie_name : 'sid'); + if (!$cookie_name) $cookie_name = 'sid'; + if (($this->Application->IsAdmin() && $special !== 'front') || $special == 'admin' ) { // || $this->Application->GetVar('admin') == 1 + $cookie_name = 'adm_'.$cookie_name; + } + $this->SetCookieName($cookie_name); $this->SetCookieDomain(SERVER_NAME); - if( $this->Application->IsAdmin() ) + if( $this->Application->IsAdmin()) // && $this->Application->GetVar('admin') != 1 { $mode = constOn('IS_INSTALL') ? smCOOKIES_ONLY : smAUTO; } + /*elseif ($this->Application->IsAdmin() && $this->Application->GetVar('admin') == 1) { + $mode = smCOOKIES_ONLY; + }*/ else { $ses_mode = $this->Application->ConfigValue('CookieSessions'); Index: trunk/kernel/admin_templates/incs/script.js =================================================================== diff -u -N -r5494 -r6428 --- trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 5494) +++ trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 6428) @@ -310,13 +310,13 @@ function openSelector($prefix, $url, $dst_field, $window_size, $event) { var $kf = document.getElementById($form_name); - var $regex = new RegExp('(.*)\?env=' + document.getElementById('sid').value + '-(.*?):(m[^:]+)'); + var $regex = new RegExp('(.*)\?env=(' + document.getElementById('sid').value + ')?-(.*?):(m[^:]+)'); $regex = $regex.exec($url); - - var $t = $regex[2]; + + var $t = $regex[3]; var $window_name = 'select_'+$t.replace(/(\/|-)/g, '_'); - set_hidden_field('return_m', $regex[3]); - + set_hidden_field('return_m', $regex[4]); + if (!isset($window_size)) $window_size = '750x400'; $window_size = $window_size.split('x'); @@ -335,7 +335,7 @@ openwin('', $window_name, $window_size[0], $window_size[1]); $kf.action = $url; $kf.target = $window_name; - + submit_event($prefix, $event, $t); processHooks('openSelector', hAFTER); @@ -347,33 +347,33 @@ { var $kf = document.getElementById($form_name); var $window_name = 'select_'+t.replace(/(\/|-)/g, '_'); - var $regex = new RegExp('(.*)\?env=' + document.getElementById('sid').value + '-(.*?):(m[^:]+)'); - + var $regex = new RegExp('(.*)\?env=(' + document.getElementById('sid').value + ')?-(.*?):(m[^:]+)'); + $regex = $regex.exec($kf.action); - set_hidden_field('return_m', $regex[3]); + set_hidden_field('return_m', $regex[4]); var $prev_opener = get_hidden_field('m_opener'); if (!isset(multi_line)) multi_line = 0; openwin('', $window_name, 750, 400); set_hidden_field('return_template', $kf.elements['t'].value); // where should return after popup is done set_hidden_field('m_opener', 'p'); - + set_hidden_field('translator_wnd_name', $window_name); set_hidden_field('translator_field', field); set_hidden_field('translator_t', t); set_hidden_field('translator_prefixes', prefix); set_hidden_field('translator_multi_line', multi_line); $kf.target = $window_name; - + return $prev_opener; } function PreSaveAndOpenTranslator(prefix, field, t, multi_line) { var $prev_opener = InitTranslator(prefix, field, t, multi_line); - + var split_prefix = prefix.split(','); submit_event(split_prefix[0], 'OnPreSaveAndOpenTranslator'); - + set_hidden_field('m_opener', $prev_opener); } @@ -385,7 +385,7 @@ var split_prefix = prefix.split(','); submit_event(split_prefix[0],'OnPreSaveAndOpenTranslator'); - + set_hidden_field('m_opener', $prev_opener); } @@ -397,8 +397,8 @@ set_hidden_field('trans_field', field); set_hidden_field('events[trans]', 'OnLoad'); - var $regex = new RegExp('(.*)\?env=' + document.getElementById('sid').value + '-(.*?):(.*)'); - var $t = $regex.exec(url)[2]; + var $regex = new RegExp('(.*)\?env=(' + document.getElementById('sid').value + ')?-(.*?):(.*)'); + var $t = $regex.exec(url)[3]; $kf.target = wnd; submit_event(prefix,'',$t,url); } @@ -1019,7 +1019,7 @@ $dst_element.appendChild($new_element); return $new_element; } - + Math.sum = function($array) { var $i = 0; var $total = 0; @@ -1029,7 +1029,7 @@ } return $total; } - + Math.average = function($array) { return Math.sum($array) / $array.length; } Index: trunk/admin/advanced_view.php =================================================================== diff -u -N --- trunk/admin/advanced_view.php (revision 5431) +++ trunk/admin/advanced_view.php (revision 0) @@ -1,311 +0,0 @@ -

"; - -require_login(); - -$indexURL = $rootURL."index.php"; -$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');"; - -$m_var_list_update["cat"] = 0; -unset($m_var_list_update["cat"]); - -$pathtolocal = $pathtoroot."kernel/"; -require_once ($pathtoroot.$admin."/include/elements.php"); -//require_once ($pathtoroot."kernel/admin/include/navmenu.php"); -require_once ($pathtolocal."admin/include/navmenu.php"); -require_once($pathtoroot.$admin."/browse/toolbar.php"); - -$mod_prefixes = Array(); -$m = GetModuleArray(); -foreach($m as $key=>$value) -{ - $path = $pathtoroot.$value."admin/include/parser.php"; - if(file_exists($path)) - { - //echo ""; - $mod_prefixes[] = $key; - @include_once($path); - } -} - -$application->InitParser(); - -$cat_templates = $objModules->ExecuteFunction('GetModuleInfo', 'advanced_view_template'); -foreach ($cat_templates as $a_mod => $a_template) { - if (!$a_template) continue; - $a_var = $a_mod.'_TAB_HTML'; - $$a_var = $application->ParseBlock(Array('name'=>$a_template), 0, true); -} - -if (!defined('IS_INSTALL') ) define('IS_INSTALL', 0); -if( !IS_INSTALL ) require_login(); - -//Set Section -$section = 'in-portal:advanced_view'; - -//Set Environment Variable - -// save last category visited -$objSession->SetVariable('prev_category', $objSession->GetVariable('last_category') ); -$objSession->SetVariable('last_category', $objCatList->CurrentCategoryID() ); - -$objSession->SetVariable("HasChanges", 0); -// where should all edit popups submit changes -$objSession->SetVariable("ReturnScript", basename($_SERVER['PHP_SELF']) ); - - -// common "Advanced View" tab php functions: begin -function GetAdvView_SearchWord($prefix) -{ - global $objSession; - return $objSession->GetVariable($prefix.'_adv_view_search'); -} - -function SaveAdvView_SearchWord($prefix) -{ - global $objSession; - $SearchWord = $objSession->GetVariable($prefix.'_adv_view_search'); - if( isset($_REQUEST['SearchWord']) ) - { - $SearchWord = $_REQUEST['SearchWord']; - $objSession->SetVariable($prefix.'_adv_view_search', $SearchWord); - } -} - -function ResetAdvView_SearchWord($prefix) -{ - global $objSession; - $objSession->SetVariable($prefix.'_adv_view_search', ''); -} - -function ShowSearchForm($prefix, $envar, $TabID) -{ - global $imagesURL; - $btn_prefix = $imagesURL.'/toolbar/icon16_search'; - $SearchWord = GetAdvView_SearchWord($prefix); - echo ' - - - '; -} -// common "Advanced View" tab php functions: end - -/* page header */ -$charset = GetRegionalOption('Charset'); -print << - - In-portal - - - - -END; - - require_once($pathtoroot.$admin."/include/mainscript.php"); - -print << - if (window.opener != null) { - theMainScript.CloseAndRefreshParent(); - } - -END; - -print << - - - - - -END; -load_module_styles(); -if( !isset($list) ) $list = ''; - -int_SectionHeader(); - - $filter = false; - $bit_combo = $objModules->ExecuteFunction('GetModuleInfo', 'all_bitmask'); - $bit_combo = $objModules->MergeReturn($bit_combo); - foreach($bit_combo['VarName'] as $mod_name => $VarName) - { - //echo "VarName: [$VarName] = [".$objConfig->Get($VarName)."], ALL = [".$bit_combo['Bits'][$mod_name]."]
"; - if( $objConfig->Get($VarName) ) - if( $objConfig->Get($VarName) != $bit_combo['Bits'][$mod_name] ) - { - $filter = true; - break; - } - } - -?> -
- - - - - - - -
-
- " ImagePath=""> - " ImagePath=""> - "> - " ImagePath=""> - " ImagePath=""> - "> - " ImagePath=""> - " ImagePath=""> -
-
- - - - - - -
- -
- -
- - - - -
-
- - - - TabRow(); - - if(count($ItemTabs->Tabs)) - { - ?> -
- -
- - $value) - { - $path = $pathtoroot.$value."admin/advanced_view.php"; - //echo "Including File: $path
"; - if(file_exists($path)) - { - //echo "\n\n"; - include_once($path); - } - } - $admin = $objConfig->Get("AdminDirectory"); - if(!strlen($admin)) $admin = "admin"; - ?> -
- - - - -
-
- - -SetVariable("HasChanges", 0); - int_footer(); -?> \ No newline at end of file Index: trunk/admin/install/langpacks/english.lang =================================================================== diff -u -N -r6093 -r6428 --- trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 6093) +++ trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 6428) @@ -225,6 +225,7 @@ VW5rbm93biBjYXRlZ29yeQ== SW5jb3JyZWN0IGRhdGUgZm9ybWF0LCBwbGVhc2UgdXNlICglcykgZXguICglcyk= SW5jb3JyZWN0IGRhdGEgZm9ybWF0LCBwbGVhc2UgdXNlICVz + SW52YWxpZCBGb3JtYXQ= RmllbGQgaXMgb3V0IG9mIHJhbmdl RmllbGQgaXMgcmVxdWlyZWQ= RmllbGQgdmFsdWUgbXVzdCBiZSB1bmlxdWU= @@ -1468,6 +1469,7 @@ UGFzc3dvcmQgZmllbGQ= UmFkaW8gYnV0dG9ucw== RHJvcCBkb3duIGZpZWxk + Q2hlY2tib3g= VGV4dCBmaWVsZA== VGV4dCBhcmVh VW5jaGFuZ2Vk Index: trunk/core/kernel/event_manager.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/kernel/event_manager.php (.../event_manager.php) (revision 6093) +++ trunk/core/kernel/event_manager.php (.../event_manager.php) (revision 6428) @@ -289,6 +289,11 @@ // should do redirect but to no_permissions template if ( ($event->status == erSUCCESS || $event->status == erPERM_FAIL) && ($event->redirect === true || strlen($event->redirect) > 0)) { + // we need to pass category if the action was submitted to self-template, with the category passed + // and it has not explicly set redirect template or pass_cateogry param + if ($event->redirect === true && !isset($event->redirect_params['pass_category']) && $this->Application->GetVar('m_cat_id')) { + $event->redirect_params['pass_category'] = 1; + } $this->Application->Redirect($event->redirect, $event->redirect_params, null, $event->redirect_script); } } @@ -309,7 +314,8 @@ case 'd': // "down/push" new template to opener stack, deeplevel++ if ($this->Application->GetVar('front')) { - array_push($opener_stack, '../'.$this->Application->RecallVar('last_template') ); + $front_session =& $this->Application->recallObject('Session.front'); + array_push($opener_stack, '../'.$front_session->RecallVar('last_template') ); } else { array_push($opener_stack, $this->Application->RecallVar('last_template') ); @@ -334,18 +340,18 @@ $this->Application->StoreVar('opener_stack', serialize($opener_stack)); } - + function openerStackPush($t, $params, $pass = 'all') { $opener_stack = $this->Application->RecallVar('opener_stack'); - $opener_stack = $opener_stack ? unserialize($opener_stack) : Array(); - + $opener_stack = $opener_stack ? unserialize($opener_stack) : Array(); + $redirect_params = array_merge_recursive2(Array('m_opener' => 'u', '__URLENCODE__' => 1), $params); $new_level = $this->Application->BuildEnv($t, $redirect_params, $pass, true); array_push($opener_stack, 'index.php|'.ltrim($new_level, ENV_VAR_NAME.'=') ); $this->Application->StoreVar('opener_stack', serialize($opener_stack)); } - + function registerHook($hookto_prefix, $hookto_special, $hookto_event, $mode, $do_prefix, $do_special, $do_event, $conditional) { if( !$this->Application->prefixRegistred($hookto_prefix) ) Index: trunk/core/units/general/helpers/permissions_helper.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 6093) +++ trunk/core/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 6428) @@ -305,6 +305,7 @@ if (!$this->Application->LoggedIn()) { $redirect_template = $params['login_template']; + if (!$redirect_template && $this->Application->IsAdmin()) $redirect_template = 'login'; $redirect_params = Array('next_template' => $t); } else { @@ -335,7 +336,13 @@ */ function CheckPermission($name, $type = 1, $cat_id = null) { - if ($this->Application->GetVar('u_id') == -1) { + $user_id = $this->Application->GetVar('u_id'); + return $this->CheckUserPermission($user_id, $name, $type, $cat_id); + } + + function CheckUserPermission($user_id, $name, $type = 1, $cat_id = null) + { + if ($user_id == -1) { // "root" is allowed anywhere return $name == 'SYSTEM_ACCESS.READONLY' ? 0 : 1; } @@ -371,7 +378,16 @@ WHERE (PermId = '.$perm_id.') AND (CategoryId = '.$cat_id.')'; $view_filters = Array(); - $groups = explode(',', $this->Application->RecallVar('UserGroups')); + if ($user_id == $this->Application->GetVar('u_id')) { + $groups = explode(',', $this->Application->RecallVar('UserGroups')); + } + else { // checking not current user + $sql = 'SELECT GroupId FROM '.TABLE_PREFIX.'UserGroup + WHERE (PortalUserId = '.$user_id.') AND + ( (MembershipExpires IS NULL) OR ( MembershipExpires >= UNIX_TIMESTAMP() ) )'; + $groups = $this->Conn->GetCol($sql); + array_push($groups, $this->Application->ConfigValue('User_LoggedInGroup') ); + } foreach ($groups as $group) { $view_filters[] = 'FIND_IN_SET('.$group.', ACL)'; } Index: trunk/themes/default/common/pagetop.tpl =================================================================== diff -u -N -r3723 -r6428 --- trunk/themes/default/common/pagetop.tpl (.../pagetop.tpl) (revision 3723) +++ trunk/themes/default/common/pagetop.tpl (.../pagetop.tpl) (revision 6428) @@ -1,3 +1,6 @@ + + + @@ -12,27 +15,27 @@
- + - +


- + - +
">
">">
">
">">


Index: trunk/admin/install/install_lib.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/admin/install/install_lib.php (.../install_lib.php) (revision 6093) +++ trunk/admin/install/install_lib.php (.../install_lib.php) (revision 6428) @@ -925,8 +925,7 @@ $lang_path = FULL_PATH.'/'.$module_name.'/admin/install/langpacks'; $lang_xml->Parse($lang_path.'/english.lang', '|0|1|2|', ''); - $app->Redirect('', Array('pass' => 'all', 'admin' => 1, 'Refresh' => 1), '', 'modules/mod_status.php'); - + $app->Redirect('modules/modules_list', Array('pass' => 'all', 'admin' => 1, 'RefreshTree' => 1), '', 'index.php'); } /** Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/kernel/application.php (.../application.php) (revision 6093) +++ trunk/core/kernel/application.php (.../application.php) (revision 6428) @@ -201,7 +201,9 @@ { if($this->InitDone) return false; - ob_start(); // collect any output from method (other then tags) into buffer + if (!constOn('SKIP_OUT_COMPRESSION')) { + ob_start(); // collect any output from method (other then tags) into buffer + } if(defined('DEBUG_MODE') && $this->isDebugMode() && constOn('DBG_PROFILE_MEMORY')) { $this->Debugger->appendMemoryUsage('Application before Init:'); @@ -646,7 +648,7 @@ $this->InitParser(); $t = $this->GetVar('t'); - if ($this->isModuleEnabled('In-CMS')) { + if ($this->isModuleEnabled('In-Edit')) { $cms_handler =& $this->recallObject('cms_EventHandler'); if (!$this->TemplatesCache->TemplateExists($t) && !$this->IsAdmin()) { $t = $cms_handler->GetDesignTemplate(); @@ -1106,6 +1108,7 @@ } else { + unset($params['pass_category']); // we don't need to pass it when mod_rewrite is off $env = $this->BuildEnv($t, $params, $pass, $pass_events); $ret = $this->BaseURL($prefix, $ssl).$index_file.'?'.$env.$map_link; } @@ -1223,6 +1226,7 @@ $env .= ':'.$this->BuildModuleEnv($pass_element, $params, $pass_events); } } + if (!$m_only) $params['pass_category'] = 1; $ret = $this->BuildModuleEnv_NEW('m', $params, $pass_events).$ret; $cat_processed = isset($params['category_processed']) && $params['category_processed']; if ($cat_processed) { @@ -1327,7 +1331,7 @@ $session =& $this->recallObject('Session'); $ssl = isset($params['__SSL__']) ? $params['__SSL__'] : 0; $sid = $session->NeedQueryString() && !$this->RewriteURLs($ssl) ? $this->GetSID() : ''; - if (getArrayValue($params,'admin') == 1) $sid = $this->GetSID(); +// if (getArrayValue($params,'admin') == 1) $sid = $this->GetSID(); $ret = ''; if ($env_var) { @@ -1480,7 +1484,11 @@ } ob_end_flush(); - $this->Session->SaveData(); + // session expiration is called from session initialization, + // that's why $this->Session may be not defined here + if (is_object($this->Session)) { + $this->Session->SaveData(); + } exit; } @@ -2115,7 +2123,7 @@ */ function isModuleEnabled($module_name) { - return $this->findModule('Name', $module_name); + return $this->findModule('Name', $module_name) !== false; } Index: trunk/core/units/email_events/email_events_event_handler.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 6093) +++ trunk/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 6428) @@ -124,7 +124,7 @@ $message_object = &$this->Application->recallObject('emailmessages', null, Array('skip_autoload' => true)); $event_table = $this->Application->getUnitOption('emailevents', 'TableName'); - $event_object = &$event->getObject(); + $event_object =& $event->getObject( Array('skip_autoload' => true) ); $event_object->Load(array('Event'=>$email_event, 'Type'=>$email_event_type)); $event_id = $event_object->GetDBField('EventId'); @@ -165,7 +165,7 @@ $message_template = $message_object->GetDBField('Template')."\r\n".$footer; // add footer: end - $from_user_object = &$this->Application->recallObject('u.-email'.$from_user_id, null, Array('skip_autoload' => true)); + $from_user_object = &$this->Application->recallObject('u.email-from', null, Array('skip_autoload' => true)); $from_user_object->Load($from_user_id); // here if we don't have from_user loaded, it takes a default user from config values if ( $from_user_object->IsLoaded() ) { @@ -176,7 +176,7 @@ $from_user_email = $this->Application->ConfigValue('Smtp_AdminMailFrom'); } - $to_user_object = &$this->Application->recallObject('u.-email'.$to_user_id, null, Array('skip_autoload' => true)); + $to_user_object = &$this->Application->recallObject('u.email-to', null, Array('skip_autoload' => true)); $to_user_object->Load($to_user_id); $to_user_email = $to_user_object->GetDBField('Email'); $to_user_name = trim($to_user_object->GetDBField('FirstName').' '.$to_user_object->GetDBField('LastName')); @@ -263,6 +263,8 @@ $this->Conn->Query($sql); } + $this->Application->removeObject('u.email-from'); + $this->Application->removeObject('u.email-to'); return $event; } } Index: trunk/kernel/parser.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/parser.php (.../parser.php) (revision 6093) +++ trunk/kernel/parser.php (.../parser.php) (revision 6428) @@ -44,7 +44,14 @@ global $m_var_list, $m_var_list_update; $module_vars = Array( 'cat' => 'm_cat_id', 'p' => 'm_cat_page', 'lang' => 'm_lang', 'theme' => 'm_theme', 'opener' => 'm_opener'); + $pass_cat = 0; + if (isset($m_var_list_update['cat'])) { + $pass_cat = 1; + } $ret = GenerateModuleEnv_NEW('m', $module_vars); + if ($pass_cat) { + $ret['pass_category'] = 1; + } if( isset($GLOBALS['m_var_list_update']['cat']) ) unset($GLOBALS['m_var_list_update']['cat']); return $ret; } @@ -1254,6 +1261,14 @@ { global $objConfig, $objCatList; + $application =& kApplication::Instance(); + if ($application->isModuleEnabled('In-Edit')) { + $title = $application->ProcessTag('cms:PageInfo type="htmlhead_title"'); + if ($title && !preg_match('/^_Auto.*/', $title)) { + return $title; + } + } + $ret = strip_tags( $objConfig->Get('Site_Name') ); if(getArrayValue($attribs,'_fullpath') || getArrayValue($attribs,'_currentcategory')) { @@ -2933,6 +2948,14 @@ { global $objCatList, $objConfig; + $application =& kApplication::Instance(); + if ($application->isModuleEnabled('In-Edit')) { + $keywords = $application->ProcessTag('cms:PageInfo type="meta_keywords"'); + if ($keywords) { + return $keywords; + } + } + $keywords = ''; $catid = (int)getArrayValue($attribs, '_catid'); @@ -2960,26 +2983,34 @@ */ function m_meta_description($attribs = array()) { - global $objCatList, $objConfig; + global $objCatList, $objConfig; + $application =& kApplication::Instance(); + if ($application->isModuleEnabled('In-Edit')) { + $description = $application->ProcessTag('cms:PageInfo type="meta_description"'); + if ($description) { + return $description; + } + } + $description = ''; - $catid = (int)getArrayValue($attribs, '_catid'); - if (!$catid) - { + $catid = (int)getArrayValue($attribs, '_catid'); + if (!$catid) + { $catid = $objCatList->CurrentCategoryID(); - } + } - if ($catid) - { - $c = $objCatList->GetItem($catid); - $description = $c->Get('MetaDescription'); - } + if ($catid) + { + $c = $objCatList->GetItem($catid); + $description = $c->Get('MetaDescription'); + } - if (!$description) - { - $description = $objConfig->Get('Category_MetaDesc'); - } - return $description; + if (!$description) + { + $description = $objConfig->Get('Category_MetaDesc'); + } + return $description; } /* Index: trunk/admin/browse.php =================================================================== diff -u -N --- trunk/admin/browse.php (revision 5431) +++ trunk/admin/browse.php (revision 0) @@ -1,450 +0,0 @@ -GetVar('Action') == 'm_paste') define('REDIRECT_REQUIRED',1); // this script can issue redirect header - -define('REQUIRE_LAYER_HEADER', 1); -$b_topmargin = "0"; -//$b_header_addon = "

"; - -require_login(); - -$indexURL = $rootURL."index.php"; -$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');"; - -$m_var_list_update["cat"] = 0; -unset($m_var_list_update["cat"]); - -$envar = "env=" . BuildEnv(); - -if($objCatList->CurrentCategoryID()>0) -{ - $c = $objCatList->CurrentCat(); - $upURL = "javascript:AdminCatNav('".$c->Admin_Parent_Link()."');"; -} -else - $upURL = $_SERVER["PHP_SELF"]."?".$envar; - -//admin only util - -$pathtolocal = $pathtoroot."kernel/"; -require_once ($pathtoroot.$admin."/include/elements.php"); -//require_once ($pathtoroot."kernel/admin/include/navmenu.php"); -require_once ($pathtolocal."admin/include/navmenu.php"); -require_once($pathtoroot.$admin."/browse/toolbar.php"); - -$m = GetModuleArray(); -foreach($m as $key=>$value) -{ - $path = $pathtoroot.$value."admin/include/parser.php"; - if(file_exists($path)) - { - //echo ""; - @include_once($path); - } -} - -$cat_templates = $objModules->ExecuteFunction('GetModuleInfo', 'catalog_template'); -foreach ($cat_templates as $a_mod => $a_template) { - if (!$a_template) continue; - - $module_prefix = $application->findModule('Name', $a_mod, 'Var'); - $view_perm = $application->getUnitOption($module_prefix, 'PermItemPrefix').'.VIEW'; - if ($application->CheckPermission($view_perm, 0)) { - $a_var = $a_mod.'_TAB_HTML'; - $$a_var = $application->ParseBlock(Array('name'=>$a_template), 0, true); - } -} - -//$application->SetVar('t', 'in-commerce/products/products_catalog'); - - -if( !defined('IS_INSTALL') ) define('IS_INSTALL', 0); -if( !IS_INSTALL ) require_login(); - -//Set Section -$section = 'in-portal:browse'; - -//Set Environment Variable - -//echo $objCatList->ItemsOnClipboard()." Categories on the clipboard
\n"; -//echo $objTopicList->ItemsOnClipboard()." Topics on the clipboard
\n"; -//echo $objLinkList->ItemsOnClipboard()." Links on the clipboard
\n"; -//echo $objArticleList->ItemsOnClipboard()." Articles on the clipboard
\n"; - -// save last category visited -$objSession->SetVariable('prev_category', $objSession->GetVariable('last_category') ); -$objSession->SetVariable('last_category', $objCatList->CurrentCategoryID() ); - -/* // for testing -$last_cat = $objSession->GetVariable('last_category'); -$prev_cat = $objSession->GetVariable('prev_category'); -echo "Last CAT: [$last_cat]
"; -echo "Prev CAT: [$prev_cat]
"; -*/ -$SearchType = $objSession->GetVariable("SearchType"); -if(!strlen($SearchType)) - $SearchType = "all"; -$SearchLabel = "la_SearchLabel"; -if( GetVar('SearchWord') !== false ) $objSession->SetVariable('admin_seach_words', GetVar('SearchWord') ); -$SearchWord = $objSession->GetVariable('admin_seach_words'); - -// where should all edit popups submit changes -$objSession->SetVariable("ReturnScript", basename($_SERVER['PHP_SELF']) ); -$charset = GetRegionalOption('Charset'); - -$base_href = $application->ProcessParsedTag('m', 'Base_Ref', Array()); - -/* page header */ -print << - - In-portal - $base_href - - - - -END; - - require_once($pathtoroot.$admin."/include/mainscript.php"); - -print << - if (window.opener != null) { - theMainScript.CloseAndRefreshParent(); - } - -END; - -print << - - - - - - -END; -load_module_styles(); -if( !isset($list) ) $list = ''; -if(($SearchType=="categories" || $SearchType="all") && strlen($list)) -{ - int_SectionHeader(NULL,NULL,NULL,admin_language("la_Title_SearchResults")); -} -else - int_SectionHeader(); - -$filter = false; // always initialize variables before use - -if($objSession->GetVariable("SearchWord") != '') { - $filter = true; -} -else { - $bit_combo = $objModules->ExecuteFunction('GetModuleInfo', 'all_bitmask'); - $bit_combo = $objModules->MergeReturn($bit_combo); - foreach($bit_combo['VarName'] as $mod_name => $VarName) - { - //echo "VarName: [$VarName] = [".$objConfig->Get($VarName)."], ALL = [".$bit_combo['Bits'][$mod_name]."]
"; - if( $objConfig->Get($VarName) ) - if( $objConfig->Get($VarName) != $bit_combo['Bits'][$mod_name] ) - { - $filter = true; - break; - } - } -} -?> -
- - - - - - - -
-
- " ImagePath=""> - " ImagePath=""> - "> - " ImagePath=""> - " ImagePath=""> - - \n"; - } - ?> - - " ImagePath=""> - " ImagePath=""> - "> - " ImagePath=""> - " ImagePath=""> - "> - - " ImagePath=""> - "> - - " ImagePath=""> - "> - - " ImagePath=""> - " ImagePath=""> - " ImagePath=""> - "> - " ImagePath=""> - " ImagePath=""> - "> - " ImagePath=""> - " ImagePath=""> -
-
- - - - - - - - -
- - -
" NAME="admin_search" ID="admin_search">">"> - - - - -
 /icon16_search.gif" title="" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" src="/arrow16.gif" onmouseover="this.src='/icon16_search_f2.gif'" onmouseout="this.src='/icon16_search.gif'" style="cursor:hand" width="22" width="22"> - /icon16_search_reset.gif" title="" align="absMiddle" onclick="document.all.SearchWord.value = ''; this.action = this.getAttribute('action'); actionHandler(this);" onmouseover="this.src='/icon16_search_reset_f2.gif'" onmouseout="this.src='/icon16_search_reset.gif'" style="cursor:hand" width="22" width="22">  -
-
- -
- - - - - -
- -
- -
- -QueryOrderByClause(TRUE,TRUE,TRUE); - $objCatList->Clear(); - $IsSearch = FALSE; - if($SearchType == 'categories' || $SearchType == 'all') - { - $list = $objSession->GetVariable("SearchWord"); - $SearchQuery = $objCatList->AdminSearchWhereClause($list); - if(strlen($SearchQuery)) - { - $SearchQuery = " (".$SearchQuery.") "; - if( strlen($CatScopeClause) ) { - $SearchQuery .= " AND ParentId = ".$objCatList->CurrentCategoryID();//" AND ".$CatScopeClause; - } - $objCatList->LoadCategories($SearchQuery.$CategoryFilter,$OrderBy); - $IsSearch = TRUE; - } - else - $objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter,$OrderBy); - } - else - $objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter, $OrderBy); - - $TotalItemCount += $objCatList->QueryItemCount; - -?> -GetAdminUserErrors(); - if(count($e)>0) - { - echo ""; - for($ex = 0; $ex"; - } - echo "
".prompt_language($e[$ex])."

"; - } -?> - - - - - - - -
- - - - - - - -
- - - :  - - (QueryItemCount; ?>)  - - -
-
 
-
-
- -
-
- -
-
- - CurrentCategoryID(),$template); - ?> -
-
-
- - TabRow(); - if(count($ItemTabs->Tabs)) - { - ?> -
- -
- ParseBlock(Array('name'=>'kernel_form_start'), 0, true); - - $m = GetModuleArray("admin"); - foreach($m as $key=>$value) - { - $path = $pathtoroot.$value."admin/browse.php"; - if(file_exists($path)) - { - //echo "\n\n"; - include_once($path); - } - } - - //echo $application->ParseBlock(Array('name'=>'kernel_form_end'), 0, true); - - - $admin = $objConfig->Get("AdminDirectory"); - if(!strlen($admin)) $admin = "admin"; - ?> -
- - - - -
-
- - - -SetVariable("HasChanges", 0); - int_footer(); -?> \ No newline at end of file Index: trunk/kernel/admin_templates/incs/grid_blocks.tpl =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 6093) +++ trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 6428) @@ -170,7 +170,7 @@ - + Index: trunk/core/units/general/main_event_handler.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/units/general/main_event_handler.php (.../main_event_handler.php) (revision 6093) +++ trunk/core/units/general/main_event_handler.php (.../main_event_handler.php) (revision 6428) @@ -83,10 +83,14 @@ $ret .= $theme_name.'/'; } - if ($processed_params['m_cat_id'] > 0) { + if ($processed_params['m_cat_id'] > 0 && isset($url_params['pass_category']) && $url_params['pass_category']) { $ret .= $this->Application->getFilename('c', $processed_params['m_cat_id']).'/'; $url_params['category_processed'] = true; } + else { +// $url_params['no_category'] = 1; // for debugging + } + unset($url_params['pass_category']); // unset it just in case $force_page_adding = false; if (getArrayValue($url_params, 'reset')) Index: trunk/kernel/admin/advanced_view.php =================================================================== diff -u -N --- trunk/kernel/admin/advanced_view.php (revision 1333) +++ trunk/kernel/admin/advanced_view.php (revision 0) @@ -1,57 +0,0 @@ - - - -
- - - - - - - -
- - GetAdminPageLinkList($_SERVER["PHP_SELF"]); ?> - - - -

- -
- - - - - -
-
-
- \ No newline at end of file Index: trunk/kernel/admin/include/toolbar/editcategory_permissions.php =================================================================== diff -u -N --- trunk/kernel/admin/include/toolbar/editcategory_permissions.php (revision 13) +++ trunk/kernel/admin/include/toolbar/editcategory_permissions.php (revision 0) @@ -1,44 +0,0 @@ - - - - -END; -?> Index: trunk/admin/install/inportal_data.sql =================================================================== diff -u -N -r6093 -r6428 --- trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 6093) +++ trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 6428) @@ -239,7 +239,7 @@ INSERT INTO ItemTypes VALUES (1, 'In-Portal', 'c', 'Category', 'Name', 'CreatedById', NULL, NULL, 'la_ItemTab_Categories', 1, 'admin/category/addcategory.php', 'clsCategory', 'Category'); INSERT INTO ItemTypes VALUES (6, 'In-Portal', 'u', 'PortalUser', 'Login', 'PortalUserId', NULL, NULL, '', 0, '', 'clsPortalUser', 'User'); -INSERT INTO Modules (Name, Path, Var, Version, Loaded, LoadOrder, TemplatePath, RootCat, BuildDate) VALUES ('In-Portal', 'kernel/', 'm', '1.2.1', 1, 0, '', 0, '1054738405'); +INSERT INTO Modules (Name, Path, Var, Version, Loaded, LoadOrder, TemplatePath, RootCat, BuildDate) VALUES ('In-Portal', 'kernel/', 'm', '1.3.0', 1, 0, '', 0, '1054738405'); INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('CATEGORY.VIEW', 'lu_PermName_Category.View_desc', 'lu_PermName_Category.View_error', 'In-Portal'); INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('CATEGORY.ADD', 'lu_PermName_Category.Add_desc', 'lu_PermName_Category.Add_error', 'In-Portal'); Index: trunk/kernel/units/configuration/configuration_event_handler.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 6093) +++ trunk/kernel/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 6428) @@ -49,7 +49,8 @@ $field_options['skip_empty'] = 1; $object->SetFieldOptions('VariableValue', $field_options); }else { - $object->SetDBField('VariableValue', md5($object->GetDBField('VariableValue'))); + $password_formatter =& $this->Application->recallObject('kPasswordFormatter'); + $object->SetDBField('VariableValue', $password_formatter->EncryptPassword($object->GetDBField('VariableValue'), 'b38')); } } @@ -171,7 +172,7 @@ $event->redirect_params = Array('opener' => 's', 'pass'=>'all,conf'); //stay! $event->redirect = false; }*/ - + /** * Process items from selector (selected_ids var, key - prefix, value - comma separated ids) * Index: trunk/core/units/general/inp_ses_storage.php =================================================================== diff -u -N -r4758 -r6428 --- trunk/core/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 4758) +++ trunk/core/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 6428) @@ -7,18 +7,25 @@ $this->SessionTimeout = $this->Application->ConfigValue('SessionTimeout'); $path = (BASE_PATH == '') ? '/' : BASE_PATH; - if ( $this->Application->IsAdmin() ) $path = rtrim($path, '/').'/admin'; +// if ( $this->Application->IsAdmin() ) $path = rtrim($path, '/').'/admin'; $this->SetCookiePath($path); $cookie_name = $this->Application->ConfigValue('SessionCookieName'); - $this->SetCookieName($cookie_name ? $cookie_name : 'sid'); + if (!$cookie_name) $cookie_name = 'sid'; + if (($this->Application->IsAdmin() && $special !== 'front') || $special == 'admin' ) { // || $this->Application->GetVar('admin') == 1 + $cookie_name = 'adm_'.$cookie_name; + } + $this->SetCookieName($cookie_name); $this->SetCookieDomain(SERVER_NAME); - if( $this->Application->IsAdmin() ) + if( $this->Application->IsAdmin()) // && $this->Application->GetVar('admin') != 1 { $mode = constOn('IS_INSTALL') ? smCOOKIES_ONLY : smAUTO; } + /*elseif ($this->Application->IsAdmin() && $this->Application->GetVar('admin') == 1) { + $mode = smCOOKIES_ONLY; + }*/ else { $ses_mode = $this->Application->ConfigValue('CookieSessions'); Index: trunk/kernel/include/emailmessage.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/include/emailmessage.php (.../emailmessage.php) (revision 6093) +++ trunk/kernel/include/emailmessage.php (.../emailmessage.php) (revision 6428) @@ -901,6 +901,8 @@ function SendMail($From, $FromName, $ToAddr, $ToName, $Subject, $Text, $Html, $charset, $SendEvent,$FileName="",$FileLoc="",$QueueOnly=0,$extra_headers = array()) { + $charset = GetRegionalOption('Charset'); + $HasFile = FALSE; $HasFile = (strlen($FileName)>0); $OB="----=_OuterBoundary_000".md5( uniqid (rand())); @@ -963,7 +965,7 @@ if(strlen($Html)>0) { $msg .= "--" . $boundary . "\n"; - $msg .= "Content-Type: text/html; charset=\"iso-8859-1\""."\n"; + $msg .= "Content-Type: text/html; charset=\"".$charset."\""."\n"; $msg .= "Content-Transfer-Encoding: 8bit"."\n"."\n"; $msg .= stripslashes($Html); $msg .= "\n"."\n"; Index: trunk/core/kernel/utility/formatters/password_formatter.php =================================================================== diff -u -N -r4758 -r6428 --- trunk/core/kernel/utility/formatters/password_formatter.php (.../password_formatter.php) (revision 4758) +++ trunk/core/kernel/utility/formatters/password_formatter.php (.../password_formatter.php) (revision 6428) @@ -59,6 +59,7 @@ { if( $object->GetDBField($password_field) != $this->EncryptPassword('') ) { + if ($options['encryption_method'] == 'plain') return $value; return $this->EncryptPassword($value); } else @@ -87,11 +88,14 @@ } } if($value == '') return $object->GetDBField($field_name); + + if ($options['encryption_method'] == 'plain') return $value; return $this->EncryptPassword($value); } - function EncryptPassword($value) + function EncryptPassword($value, $salt=null) { - return md5($value); + if (!isset($salt)) return md5($value); + return md5(md5($value).$salt); } } \ No newline at end of file Index: trunk/admin/install/upgrades/changelog_1_3_0.txt =================================================================== diff -u -N --- trunk/admin/install/upgrades/changelog_1_3_0.txt (revision 0) +++ trunk/admin/install/upgrades/changelog_1_3_0.txt (revision 6428) @@ -0,0 +1,82 @@ +File in-portal/index.php changed +File in-portal/admin/advanced_view.php is removed; release_1_2_1 revision 1.25 +File in-portal/admin/browse.php is removed; release_1_2_1 revision 1.35 +File in-portal/admin/install.php changed +File in-portal/admin/category/addcategory.php is removed; release_1_2_1 revision 1.20 +File in-portal/admin/category/addcategory_custom.php is removed; release_1_2_1 revision 1.14 +File in-portal/admin/category/addcategory_customfields.php is removed; release_1_2_1 revision 1.5 +File in-portal/admin/category/addcategory_images.php is removed; release_1_2_1 revision 1.9 +File in-portal/admin/category/addcategory_permissions.php is removed; release_1_2_1 revision 1.11 +File in-portal/admin/category/addcategory_relations.php is removed; release_1_2_1 revision 1.8 +File in-portal/admin/category/addimage.php is removed; release_1_2_1 revision 1.9 +File in-portal/admin/category/addpermission.php is removed; release_1_2_1 revision 1.9 +File in-portal/admin/category/addpermission_modules.php is removed; release_1_2_1 revision 1.10 +File in-portal/admin/category/addrelation.php is removed; release_1_2_1 revision 1.8 +File in-portal/admin/category/category_items.php is removed; release_1_2_1 revision 1.4 +File in-portal/admin/category/category_maint.php is removed; release_1_2_1 revision 1.23.32.1 +File in-portal/admin/category/permcacheupdate.php is removed; release_1_2_1 revision 1.10 +File in-portal/admin/category/images/ddarrow.gif is removed; release_1_2_1 revision 1.1 +File in-portal/admin/category/images/ddarrow_active.gif is removed; release_1_2_1 revision 1.1 +File in-portal/admin/category/images/ddarrow_over.gif is removed; release_1_2_1 revision 1.1 +File in-portal/admin/category/js/core.js is removed; release_1_2_1 revision 1.1 +File in-portal/admin/category/js/lang.js is removed; release_1_2_1 revision 1.1 +File in-portal/admin/category/js/main.js is removed; release_1_2_1 revision 1.1 +File in-portal/admin/help/manual.pdf changed +File in-portal/admin/install/inportal_data.sql changed +File in-portal/admin/install/inportal_remove.sql changed +File in-portal/admin/install/install_lib.php changed +File in-portal/admin/install/langpacks/english.lang changed +File in-portal/admin/install/upgrades/changelog_1_3_0.txt is new; release_1_3_0 revision 1.1.2.12 +File in-portal/admin/install/upgrades/inportal_upgrade_v1.3.0.sql is new; release_1_3_0 revision 1.1.2.1 +File in-portal/admin/install/upgrades/readme_1_3_0.txt is new; release_1_3_0 revision 1.1.2.2 +File in-portal/kernel/parser.php changed +File in-portal/kernel/admin/advanced_view.php is removed; release_1_2_1 revision 1.4 +File in-portal/kernel/admin/include/toolbar/advanced_view.php is removed; release_1_2_1 revision 1.11.2.1 +File in-portal/kernel/admin/include/toolbar/browse.php is removed; release_1_2_1 revision 1.17.2.1 +File in-portal/kernel/admin/include/toolbar/editcategory_permissions.php is removed; release_1_2_1 revision 1.1 +File in-portal/kernel/admin/include/toolbar/editcategory_relations.php is removed; release_1_2_1 revision 1.2 +File in-portal/kernel/admin/include/toolbar/editcategory_relationselect.php is removed; release_1_2_1 revision 1.6.2.1 +File in-portal/kernel/admin/include/toolbar/editgroup_permissions.php is removed; release_1_2_1 revision 1.1 +File in-portal/kernel/admin/include/toolbar/editgroup_users.php is removed; release_1_2_1 revision 1.1 +File in-portal/kernel/admin_templates/incs/config_blocks.tpl changed +File in-portal/kernel/admin_templates/incs/form_blocks.tpl changed +File in-portal/kernel/admin_templates/incs/grid_blocks.tpl changed +File in-portal/kernel/admin_templates/incs/script.js changed +File in-portal/kernel/admin_templates/regional/phrases_edit.tpl changed +File in-portal/kernel/admin_templates/tools/system_tools.tpl changed +File in-portal/kernel/include/emailmessage.php changed +File in-portal/kernel/include/image.php changed +File in-portal/kernel/include/modules.php changed +File in-portal/kernel/units/admin/admin_config.php changed +File in-portal/kernel/units/categories/categories_tag_processor.php changed +File in-portal/kernel/units/configuration/configuration_event_handler.php changed +File in-portal/kernel/units/email_events/email_events_event_handler.php changed +File in-portal/kernel/units/general/cat_event_handler.php changed +File in-portal/kernel/units/general/cat_tag_processor.php changed +File in-portal/kernel/units/general/inp_ses_storage.php changed +File in-portal/kernel/units/general/main_event_handler.php changed +File in-portal/kernel/units/general/helpers/mod_rewrite_helper.php changed +File in-portal/kernel/units/general/helpers/permissions_helper.php changed +File in-portal/kernel/units/users/users_event_handler.php changed +File in-portal/themes/default/search_results.tpl changed +File in-portal/themes/default/common/head.tpl changed +File in-portal/themes/default/common/pagetop.tpl changed +File kernel4_dev/kernel4/application.php changed +File kernel4_dev/kernel4/event_manager.php changed +File kernel4_dev/kernel4/startup.php changed +File kernel4_dev/kernel4/db/db_event_handler.php changed +File kernel4_dev/kernel4/db/db_tag_processor.php changed +File kernel4_dev/kernel4/db/dblist.php changed +File kernel4_dev/kernel4/parser/template_parser.php changed +File kernel4_dev/kernel4/processors/main_processor.php changed +File kernel4_dev/kernel4/session/session.php changed +File kernel4_dev/kernel4/utility/debugger.php changed +File kernel4_dev/kernel4/utility/email.php changed +File kernel4_dev/kernel4/utility/formatters/password_formatter.php changed +File cmseditor/fckeditor.js changed +File cmseditor/editor/filemanager/browser/default/connectors/php/commands.php changed + + +Changes in phrases and events: + + Index: trunk/themes/default/search_results.tpl =================================================================== diff -u -N -r1566 -r6428 --- trunk/themes/default/search_results.tpl (.../search_results.tpl) (revision 1566) +++ trunk/themes/default/search_results.tpl (.../search_results.tpl) (revision 6428) @@ -37,7 +37,7 @@ - + @@ -76,7 +76,7 @@

-
"> + "> " class="input" style="width: 235px;">  " class="button">
@@ -157,7 +157,7 @@
- + @@ -176,7 +176,7 @@
- + Index: trunk/kernel/include/image.php =================================================================== diff -u -N -r4645 -r6428 --- trunk/kernel/include/image.php (.../image.php) (revision 4645) +++ trunk/kernel/include/image.php (.../image.php) (revision 6428) @@ -905,8 +905,9 @@ function &GetAvatarImage($ResourceId) { - $sql = 'SELECT * FROM '.$this->SourceTable. - ' WHERE ResourceId='.$ResourceId.' AND Name="avatar" AND Enabled=1 + $sql = 'SELECT * + FROM '.$this->SourceTable.' + WHERE ResourceId = '.(int)$ResourceId.' AND Name = "avatar" AND Enabled = 1 LIMIT 1'; $rs = $this->adodbConnection->Execute($sql); if($rs && ! $rs->EOF) @@ -917,8 +918,9 @@ $img->Clean(); return $img; } - else - return FALSE; + else { + return false; + } } function HandleImageUpload($FILE,$ResourceId,$RelatedTo,$DestDir, $Name="",$AltName="",$IsThumb=0) Index: trunk/kernel/units/general/cat_event_handler.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6093) +++ trunk/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6428) @@ -376,8 +376,6 @@ $excepts_and_filter_h =& $this->Application->makeClass('kMultipleFilter'); $excepts_and_filter_h->setType(FLT_TYPE_AND); - $except_types_array = explode(',', $types); - if ($types) { $types_array = explode(',', $types); for ($i = 0; $i < sizeof($types_array); $i++) { @@ -681,10 +679,11 @@ $object =& $event->getObject(); $this->Application->SetVar($event->getPrefixSpecial().'_Page', 1); $lang = $this->Application->GetVar('m_lang'); - $product_table = $this->Application->getUnitOption('p', 'TableName'); + $items_table = $this->Application->getUnitOption($event->Prefix, 'TableName'); + $module_name = $this->Application->findModule('Var', $event->Prefix, 'Name'); $sql = ' SELECT * FROM '.$this->Application->getUnitOption('confs', 'TableName').' - WHERE ModuleName="In-Commerce" + WHERE ModuleName="'.$module_name.'" AND SimpleSearch=1'; $search_config = $this->Conn->Query($sql, 'FieldName'); $field_list = array_keys($search_config); @@ -699,7 +698,7 @@ $custom_fields = $this->Application->getUnitOption($event->Prefix, 'CustomFields'); if ($custom_fields) { $custom_table = $this->Application->getUnitOption($event->Prefix.'-cdata', 'TableName'); - $join_clauses[] = ' LEFT JOIN '.$custom_table.' custom_data ON '.$product_table.'.ResourceId = custom_data.ResourceId'; + $join_clauses[] = ' LEFT JOIN '.$custom_table.' custom_data ON '.$items_table.'.ResourceId = custom_data.ResourceId'; } // what field in search config becomes what field in sql (key - new field, value - old field (from searchconfig table)) @@ -740,17 +739,31 @@ } else { + $multi_lingual = false; + if ($exploded[0] == 'MULTI') + { + $multi_lingual = true; + $foreign_field = $exploded[1]; + } $exploded = explode('.', $foreign_field); // format: table.field_name $foreign_table = TABLE_PREFIX.$exploded[0]; $alias_counter++; $alias = 't'.$alias_counter; - $field_list[$key] = $alias.'.'.$exploded[1]; - $search_config_map[ $field_list[$key] ] = $field; + if ($multi_lingual) { + $field_list[$key] = $alias.'.'.'l'.$lang.'_'.$exploded[1]; + $field_list[$key.'_primary'] = 'l'.$this->Application->GetDefaultLanguageId().'_'.$field; + $search_config_map[ $field_list[$key] ] = $field; + $search_config_map[ $field_list[$key.'_primary'] ] = $field; + } + else { + $field_list[$key] = $alias.'.'.$exploded[1]; + $search_config_map[ $field_list[$key] ] = $field; + } $join_clause = str_replace('{ForeignTable}', $alias, $search_config[$field]['JoinClause']); - $join_clause = str_replace('{LocalTable}', $product_table, $join_clause); + $join_clause = str_replace('{LocalTable}', $items_table, $join_clause); $join_clauses[] = ' LEFT JOIN '.$foreign_table.' '.$alias.' ON '.$join_clause; @@ -771,20 +784,20 @@ $search_helper =& $this->Application->recallObject('SearchHelper'); $where_clause = $search_helper->buildWhereClause($keywords, $field_list); - $where_clause = $where_clause.' AND '.$product_table.'.Status=1'; + $where_clause = $where_clause.' AND '.$items_table.'.Status=1'; if($this->Application->GetVar('Action') == 'm_simple_subsearch') // subsearch, In-portal { if( $event->getEventParam('ResultIds') ) { - $where_clause .= ' AND '.$product_table.'.ResourceId IN ('.implode(',', $event->specificParams['ResultIds']).')'; + $where_clause .= ' AND '.$items_table.'.ResourceId IN ('.implode(',', $event->specificParams['ResultIds']).')'; } } if( $event->MasterEvent && $event->MasterEvent->Name == 'OnListBuild' ) // subsearch, k4 { if( $event->MasterEvent->getEventParam('ResultIds') ) { - $where_clause .= ' AND '.$product_table.'.ResourceId IN ('.implode(',', $event->MasterEvent->getEventParam('ResultIds')).')'; + $where_clause .= ' AND '.$items_table.'.ResourceId IN ('.implode(',', $event->MasterEvent->getEventParam('ResultIds')).')'; } } @@ -801,34 +814,45 @@ $revelance_parts[] = 'IF('.$field.' LIKE "%'.$keyword.'%", '.$weight.', 0)'; } } - $rel_keywords = $this->Application->ConfigValue('SearchRel_Keyword_products') / 100; - $rel_pop = $this->Application->ConfigValue('SearchRel_Pop_products') / 100; - $rel_rating = $this->Application->ConfigValue('SearchRel_Rating_products') / 100; + $conf_postfix = $this->Application->getUnitOption($event->Prefix, 'SearchConfigPostfix'); + $rel_keywords = $this->Application->ConfigValue('SearchRel_Keyword_'.$conf_postfix) / 100; + $rel_pop = $this->Application->ConfigValue('SearchRel_Pop_'.$conf_postfix) / 100; + $rel_rating = $this->Application->ConfigValue('SearchRel_Rating_'.$conf_postfix) / 100; $relevance_clause = '('.implode(' + ', $revelance_parts).') / '.$weight_sum.' * '.$rel_keywords; - $relevance_clause .= ' + (Hits + 1) / (MAX(Hits) + 1) * '.$rel_pop; - $relevance_clause .= ' + (CachedRating + 1) / (MAX(CachedRating) + 1) * '.$rel_rating; + if ($rel_pop && isset($object->Fields['Hits'])) { + $relevance_clause .= ' + (Hits + 1) / (MAX(Hits) + 1) * '.$rel_pop; + } + if ($rel_rating && isset($object->Fields['CachedRating'])) { + $relevance_clause .= ' + (CachedRating + 1) / (MAX(CachedRating) + 1) * '.$rel_rating; + } // building final search query - if (!$this->Application->GetVar('INPORTAL_ON')) { + if (!$this->Application->GetVar('do_not_drop_search_table') && !$this->Application->GetVar('INPORTAL_ON')) { $this->Conn->Query('DROP TABLE IF EXISTS '.$search_table); // erase old search table if clean k4 event + $this->Application->SetVar('do_not_drop_search_table', true); } - if ($this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"')) { + + $search_table_exists = $this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"'); + if ($search_table_exists) { $select_intro = 'INSERT INTO '.$search_table.' (Relevance, ItemId, ResourceId, ItemType, EdPick) '; } else { $select_intro = 'CREATE TABLE '.$search_table.' AS '; } + $edpick_clause = $this->Application->getUnitOption($event->Prefix.'.EditorsPick', 'Fields') ? $items_table.'.EditorsPick' : '0'; + + $sql = $select_intro.' SELECT '.$relevance_clause.' AS Relevance, - '.$product_table.'.ProductId AS ItemId, - '.$product_table.'.ResourceId, - 11 AS ItemType, - '.$product_table.'.EditorsPick AS EdPick + '.$items_table.'.'.$this->Application->getUnitOption($event->Prefix, 'IDField').' AS ItemId, + '.$items_table.'.ResourceId, + '.$this->Application->getUnitOption($event->Prefix, 'ItemType').' AS ItemType, + '.$edpick_clause.' AS EdPick FROM '.$object->TableName.' '.implode(' ', $join_clauses).' WHERE '.$where_clause.' - GROUP BY '.$product_table.'.ProductId'; + GROUP BY '.$items_table.'.'.$this->Application->getUnitOption($event->Prefix, 'IDField'); $res = $this->Conn->Query($sql); } @@ -1887,7 +1911,6 @@ } } } - } ?> \ No newline at end of file Index: trunk/index.php =================================================================== diff -u -N -r5547 -r6428 --- trunk/index.php (.../index.php) (revision 5547) +++ trunk/index.php (.../index.php) (revision 6428) @@ -15,9 +15,9 @@ //print_pre(get_included_files()); -function getmicrotime() -{ - list($usec, $sec) = explode(" ", microtime()); - return ((float)$usec + (float)$sec); -} +function getmicrotime() +{ + list($usec, $sec) = explode(" ", microtime()); + return ((float)$usec + (float)$sec); +} ?> \ No newline at end of file Index: trunk/admin/install/inportal_remove.sql =================================================================== diff -u -N -r4790 -r6428 --- trunk/admin/install/inportal_remove.sql (.../inportal_remove.sql) (revision 4790) +++ trunk/admin/install/inportal_remove.sql (.../inportal_remove.sql) (revision 6428) @@ -207,4 +207,10 @@ DROP TABLE TopicCustomData # -------------------------------------------------------- DROP TABLE ImportCache +# -------------------------------------------------------- +DROP TABLE FormFields +# -------------------------------------------------------- +DROP TABLE Forms +# -------------------------------------------------------- +DROP TABLE FormSubmissions # \ No newline at end of file Index: trunk/kernel/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 6093) +++ trunk/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 6428) @@ -190,6 +190,8 @@ } unset($params['cat_id']); + $params['pass_category'] = 1; + $main_processor =& $this->Application->recallObject('m_TagProcessor'); return $main_processor->T($params); } Index: trunk/kernel/units/general/cat_tag_processor.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/kernel/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 6093) +++ trunk/kernel/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 6428) @@ -36,21 +36,31 @@ return isset($icons[$value]) ? $icons[$value] : $icons['default']; } - function ItemLink($params) + /** + * Allows to create valid mod-rewrite compatible link to module item + * + * @param Array $params + * @param string $id_prefix + * @return string + */ + function ItemLink($params, $id_prefix) { - // 'p_id'=>'0', ?? - $params = array_merge($params, array('pass'=>'m,'.$this->Prefix)); - $item_id = getArrayValue($params,$this->Prefix.'_id'); + $params = array_merge($params, Array('pass' => 'm,'.$this->Prefix) ); + + $item_id = isset($params[$id_prefix.'_id']) && $params[$id_prefix.'_id']; if (!$item_id) { - $item_id = $this->Application->GetVar($this->Prefix.'_id'); + $item_id = $this->Application->GetVar($this->getPrefixSpecial().'_id'); + if (!$item_id) { + $item_id = $this->Application->GetVar($this->Prefix.'_id'); + } } $params[$this->Prefix.'_id'] = $item_id; - $item =& $this->Application->recallObject($this->getPrefixSpecial()); - $params['m_cat_id'] = $item->GetDBField('CategoryId'); + $object =& $this->getObject($params); + $params['m_cat_id'] = $object->GetDBField('CategoryId'); + $params['pass_category'] = 1; - $main_processor =& $this->Application->recallObject('m_TagProcessor'); - return $main_processor->T($params); + return $this->Application->ProcessParsedTag('m', 't', $params); } /** Index: trunk/kernel/admin/include/toolbar/editgroup_permissions.php =================================================================== diff -u -N --- trunk/kernel/admin/include/toolbar/editgroup_permissions.php (revision 13) +++ trunk/kernel/admin/include/toolbar/editgroup_permissions.php (revision 0) @@ -1,41 +0,0 @@ - - - - -END; -?> Index: trunk/core/kernel/utility/email.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/kernel/utility/email.php (.../email.php) (revision 6093) +++ trunk/core/kernel/utility/email.php (.../email.php) (revision 6428) @@ -34,7 +34,10 @@ //$this->TextBoundary = uniqid(adodb_mktime()); $this->EmailBoundary = uniqid(adodb_mktime()); $this->LineFeed = "\n"; - $this->Charset='ISO-8859-1'; + + $lang =& $this->Application->recallObject('lang.current'); + $this->Charset = $lang->GetDBField('Charset') ? $lang->GetDBField('Charset') : 'ISO-8859-1'; + $this->TransferEncoding='8bit'; $this->Body = ''; $this->setHeader('Subject', 'Automatically generated message'); Index: trunk/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 6093) +++ trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 6428) @@ -121,7 +121,7 @@ function FormAction($params) { - return $this->Application->ProcessParsedTag('m', 't', array_merge($params, Array('pass'=>'all,m' )) ); + return $this->Application->ProcessParsedTag('m', 't', array_merge($params, Array('pass'=>'all,m', 'pass_category' => 1 )) ); } /*// NEEDS TEST @@ -375,6 +375,9 @@ else { $o .= "\n"; } + if ($this->Application->GetVar('admin') == 1) { + $o .= "\n"; + } return $o; } @@ -522,7 +525,7 @@ if (!$t) { trigger_error('Template name not specified in <inp2:m_include .../> tag', E_USER_ERROR); } - + $res = $BlockParser->ParseTemplate( $t, 1, $params, isset($params['is_silent']) ? 1 : 0 ); if ( !$BlockParser->DataExists && (isset($params['data_exists']) || isset($params['block_no_data'])) ) { @@ -895,11 +898,21 @@ function XMLTemplate($params) { - define('DBG_SKIP_REPORTING', 1); + safeDefine('DBG_SKIP_REPORTING', 1); $lang =& $this->Application->recallObject('lang.current'); header('Content-type: text/xml; charset='.$lang->GetDBField('Charset')); } + function Header($params) + { + header($params['data']); + } + + function NoDebug($params) + { + define('DBG_SKIP_REPORTING', 1); + } + function RootCategoryName($params) { $root_phrase = $this->Application->ConfigValue('Root_Name');