Index: trunk/kernel/action.php =================================================================== --- trunk/kernel/action.php (revision 292) +++ trunk/kernel/action.php (revision 293) @@ -1,2261 +1,2262 @@ <?php $ro_perm = $objSession->HasSystemPermission("SYSTEM_ACCESS.READONLY"); if( defined('DEBUG_ACTIONS') && (DEBUG_ACTIONS & KERNEL_ACTIONS) == KERNEL_ACTIONS ) { if($Action) echo '<span class="debug_text">Kernel Action [<b>'.$Action."</b>]</span><br>\n"; } if( defined('DEBUG_ACTIONS') && (DEBUG_ACTIONS & SHOW_REQUEST) == SHOW_REQUEST ) { // don't show debug output in tree & header of admin & while logging in $script = basename($_SERVER['PHP_SELF']); $skip_debug = Array('index.php','tree.php','head.php','credits.php'); if( !in_array($script, $skip_debug) ) { echo "ScriptName: <b>$script</b> (<b>".dirname($_SERVER['PHP_SELF'])."</b>)<br><br>"; $div_height = (count($_REQUEST)+1)*26; if($div_height > 300) $div_height = 300; echo '<div class="debug_layer" style="height: '.$div_height.'px;">'; echo '<table border="0" cellspacing="0" cellpadding="4" class="debug_table">'; echo '<thead style="font-weight: bold;"><td>Src</td><td>Name</td><td>Value</td></thead>'; foreach($_REQUEST as $key => $value) { if( !is_array($value) && trim($value) == '' ) $value = ' '; $src = isset($_GET[$key]) ? 'GE' : (isset($_POST[$key]) ? 'PO' : (isset($_COOKIE[$key]) ? 'CO' : '?') ); echo '<tr><td>'.$src.'</td><td>'.$key.'</td><td>'.print_r($value, true).'</td></tr>'; } echo '</table></div>'; echo '<a href="javascript:self.location.reload();">Reload Frame</a>'; } unset($script, $skip_debug); } switch($Action) { case "m_save_import_config": // Set New Import Category if( isset($_POST['categorylist']) ) { $cat_id = $_POST['categorylist']; $objSession->SetVariable('categoryid', $cat_id); $cat = $objCatList->GetByResource($cat_id); if(is_object($cat)) { $navbar = $cat->Get('CachedNavbar'); $objSession->SetVariable('catnavbar', $navbar); $objSession->SetVariable('import_category_id', $cat->UniqueId() ); } $objSession->SetVariable('categorylist', $_POST['categorylist']); } // Set Import Admin Group if( isset($_POST['grouplist1']) ) { $group_id = $_POST['grouplist1']; $group = $objGroups->GetItem($group_id); $objSession->SetVariable('user_admin_names', $group->Get('Name')); $objSession->SetVariable('user_admin_values', $group->Get('GroupId')); $objSession->SetVariable('grouplist1', $_POST['grouplist1']); } // Set Import User Group if( isset($_POST['grouplist2']) ) { $group_id = $_POST['grouplist2']; $group = $objGroups->GetItem($group_id); $objSession->SetVariable('user_regular_names', $group->Get('Name')); $objSession->SetVariable('user_regular_values', $group->Get('GroupId')); $objSession->SetVariable('grouplist2', $_POST['grouplist2']); } break; case "m_add_user": $dupe_user = ''; //$user_pending = (int)$_POST["user_pending"]; //$user_enabled = (int)$_POST["user_enabled"]; $CreatedOn = DateTimestamp($_POST["user_date"],GetDateFormat()); $dob = DateTimestamp($_POST["user_dob"],GetDateFormat()); $objEditItems = new clsUserManager(); $objEditItems->SourceTable = $objSession->GetEditTable("PortalUser"); if(strlen($_POST["user_login"])) $id = $objUsers->GetUserId($_POST["user_login"]); else $dob = 0; if($id) { $lvErrorString = language('la_error_duplicate_username'); $dupe_user = $_POST["user_login"]; $_POST["user_login"] = ''; } $password = md5($_POST["password"]); $u = $objEditItems->Add_User($_POST["user_login"], $password, $_POST["user_email"], $CreatedOn, $_POST["user_firstname"], $_POST["user_lastname"], $_POST["status"], $_POST["user_phone"], $_POST["user_street"], $_POST["user_city"], $_POST["user_state"], $_POST["user_zip"], $_POST["user_country"], $dob); $objCustomEdit = new clsCustomDataList(); //$objSession->GetEditTable("CustomMetaData")); $objCustomEdit->SetTable('edit'); $objCustomEdit->LoadResource($u->Get("ResourceId")); $CustomFields = new clsCustomFieldList(6); $DataChanged = FALSE; foreach($_POST as $key=>$value) { if(substr($key,0,1)=="_") { $field = substr($key,1); $cvalue = $CustomFields->GetItemByField("FieldName",$field,FALSE); if(is_object($cvalue)) { $objCustomEdit->SetFieldValue($cvalue->Get("CustomFieldId"),$u->Get("ResourceId"),$value); $DataChanged = TRUE; } } } if($DataChanged) $objCustomEdit->SaveData(); $objCustomEdit->SetTable('live'); break; case "m_edit_user": $CreatedOn = DateTimestamp($_POST["user_date"],GetDateFormat()); $dob = DateTimestamp($_POST["user_dob"],GetDateFormat()); $objEditItems = new clsUserManager(); $objEditItems->SourceTable = $objSession->GetEditTable("PortalUser"); //$user_pending = (int)$_POST["user_pending"]; //$user_enabled = (int)$_POST["user_enabled"]; $UserId = (int)$_POST["user_id"]; //echo $UserId."<br>\n"; if(!strlen($_POST["user_login"])) $dob = 0; if(strlen($_POST["password"])) { $password = md5($_POST["password"]); } else $password = ""; $u = $objEditItems->Edit_User($UserId, $_POST["user_login"], $password, $_POST["user_email"], $CreatedOn, $_POST["user_firstname"], $_POST["user_lastname"], $_POST["status"], $_POST["user_phone"], $_POST["user_street"], $_POST["user_city"], $_POST["user_state"], $_POST["user_zip"], $_POST["user_country"], $dob); $objCustomEdit = new clsCustomDataList(); //$objSession->GetEditTable("CustomMetaData")); $objCustomEdit->SetTable('edit'); $DataChanged = false; $objCustomEdit->LoadResource($u->Get("ResourceId")); $CustomFields = new clsCustomFieldList(6); foreach($_POST as $key=>$value) { if(substr($key,0,1)=="_") { $field = substr($key,1); $cvalue = $CustomFields->GetItemByField("FieldName",$field,FALSE); if(is_object($cvalue)) { //echo "Saving CF: (".$cvalue->Get("CustomFieldId")." ; ".$u->Get("ResourceId")." ; $value)<br>"; $objCustomEdit->SetFieldValue($cvalue->Get("CustomFieldId"),$u->Get("ResourceId"),$value); $DataChanged = TRUE; } } } if($DataChanged) $objCustomEdit->SaveData(); $objCustomEdit->SetTable('live'); break; case "m_user_primarygroup": //print_pre($_REQUEST); if($ro_perm) break; $users = explode(',', $_POST["userlist"]); $GroupResourceId = $_POST['grouplist']; $g = $objGroups->GetItemByField("ResourceId", $GroupResourceId); $GroupId = $g->UniqueId(); if( is_array($users) ) foreach($users as $user_id) { $u = $objUsers->GetItemByField("ResourceId", $user_id); $g->AddUser($u->Get("PortalUserId"), 1); } break; case "m_edit_group": $objEditItems = new clsGroupList(); $objEditItems->SourceTable = $objSession->GetEditTable("PortalGroup"); $objEditItems->Edit_Group($_POST["group_id"], $_POST["group_name"],$_POST["group_comments"]); break; case "m_add_group": $objEditItems = new clsGroupList(); $objEditItems->SourceTable = $objSession->GetEditTable("PortalGroup"); $objEditItems->Add_Group($_POST["group_name"], $_POST["group_comments"],0); break; case "m_group_sysperm": if($_POST["GroupEditStatus"]==0) { $objSession->ResetSysPermCache(); $GroupId = $_POST["GroupId"]; if($GroupId) { $objEditItems = new clsGroupList(); $objEditItems->SourceTable = $objSession->GetEditTable("PortalGroup"); $g = $objEditItems->GetItemByField("ResourceId",$GroupId); if(is_object($g)) { $PermList = explode(",",$_POST["PermList"]); for($i=0;$i<count($PermList);$i++) { if(@in_array($PermList[$i],$_POST["inherit"])) { $value = -1; } else { $value = 0; if(@in_array($PermList[$i],$_POST["permvalue"])) $value = 1; } $g->SetSystemPermission($PermList[$i],$value); } } } } break; case "m_user_sysperm": if($ro_perm) break; if($_POST["UserEditStatus"]==0) { $UserId = $_POST["ItemId"]; if($UserId) { $objEditItems = new clsUserManager(); $objEditItems->SourceTable = $objSession->GetEditTable("PortalUser"); $u = $objEditItems->GetItemByField("ResourceId",$UserId); unset($g); if(is_object($u)) { $objSession->ResetSysPermCache(); $g = $u->GetPersonalGroup(FALSE); $PermList = explode(",",$_POST["PermList"]); for($i=0;$i<count($PermList);$i++) { if(!@in_array($PermList[$i],$_POST["inherit"])) { if(!is_object($g)) $g = $u->GetPersonalGroup(TRUE); $value = 0; if(is_array($_POST["permvalue"])) { if(in_array($PermList[$i],$_POST["permvalue"])) $value =1; $g->SetSystemPermission($PermList[$i],$value); } else $g->SetSystemPermission($PermList[$i],-1); } else { if(is_object($g)) $g->SetSystemPermission($PermList[$i],-1); } } } } } break; case "m_approve_user": if($ro_perm) break; foreach($_POST["itemlist"] as $userid) { $user = $objUsers->GetItemByField("ResourceId",$userid); $user->Approve(); } $objUsers->Clear(); break; case "m_deny_user": if($ro_perm) break; foreach($_POST["itemlist"] as $userid) { $user = $objUsers->GetItemByField("ResourceId",$userid); $user->Deny(); } $objUsers->Clear(); break; case "m_delete_user": if($ro_perm) break; foreach($_POST["itemlist"] as $userid) $objUsers->Delete_User($userid); break; case "m_delete_group": if($ro_perm) break; foreach($_POST["itemlist"] as $groupid) { $objGroups->Delete_Group($groupid); } break; case "m_user_assign": $useridlist = implode("-", $userlist); $objSession->SetUserStatus($useridlist, "g_usergroup_status"); $g_usergroup_status = $useridlist; break; case "m_group_assign": foreach($grouplist as $group) $objGroups->Add_Users_To_Group($group); break; case "m_remove_group": $adodbConnection = GetAdodbConnection(); $adodbConnection->Execute("DELETE FROM UserGroup where UserId='$UserId' AND GroupId='$GroupId'"); break; case "m_SetVariable": $objSession->SetPersistantVariable($_POST["fieldname"], $_POST["varvalue"]); break; case "m_SetSessionVariable": $objSession->SetVariable($_POST["fieldname"], $_POST["varvalue"]); //echo "Setting $fieldname to $varvalue<br>\n"; if($_POST["fieldname"]=="SearchType") $objSession->SetVariable("SearchWord",""); break; case "m_edit_permissions": if($ro_perm) break; if($_POST["CatEditStatus"] != -1) { $objSession->SetVariable('PermCache_UpdateRequired', 1); $GroupId = $_POST["GroupId"]; $CatId = $_POST["CategoryId"]; $Module = $_POST["Module"]; $ado = GetADODBConnection(); $sql = "SELECT * FROM ".GetTablePrefix()."PermissionConfig WHERE ModuleId='$Module'"; $rs = $ado->Execute($sql); $PermNames = array(); while($rs && !$rs->EOF) { $data = $rs->fields; $PermNames[] = $data["PermissionName"]; $rs->MoveNext(); } $inherit = array(); if(is_array($_POST["inherit"])) { foreach($_POST["inherit"] as $perm) { $inherit[$perm] = 1; } } $access = array(); if(is_array($_POST["permvalue"])) { foreach($_POST["permvalue"] as $perm) { $access[$perm] = 1; } } $objPermList = new clsPermList($CatId,$GroupId); $objPermList->LoadCategory($CatId); for($i=0;$i<count($PermNames);$i++) { if(!array_key_exists($PermNames[$i],$inherit)) { $PermValue = (int)$access[$PermNames[$i]]; $Perm = $objPermList->GetPermByName($PermNames[$i]); if($Perm) { $Id = $Perm->Get("PermissionId"); //echo "Editing $Id<br>\n"; $objPermList->Edit_Permission($Id,$CatId,$GroupId,$PermNames[$i],$PermValue,0); } else { //echo "Adding ".$PermNames[$i]; $objPermList->Add_Permission($CatId,$GroupId,$PermNames[$i],$PermValue,0); } } else { $Perm = $objPermList->GetPermByName($PermNames[$i]); if($Perm) { $Id = $Perm->Get("PermissionId"); $objPermList->Delete_Permission($Id); } } } //$c = $objCatList->GetItem($CatId); //$glist = $objGroups->GetAllGroupList(); //$ViewList = $objPermList->GetGroupPermList($c,"CATEGORY.VIEW",$glist ); //$c->SetViewPerms("CATEGORY.VIEW",$ViewList,$glist); //$c->Update(); } break; case "m_perm_delete_group": $ado = GetADODBConnection(); $CatId = $_POST["CategoryId"]; foreach($_POST["itemlist"] as $groupid) { $g = $objGroups->GetItemByField("ResourceId",$groupid); if(is_object($g)) { $sql = "DELETE FROM ".GetTablePrefix()."Permissions WHERE CatId=$CatId AND GroupId=".$g->Get("GroupId"); if($objSession->HasSystemPermission("DEBUG.LIST")) echo $sql."<br>\n"; $ado->Execute($sql); } } break; case "m_user_addto_group": if($ro_perm) break; $user = $_POST["UserId"]; if(is_numeric($user)) { if(strlen($_POST["grouplist"])) { $groups = explode(",",$_POST["grouplist"]); if(is_array($groups)) { for($i=0; $i<count($groups);$i++) { $g = $objGroups->GetItemByField("ResourceId",$groups[$i]); $g->AddUser($user); } } else { $g = $objGroups->GetItem($groups); $g->AddUser($user); } } } break; case "m_group_add_user": if($ro_perm) break; $group = $_POST["GroupId"]; $EditGroups = new clsGroupList(); $EditGroups->SourceTable = $objSession->GetEditTable($objGroups->SourceTable); $g = $EditGroups->GetItem($group); // echo "Group: $group <br>\n"; if(is_numeric($group)) { $users = explode(",",$_POST["userlist"]); foreach($users as $userid) { $u = $objUsers->GetItemByField("ResourceId",$userid); $g->AddUser($u->Get("PortalUserId")); } } break; case "m_group_removeuser": if($ro_perm) break; $group = $_POST["GroupId"]; $g = $objGroups->GetItem($group); if($group>0) { foreach($_POST["itemlist"] as $user_id) { $u = $objUsers->GetItemByField("ResourceId",$user_id); $g->DeleteUser($u->Get("PortalUserId")); } } break; case "m_user_removegroup": if($ro_perm) break; $user = $_POST["UserId"]; if($user>0) { foreach($_POST["itemlist"] as $groupid) { $g = $objGroups->GetItem($groupid); $g->DeleteUser($user); } } break; case "m_sendmail": $idlist = explode(",",$_POST["idlist"]); $html = (int)$_POST["html_enable"]; $body = inp_escape($_POST["email_body"],$html); $subject = inp_escape($_POST["email_body"],$html); $Email = new clsEmailMessage(); $Email->Set("Subject",$subject); $Email->Set("Template",$body); if($html) $Email->Set("MessageType","HTML"); if(count($idlist)>0) { switch($_POST["IdType"]) { case "group": foreach($idlist as $id) $Email->SendToGroup($id); break; case "user": foreach($idlist as $id) $Email->SendToUser($id); break; }/*switch*/ } break; case "m_item_recount": RunDown($m_var_list["cat"],"UpdateCacheCounts"); break; case "m_cat_delete": if($objSession->HasCatPermission("CATEGORY.DELETE",$objCatList->CurrentCategoryID())) { if(isset($_POST["catlist"])) { if(is_array($_POST["catlist"])) foreach($_POST["catlist"] as $catid) { $objCatList->Delete_Category($catid); } } } break; case "m_cat_cut": if(isset($_POST["catlist"])) { if($objSession->HasCatPermission("CATEGORY.DELETE",$catid)) { $objCatList->CopyToClipboard("CUT","CategoryId",$_POST["catlist"]); } else $objCatList->CopyToClipboard("COPY","CategoryId",$_POST["catlist"]); } break; case "m_cat_copy": if(isset($_POST["catlist"])) { $objCatList->CopyToClipboard("COPY","CategoryId",$_POST["catlist"]); } break; case "m_paste": if($objCatList->ItemsOnClipboard()>0) { /* category's paste function populates a sparse array where array[old_id]=new_id */ $PastedCatIds = array(); $objCatList->PasteFromClipboard($objCatList->CurrentCategoryID(),"Name"); } else { $clip = $objSession->GetVariable("ClipBoard"); if(strlen($clip)) { $ClipBoard = ParseClipboard($clip); $Action= strtolower($ClipBoard["table"])."_paste"; } } break; case "m_cat_move_up": if (isset($_POST["catlist"])) { foreach($_POST["catlist"] as $catid) { $cat =& $objCatList->GetCategory($catid); $cat->MoveUp(); } } break; case "m_cat_move_down": if (isset($_POST["catlist"])) { $catlist=array_reverse($_POST["catlist"]); foreach($catlist as $catid) { $cat =& $objCatList->GetCategory($catid); $cat->MoveDown(); } } break; case "m_cat_approve": if (isset($_POST["catlist"])) { foreach($_POST["catlist"] as $catid) { $cat =& $objCatList->GetCategory($catid); $cat->Approve(); } } break; case "m_cat_decline": if (isset($_POST["catlist"])) { foreach($_POST["catlist"] as $catid) { $cat =& $objCatList->GetCategory($catid); // $cat->Deny(); RunDown($catid,"Deny"); } } break; case "m_rel_delete": $adodbConnection= GetADODBConnection(); $table = $objSession->GetEditTable("Relationship"); if(isset($_POST["itemlist"])) { if(is_array($_POST["itemlist"])) { foreach($_POST["itemlist"] as $id) { $sql = "DELETE FROM ".$table." WHERE RelationshipId=".$id; $adodbConnection->Execute($sql); if($objSession->HasSystemPermission("DEBUG.LIST")) echo $sql."<br>\n"; } } else { $sql = "DELETE FROM ".$table." WHERE RelationshipId=".$_POST["itemlist"]; $adodbConnection->Execute($sql); if($objSession->HasSystemPermission("DEBUG.LIST")) echo $sql."<br>\n"; } } break; case "m_add_relation": if($_POST["CatEditStatus"]==0) { $RelList = new clsRelationshipList(); $RelList->SourceTable = $objSession->GetEditTable("Relationship"); //$r = $RelList->Add($_POST["SourceId"],$_POST["SourceType"],$_POST["TargetId"],$_POST["TargetType"], // 0,(int)$_POST["Enabled"],$_POST["RelType"], $Rel); $ado = GetADODBConnection(); $rs = $ado->Execute("SELECT MIN(RelationshipId) as MinValue FROM ".$RelList->SourceTable); $NewId = $rs->fields["MinValue"]-1; $r = $RelList->Add($_POST["SourceId"],$_POST["SourceType"],$_POST["TargetId"],$_POST["TargetType"], 0,(int)$_POST["Enabled"],$_POST["RelType"], $NewId); $sql = "UPDATE ".$RelList->SourceTable." SET RelationshipId=".$NewId." WHERE RelationshipId=".$r->Get("RelationshipId"); if($objSession->HasSystemPermission("DEBUG.LIST")) echo $sql."<br>\n"; $ado->Execute($sql); } break; case "m_edit_relation": if($_POST["CatEditStatus"]==0) { $RelList = new clsRelationshipList(); $RelList->SourceTable = $objSession->GetEditTable("Relationship"); $r = $RelList->GetItem($_POST["RelationshipId"]); if(is_object($r)) { $r->Set("Enabled",(int)$_POST["Enabled"]); $r->Set("Type",(int)$_POST["RelType"]); $r->Set("Priority",(int)$_POST["priority"]); $r->Update(); } } break; case "m_rel_move_up": $objRelList = new clsRelationshipList(); $objRelList->SourceTable = $objSession->GetEditTable("Relationship"); if (isset($_POST["itemlist"])) { foreach($_POST["itemlist"] as $id) { $r = $objRelList->GetItem($id); $r->MoveUp($_POST["SourceId"]); } } break; case "m_rel_move_down": $objRelList = new clsRelationshipList(); $objRelList->SourceTable = $objSession->GetEditTable("Relationship"); if (isset($_POST["itemlist"])) { $itemlist=array_reverse($_POST["itemlist"]); foreach($itemlist as $id) { $r = $objRelList->GetItem($id); $r->MoveDown($_POST["SourceId"]); } } break; case "m_add_category": if(ValidDate($_POST["cat_date"],GetDateFormat())) { $CreatedOn = DateTimestamp($_POST["cat_date"],GetDateFormat()); } else $CreatedOn = time(); $html = (int)$_POST["html_enable"]; $cat_pick = $_POST["cat_pick"]; $Status = (int)$_POST["status"]; $Hot=(int)$_POST["itemhot"]; $Pop = (int)$_POST["itempop"]; $New = (int)$_POST["itemnew"]; $objEditItems = new clsCatList(); $objEditItems->SourceTable = $objSession->GetEditTable("Category"); $cat = $objEditItems->Add($_POST["ParentId"], $_POST["cat_name"], inp_escape($_POST["cat_desc"],$html), $CreatedOn, $cat_pick, $Status, $Hot, $New, $Pop, $_POST["Priority"], $_POST["meta_keywords"],$_POST["meta_desc"]); $objCustomEdit = new clsCustomDataList($objSession->GetEditTable("CustomMetaData")); $objCustomEdit->LoadResource($cat->Get("ResourceId")); $CustomFields = new clsCustomFieldList(1); $DataChanged = FALSE; foreach($_POST as $key=>$value) { if(substr($key,0,1)=="_") { $field = substr($key,1); $cvalue = $CustomFields->GetItemByField("FieldName",$field,FALSE); if(is_object($cvalue)) { $objCustomEdit->SetFieldValue($cvalue->Get("CustomFieldId"),$cat->Get("ResourceId"),$value); $DataChanged = TRUE; } } } if($DataChanged) $objCustomEdit->SaveData(); break; case "m_edit_category": $CreatedOn = DateTimestamp($_POST["cat_date"],GetDateFormat()); $cat_pick = $_POST["cat_pick"]; $Status = (int)$_POST["status"]; $Hot=(int)$_POST["itemhot"]; $Pop = (int)$_POST["itempop"]; $New = (int)$_POST["itemnew"]; $html = (int)$_POST["html_enable"]; $objEditItems = new clsCatList(); $objEditItems->SourceTable = $objSession->GetEditTable("Category"); // check if name of cat isn't changed: begin $original_cats = new clsCatList(); $original_cat = $original_cats->GetItemByField('CategoryId', $_POST['CategoryId']); if( $original_cat->Get('Name') != $_POST['cat_name'] ) $objSession->SetVariable('PermCache_UpdateRequired', 1); unset($original_cat, $original_cats); // check if name of cat isn't changed: end $cat = $objEditItems->Edit_Category($_POST["CategoryId"],inp_escape($_POST["cat_name"],$html), inp_escape($_POST["cat_desc"],$html), $CreatedOn, $cat_pick, $Status, $Hot, $New, $Pop, $_POST["Priority"], $_POST["meta_keywords"], $_POST["meta_desc"]); $objCustomEdit = new clsCustomDataList($objSession->GetEditTable("CustomMetaData")); $objCustomEdit->LoadResource($cat->Get("ResourceId")); $CustomFields = new clsCustomFieldList(1); $DataChanged = FALSE; foreach($_POST as $key=>$value) { if(substr($key,0,1)=="_") { $field = substr($key,1); $cvalue = $CustomFields->GetItemByField("FieldName",$field,FALSE); if(is_object($cvalue)) { $objCustomEdit->SetFieldValue($cvalue->Get("CustomFieldId"),$cat->Get("ResourceId"),$value); $DataChanged = TRUE; } } } if($DataChanged) $objCustomEdit->SaveData(); break; case "m_edit_custom_data": $id = $_POST["ItemId"]; $objEditData = new clsCustomDataList(); //$objSession->GetEditTable("CustomMetaData")); $objEditData->SetTable('edit'); $ado = GetADODBConnection(); if($id && is_array($_POST["CustomData"])) { foreach($_POST["CustomData"] as $FieldId => $Value) { $sql = "SELECT count(*) as reccount FROM ".$objEditData->SourceTable." WHERE CustomFieldId=$FieldId AND ResourceId=".$_POST["ItemId"]; $rs = $ado->Execute($sql); $intable = $rs->fields["reccount"]; if(!$intable) { $sql = "INSERT INTO ".$objEditData->SourceTable." (ResourceId,CustomFieldId,Value) VALUES ('".$id."','$FieldId','$Value')"; $ado->Execute($sql); //echo $sql."<br>\n"; } else { $sql = "UPDATE ".$objEditData->SourceTable." SET Value='".$Value."' WHERE CustomFieldId=$FieldId AND ResourceId=".$_POST["ItemId"]; $ado->Execute($sql); //echo $sql."<br>\n"; } } } $objEditData->SetTable('live'); break; case "m_customfield_edit": if($ro_perm) break; $DataType = $_POST["DataType"]; $FieldId = $_POST["CustomFieldId"]; $FieldName = $_POST["fieldname"]; //$FieldLabel = $_POST["fieldlabel"]; if(strlen($FieldName)) { $objCustomFields = new clsCustomFieldList($DataType); $objCustomFields->EditField($FieldId,$DataType,$FieldName,"",(int)$_POST["generaltab"], $_POST["heading"],$_POST["fieldprompt"],$_POST["input_type"], $_POST["valuelist"]); } unset($objCustomFields); break; case "m_customfield_add": if($ro_perm) break; $DataType = $_POST["DataType"]; $FieldName = $_POST["fieldname"]; //$FieldLabel = $_POST["fieldlabel"]; if(strlen($FieldName)) { $objCustomFields = new clsCustomFieldList($DataType); $objCustomFields->AddField($DataType,$FieldName,"",(int)$_POST["generaltab"], $_POST["heading"],$_POST["fieldprompt"],$_POST["input_type"], $_POST["valuelist"]); unset($objCustomFields); } break; case "m_customfield_delete": if($ro_perm) break; $DataType = $_POST["DataType"]; $objCustomFields = new clsCustomFieldList($DataType); foreach($_POST["itemlist"] as $f) { $objCustomFields->DeleteField($f); //$c = $objCustomFields->GetItem($f); //$c->Delete(); } unset($objCustomFields); break; case "m_SearchConfig_Edit": if($ro_perm) break; $SimpleValues = $_POST["simple"]; $AdvValues = $_POST["advanced"]; $module = $_POST["module"]; $priority = $_POST["pri"]; //phpinfo(INFO_VARIABLES); $objSearchConfig = new clsSearchConfigList($module); foreach($objSearchConfig->Items as $i) { $id = $i->Get("SearchConfigId"); $objSearchConfig->EditFieldSettings($id,(int)$SimpleValues[$id],(int)$AdvValues[$id],$priority[$id]); } $objSearchConfig->Clear(); /* save relevence settings */ $vals = $_POST["req_increase"]; foreach($vals as $var=>$value) { $cfg = "SearchRel_Increase_".$var; $objConfig->Set($cfg,$value); } $vals = $_POST["rel_keyword"]; foreach($vals as $var=>$value) { $cfg = "SearchRel_Keyword_".$var; $objConfig->Set($cfg,$value); } $vals = $_POST["rel_pop"]; foreach($vals as $var=>$value) { $cfg = "SearchRel_Pop_".$var; $objConfig->Set($cfg,$value); } $vals = $_POST["rel_rating"]; foreach($vals as $var=>$value) { $cfg = "SearchRel_Rating_".$var; $objConfig->Set($cfg,$value); } break; case "m_keyword_reset": if($ro_perm) break; $objSearchList = new clsSearchLogList(); foreach($_POST["itemlist"] as $k) { $c = $objSearchList->GetItem($k); $c->Delete(); } break; case "m_review_add": $post_info = GetSubmitVariable($_POST, 'EditStatus'); if($post_info['variable'] > -1) { $objReviews = new clsItemReviewList(); $objReviews->SourceTable = $objSession->GetEditTable("ItemReview"); $Pending = (int)$_POST["review_pending"]; $Enabled = (int)$_POST["review_enabled"]; $Status = (int)$_POST["status"]; $CreatedOn = DateTimestamp($_POST["review_date"],GetDateFormat()); $CreatedOn += SecondsSinceMidnight($_POST["review_time"]); $html = (int)$_POST["html_enable"]; $ReviewText = inp_escape($_POST["review_body"],1); $CreatedById = 0; if(strlen($_POST["createdby"])>0) { if(strtolower($_POST["createdby"])=="root") { $CreatedById = -1; } else { $u = $objUsers->GetItemByField("Login",$_POST["createdby"]); if(is_object($u)) { $CreatedById = $u->Get("PortalUserId"); if($CreatedById<1) { $CreatedById = $objSession->Get("PortalUserId"); } } else $CreatedById = $objSession->Get("PortalUserId"); } } else $CreatedById = $objSession->Get("PortalUserId"); $r = $objReviews->AddReview($CreatedOn,$ReviewText,$Status, $IPAddress, (int)$_POST["review_priority"], $_POST["ItemId"],$_POST["ItemType"], $CreatedById,$html, $post_info['Module']); $ado = GetADODBConnection(); $rs = $ado->Execute("SELECT MIN(ReviewId) as MinValue FROM ".$objReviews->SourceTable); $NewId = $rs->fields["MinValue"]-1; $sql = "UPDATE ".$objReviews->SourceTable." SET ReviewId=".$NewId." WHERE ReviewId=".$r->Get("ReviewId"); if($objSession->HasSystemPermission("DEBUG.LIST")) echo $sql."<br>\n"; $ado->Execute($sql); } break; case "m_review_edit": $post_info = GetSubmitVariable($_POST, 'EditStatus'); if($post_info['variable'] > -1) { $objReviews = new clsItemReviewList(); $objReviews->SourceTable = $objSession->GetEditTable("ItemReview"); $Status = (int)$_POST["status"]; $CreatedOn = DateTimestamp($_POST["review_date"],GetDateFormat()); $CreatedOn += SecondsSinceMidnight($_POST["review_time"]); $html = (int)$_POST["html_enable"]; $ReviewText = inp_escape($_POST["review_body"],1); $ReviewId = $_POST["ReviewId"]; $CreatedById = 0; if(strlen($_POST["createdby"])>0) { if(strtolower($_POST["createdby"])=="root") { $CreatedById = -1; } else { $u = $objUsers->GetItemByField("Login",$_POST["createdby"]); if(is_object($u)) { $CreatedById = $u->Get("PortalUserId"); if($CreatedById<1) { $CreatedById = $objSession->Get("PortalUserId"); } } else $CreatedById = $objSession->Get("PortalUserId"); } } $r = $objReviews->EditReview($ReviewId,$CreatedOn,$ReviewText,$Status, $IPAddress, (int)$_POST["review_priority"],$_POST["ItemId"],$_POST["ItemType"], $CreatedById,$html, $post_info['Module']); } break; case "m_review_delete": $objReviews = new clsItemReviewList(); $objReviews->SourceTable = $objSession->GetEditTable("ItemReview"); foreach($_POST["itemlist"] as $id) { $objReviews->DeleteReview($id); } break; case "m_review_approve": if (isset($_POST["itemlist"])) { $objReviews = new clsItemReviewList(); $objReviews->SourceTable = $objSession->GetEditTable("ItemReview"); foreach($_POST["itemlist"] as $id) { $i = $objReviews->GetItem($id); $i->Set("Status",1); $i->Update(); } } break; case "m_review_deny": if (isset($_POST["itemlist"])) { $objReviews = new clsItemReviewList(); $objReviews->SourceTable = $objSession->GetEditTable("ItemReview"); foreach($_POST["itemlist"] as $id) { $i = $objReviews->GetItem($id); $i->Set("Status",0); $i->Update(); } } break; case "m_review_move_up": if (isset($_POST["itemlist"])) { $objReviews = new clsItemReviewList(); $objReviews->SourceTable = $objSession->GetEditTable("ItemReview"); foreach($_POST["itemlist"] as $id) { $i = $objReviews->GetItem($id); $i->MoveUp(); } } break; case "m_review_move_down": if (isset($_POST["itemlist"])) { $objReviews = new clsItemReviewList(); $objReviews->SourceTable = $objSession->GetEditTable("ItemReview"); $itemlist=array_reverse($_POST["itemlist"]); foreach($itemlist as $id) { $i = $objReviews->GetItem($id); $i->MoveDown(); } } break; case "m_theme_add": $objEditItems = new clsThemeList(); $objEditItems->SourceTable = $objSession->GetEditTable("Theme"); $Primary = (int)$_POST["primary"]; if(!(int)$_POST["enabled"]) $Primary = 0; $t = $objEditItems->AddTheme($_POST["name"],$_POST["description"],(int)$_POST["enabled"], (int)$_POST["CacheTimeout"],$Primary); $ado = GetADODBConnection(); $rs = $ado->Execute("SELECT MIN(ThemeId) as MinValue FROM ".$objEditItems->SourceTable); $NewId = $rs->fields["MinValue"]-1; $sql = "UPDATE ".$objEditItems->SourceTable." SET ThemeId=".$NewId." WHERE ThemeId=".$t->Get("ThemeId"); if($objSession->HasSystemPermission("DEBUG.LIST")) echo $sql."<br>\n"; if ($Primary==1) { $objEditItems->SetPrimaryTheme($_POST["ThemeId"]); } $ado->Execute($sql); break; case "m_theme_edit": $objEditItems = new clsThemeList(); $objEditItems->SourceTable = $objSession->GetEditTable("Theme"); $Primary = (int)$_POST["primary"]; if(!(int)$_POST["enabled"]) $Primary = 0; $objEditItems->EditTheme($_POST["ThemeId"],$_POST["name"],$_POST["description"], (int)$_POST["enabled"],$Primary,(int)$_POST["CacheTimeout"]); if ($Primary==1) { $objEditItems->SetPrimaryTheme($_POST["ThemeId"]); } break; case "m_theme_delete": if (isset($_POST["itemlist"])) { $Themes = new clsThemeList(); foreach($_POST["itemlist"] as $id) { $Themes->DeleteTheme($id); } } break; case "m_theme_primary": if( count($_POST['itemlist']) ) { $ThemeId = array_shift( $_POST['itemlist'] ); $t = new clsThemeList(); $t->SetPrimaryTheme($ThemeId); } break; case "m_template_edit": $ThemeId = $_POST["ThemeId"]; $FileId = $_POST["FileId"]; $f = new clsThemeFile($FileId); $f->Set("Description", $_POST["Description"] ); $f->Update(); $c = stripslashes($_POST["contents"]); $f->SaveFileContents($c); break; case "m_template_add": $ThemeId = $_POST["ThemeId"]; if( !is_object($f) ) $f = new clsThemeFile(); $FilePath = $_POST['name']; if(!$FilePath) { $f->SetError('Template Name is required',3); break; } else { if( substr($FilePath,1) != '/' ) $FilePath = '/'.$FilePath; if( substr($FilePath,-3) != '.tpl' ) $FilePath .= '.tpl'; $FileName = basename($FilePath); $FilePath = dirname($FilePath); // test if such file not already created $f->LoadFromDataBase( Array($FilePath,$FileName), Array('FilePath','FileName') ); if( !$f->Get('FileId') ) { $f->Set( Array('FilePath','FileName','ThemeId', 'Description'), Array($FilePath, $FileName,$_POST['ThemeId'], $_POST["Description"]) ); if( $f->IsWriteablePath(true) ) { $f->Create(); $c = stripslashes($_POST["contents"]); $f->SaveFileContents($c, true); } } else $f->SetError('Template with this name already exists',4); } break; case "m_template_delete": $dummy = new clsThemeFile(); foreach($_POST["itemlist"] as $FileId) { $dummy->LoadFromDatabase($FileId); $dummy->Delete(); } break; case "m_lang_add": $objEditItems = new clsLanguageList(); $objEditItems->SourceTable = $objSession->GetEditTable("Language"); $l = $objEditItems->AddLanguage($_POST["packname"],$_POST["localname"], (int)$_POST["enabled"],(int)$_POST["primary"], $_POST["icon"],$_POST["date_format"],$_POST["time_format"], $_POST["decimal"],$_POST["thousand"]); $ado = GetADODBConnection(); $rs = $ado->Execute("SELECT MIN(LanguageId) as MinValue FROM ".$objEditItems->SourceTable); $NewId = $rs->fields["MinValue"]-1; $sql = "UPDATE ".$objEditItems->SourceTable." SET LanguageId=".$NewId." WHERE LanguageId=".$l->Get("LanguageId"); if($objSession->HasSystemPermission("DEBUG.LIST")) echo $sql."<br>\n"; $ado->Execute($sql); if($_POST["importlabels"]==1 && $_POST["srcpack"]>0) { $sql = "SELECT * FROM ".GetTablePrefix()."Phrase WHERE LanguageId=".$_POST["srcpack"]; if($objSession->HasSystemPermission("DEBUG.LIST")) echo $sql."<br>\n"; $rs = $ado->Execute($sql); $plist = new clsPhraseList(); $plist->SourceTable = $objSession->GetEditTable("Phrase"); $sql = "SELECT MIN(PhraseId) as MinId FROM ".$plist->SourceTable; $as = $ado->Execute($sql); if($as && !$as->EOF) { $MinId = (int)$as->fields["MinId"]; } else $MinId = 0; $MinId--; while($rs && !$rs->EOF) { $data = $rs->fields; $plist->AddPhrase($data["Phrase"],$NewId,$data["Translation"],$data["PhraseType"]); $sql = "UPDATE ".$plist->SourceTable." SET PhraseId=$MinId WHERE PhraseId=0 LIMIT 1"; $ado->Execute($sql); $MinId--; $rs->MoveNext(); } } break; case "m_lang_export": include_once($pathtoroot."kernel/include/xml.php"); $Ids = $_POST["LangList"]; // language ids list to export phrases from $phrase_types = GetVar('langtypes'); $phrase_types = ($phrase_types !== false) ? implode(',',$phrase_types) : null; $filename=$_POST["filename"]; if(strlen($filename)>0) { $ExportFilename = $pathtoroot.$admin."/export/".$filename; $ExportResult = $objLanguages->ExportPhrases($ExportFilename,$Ids, $phrase_types); } break; case "m_lang_edit": $objEditItems = new clsLanguageList(); $objEditItems->SourceTable = $objSession->GetEditTable("Language"); $objEditItems->EditLanguage($_POST["LanguageId"],$_POST["packname"], $_POST["localname"],(int)$_POST["enabled"], (int)$_POST["primary"], $_POST["icon"],$_POST["date_format"], $_POST["time_format"], $_POST["decimal"],$_POST["thousand"]); if($_POST["importlabels"]==1 && $_POST["srcpack"]>0) { $ado = GetADODBConnection(); $rs = $ado->Execute("SELECT * FROM ".GetTablePrefix()."Phrase WHERE LanguageId=".$_POST["srcpack"]); $plist = new clsPhraseList(); $plist->SourceTable = $objSession->GetEditTable("Phrase"); $sql = "SELECT MIN(PhraseId) as MinId FROM ".$plist->SourceTable; $as = $ado->Execute($sql); if($as && !$as->EOF) { $MinId = (int)$as->fields["MinId"]; } else $MinId = 0; $MinId--; while($rs && !$rs->EOF) { $data = $rs->fields; $plist->AddPhrase($data["Phrase"],$_POST["LanguageId"],$data["Translation"],$data["PhraseType"]); $sql = "UPDATE ".$plist->SourceTable." SET PhraseId=$MinId WHERE PhraseId=0 LIMIT 1"; $ado->Execute($sql); $MinId--; $rs->MoveNext(); } unset($plist); } break; case "m_lang_delete": if($ro_perm) break; if (isset($_POST["itemlist"])) { $Phrases = new clsPhraseList(); foreach($_POST["itemlist"] as $id) { $objLanguages->DeleteLanguage($id); $Phrases->DeleteLanguage($id); } unset($Phrases); } break; case "m_lang_select": $LangId = (int)$_POST["langselect"]; if($LangId) { if($objSession->Get("PortalUserId")>0) { //echo "$LangId"; $objSession->SetPersistantVariable("Language",$LangId); } $objSession->Set("Language",$LangId); $objSession->Update(); $m_var_list_update["lang"] = $LangId; $m_var_list["lang"] = $LangId; } break; case "m_phrase_edit": $objPhraseList = new clsPhraseList(); if((int)$_POST["direct"] != 1) $objPhraseList->SourceTable = $objSession->GetEditTable("Phrase"); $Phrases = $_POST["name"]; foreach($Phrases as $PhraseId =>$name) { if($PhraseId>0) { $objPhraseList->EditPhrase($PhraseId,$_POST["name"][$PhraseId],$_POST["LanguageId"],$_POST["translation"][$PhraseId],$_POST["phrasetype"][$PhraseId]); } } if(strlen($_POST["name"][0]) && strlen($_POST["translation"][0]) && $_POST['Action1'] == "new") { $r = $objPhraseList->AddPhrase($_POST["name"][0],$_POST["LanguageId"],$_POST["translation"][0],$_POST["phrasetype"][0]); if ($r != "Error") { $ado = GetADODBConnection(); $rs = $ado->Execute("SELECT MIN(PhraseId) as MinValue FROM ".$objPhraseList->SourceTable); $NewId = $rs->fields["MinValue"]-1; $sql = "UPDATE ".$objPhraseList->SourceTable." SET PhraseId=".$NewId." WHERE PhraseId=$PhraseId"; if($objSession->HasSystemPermission("DEBUG.LIST")) echo $sql."<br>\n"; $ado->Execute($sql); } else { $add_error = "Language tag with the same name already exists!"; } } else if ($_POST['Action1'] == "new") { $add_error = "Fields name and translation are required!"; } unset($objPhraseList); break; case "m_config_missing_phrase": //phpinfo(INFO_VARIABLES); $LangId = $_POST["LangId"]; $ThemeId = $_POST["ThemeId"]; if(is_array($_POST["Phrase"])) { $objPhraseList = new clsPhraseList(); $objPhraseList->SourceTable = $objSession->GetSessionKey()."_".$ThemeId."_labels"; foreach($_POST["Phrase"] as $p => $value) { if(strlen($value)) { $obj = $objPhraseList->GetItemByField("Phrase",$p,TRUE); if(is_object($obj)) { if($obj->Get("Phrase")==$p) { $obj->Set("Translation",$value); $obj->Update(); } else $objPhraseList->AddPhrase($p,$LangId,$value,1); } else $objPhraseList->AddPhrase($p,$LangId,$value,1); } } } break; case "m_phrase_delete": if (isset($_POST["itemlist"])) { foreach($_POST["itemlist"] as $id) { $sql = "UPDATE ".$objSession->GetEditTable("Phrase")." SET LanguageId = 0 WHERE PhraseId = ".$id; $ado = GetADODBConnection(); $ado->Execute($sql); } } unset($objPhraseList); break; case "m_emailevent_disable": if($ro_perm) break; $objEvents = new clsEventList(); if (isset($_POST["itemlist"])) { foreach($_POST["itemlist"] as $id) { $m =& $objEvents->GetItem($id); $m->Set("Enabled",0); $m->Update(); } } unset($objEvents); break; case "m_emailevent_enable": if($ro_perm) break; $objEvents = new clsEventList(); if (isset($_POST["itemlist"])) { foreach($_POST["itemlist"] as $id) { $m =& $objEvents->GetItem($id); $m->Set("Enabled",1); $m->Update(); } } unset($objEvents); break; case "m_emailevent_frontonly": if($ro_perm) break; $objEvents = new clsEventList(); if (isset($_POST["itemlist"])) { foreach($_POST["itemlist"] as $id) { $m =& $objEvents->GetItem($id); $m->Set("Enabled",2); $m->Update(); } } unset($objEvents); break; case "m_dlid": echo $Action.":".$DownloadId; die(); break; case "m_emailevent_user": if($ro_perm) break; $objEvents = new clsEventList(); //phpinfo(INFO_VARIABLES); //$objEvents->SourceTable = $objSession->GetEditTable("Events"); $ids = $_POST["EventId"]; $ids = str_replace("[","",$ids); $ids = str_replace("]","",$ids); $ids = str_replace("\"","",$ids); $ids = str_replace("\\","",$ids); $idlist = explode(",",$ids); foreach($idlist as $EventId) { $id = (int)stripslashes($EventId); $e =& $objEvents->GetItem((int)$EventId); $e->Set("FromUserId", $_POST["FromUserId"]); $e->Update(); } $objEvents->Clear(); unset($objEvents); break; case "m_emailevent_edit": $Template = $_POST["headers"]; if(strlen($Template)) { $Template .= "\n"; } $Template = str_replace("\n\n","",$Template); $Template .= "Subject: ".$_POST["subject"]."\n\n"; $Template .= $_POST["messageBody"]; $objMessages = new clsEmailMessageList(); $objMessages->SourceTable = $objSession->GetEditTable("EmailMessage"); $m =& $objMessages->GetItem($_POST["MessageId"]); if(is_object($m)) { if($_POST["sendhtml"]==1) { $m->Set("MessageType","html"); } else $m->Set("MessageType","text"); $m->Set("Template",$Template); $m->Update(); } break; case "m_config_edit": //phpinfo(INFO_VARIABLES); if($ro_perm) break; $objAdmin = new clsConfigAdmin(); $objAdmin->module = $_POST["module"]; $objAdmin->section = $_POST["section"]; if($objAdmin->section=="in-portal:configure_users") { if(strlen($_POST["RootPass"]) && strlen($_POST["RootPassVerify"])) { if($_POST["RootPass"]==$_POST["RootPassVerify"]) { $_POST["RootPass"] = md5($_POST["RootPass"]); } } else { $_POST["RootPass"] = $objConfig->Get("RootPass"); $_POST["RootPassVerify"] = $objConfig->Get("RootPassVerify"); } } $objAdmin->LoadItems(FALSE); $objAdmin->SaveItems($_POST); break; case "m_mod_enable": if($ro_perm) break; if (isset($_POST["itemlist"])) { foreach($_POST["itemlist"] as $id) { $m =& $objModules->GetItemByField("Name",$id); if(is_object($m)) { $m->Set("Loaded",1); $m->Update(); } } $_GET["Refresh"] = 1; } break; case "m_mod_disable": if($ro_perm) break; if (isset($_POST["itemlist"])) { foreach($_POST["itemlist"] as $id) { if($id != "In-Portal") { $m =& $objModules->GetItemByField("Name",$id); if(is_object($m)) { $m->Set("Loaded",0); $m->Update(); } } } $_GET["Refresh"] = 1; } break; case "m_img_add": $objImageList = new clsImageList(); $objImageList->SourceTable = $objSession->GetEditTable("Images"); $LocalImage=0; $LocalThumb=0; $DestDir = "kernel/images/"; $UserThumbSource = (int)$_POST["imgLocalThumb"]; $LocalThumb = $UserThumbSource; $thumb_url = !$LocalThumb? $_POST["imgThumbUrl"] : ""; if($_POST["imgSameImages"]) { $LocalImage = $LocalThumb; $full_url = $thumb_url; } else { $LocalImage = (int)$_POST["imgLocalFull"]; $file = $_FILES["imgFullFile"]; $full_url = $LocalImage? "" : $_POST["imgFullUrl"]; } if((!strlen($thumb_url) && !$LocalThumb) || (!strlen($full_url) && !$LocalImage)) { break; } $ado = GetADODBConnection(); $sql = "SELECT MIN(ImageId) as MinValue FROM ".$objImageList->SourceTable; $rs = $ado->Execute($sql); $NewId = ($rs->fields["MinValue"]<0)? $rs->fields["MinValue"]-1 : -1; $img = $objImageList->Add($_POST["imgName"], $_POST["imgAlt"], $_POST["ResourceId"], $LocalImage, $LocalThumb, $full_url, $thumb_url, (int)$_POST["imgEnabled"], 0, (int)$_POST["imgDefault"], 0,(int)$_POST["imgSameImages"], $NewId); $img->Set("ImageId", $NewId); // $img->debuglevel=1; /* $sql = "UPDATE ".$objImageList->SourceTable." SET ImageId=".$NewId." WHERE ImageId=0"; $ado->Execute($sql); // $img->Update(); */ // echo "SL: $sql $NewId<BR>"; // $img->debuglevel=1; $img->Pending=TRUE; if($LocalImage) { $file = $_FILES["imgFullFile"]; if(is_array($file)) { if($file["size"]>0) { $img->Set("LocalPath",$img->StoreUploadedImage($file,1, $DestDir,0)); $uploaded=1; } } } if($LocalThumb) { $thumb = $_FILES["imgThumbFile"]; if(is_array($thumb)) { if($thumb["size"]>0) { $img->Set("ThumbPath",$img->StoreUploadedImage($thumb,1, $DestDir,1)); $uploaded=1; } } } if($uploaded==1) $img->Update(); break; case "m_img_edit": $objImageList = new clsImageList(); $objImageList->SourceTable = $objSession->GetEditTable("Images"); // $img->debuglevel=1; $img = $objImageList->GetItem($_POST["ImageId"]); ## Get original values $LocalImage = $img->Get("LocalImage"); $LocalThumb = $img->Get("LocalThumb"); $SameImages = $img->Get("SameImages"); $ThumbPath = $img->Get("ThumbPath"); ## New values $LocalThumbN = (int)$_POST["imgLocalThumb"]; $LocalImageN = (int)$_POST["imgLocalFull"]; $FULLFile = $_FILES["imgFullFile"]; $THFile = $_FILES["imgThumbFile"]; $DestDir = "kernel/images/"; $img->Pending = FALSE; $SameImagesN = 0; $uploaded = 0; ## Images were the same, but not any more if ($SameImages && !$_POST["imgSameImages"]) { ## TH was a local file if ($LocalThumb) { ## TH image { ## Try to Delete OLD FULL $img->DeleteLocalImage(FALSE, TRUE); ## FULL image select, but field EMPTY - make a copy of old TH as FULL if ($LocalImageN && !(int)$FULLFile["size"]) { // echo $pathToPending = $img->GetImageDir(); if (!eregi("pending/$", $pathToPending)) $pathToPending.= "pending/"; $LocalThumb_File = $img->GetFileName(1); // echo "<b>CAN'T FIND FILE:</b> ".$pathToPending.$LocalThumb_File."<BR>"; if (file_exists($pathToPending.$LocalThumb_File)) { $LocalThumb_FileN = eregi_replace("^th_", "", $LocalThumb_File); $LocalThumb_FullFileN = $pathToPending.$LocalThumb_FileN; @unlink($LocalThumb_FullFileN); @copy($pathToPending.$LocalThumb_File, $LocalThumb_FullFileN); $uploaded = 1; $copied = 1; // echo "COPING: ".$DestDir."pending/".$LocalThumb_FileN." <BR>"; } else { // echo "CAN'T FIND FILE: ".$pathToPending.$LocalThumb_File."<BR>"; } } ## Upload new FULL image elseif ($LocalImageN && (int)$FULLFile['size']) { $FULL_FileToUpload = $FULLFile; $FULL_URL = ""; // echo " Upload new FULL image"; } ## Full is URL elseif (!$LocalImageN) { $img->DeleteLocalImage(FALSE, TRUE); $FULL_URL = $_POST['imgFullUrl']; $FULL_FileToUpload = ""; } else { // echo " ## Unknow condition"; } ## Take care of Thumbnail here if ($LocalThumbN) { ## Delete old if NEW TH image selected if ((int)$THFile['size']) { $img->DeleteLocalImage(TRUE, FALSE); $TH_FileToUpload = $THFile; } else $TH_FileToUpload = ""; } else { $img->DeleteLocalImage(TRUE, FALSE); $TH_FileToUpload = ""; $TH_URL = $_POST['imgThumbUrl']; } } } ## TH was URL else { ## Take care of FULL image here if ($LocalImageN && (int)$FULLFile["size"]) { $FULL_FileToUpload = $FULLFile; $FULL_URL = ""; } ## Full is URL (or image size 0) else { $FULL_FileToUpload = ""; $FULL_URL = $_POST['imgFullUrl']; } ## Take care of Thumbnail here if ($LocalThumbN) { $TH_FileToUpload = (int)$THFile['size']? $THFile : ""; $TH_URL = ""; } else { $TH_FileToUpload = ""; $TH_URL = $_POST['imgThumbUrl']; } } } ## Images were the same, and still the same elseif ($SameImages && $_POST['imgSameImages']) { ## Take care of Thumbnail & FULL here if ($LocalThumbN) { if ((int)$THFile['size']) { $img->DeleteLocalImage(TRUE, FALSE); $TH_FileToUpload = $THFile; } else $TH_FileToUpload = ""; $FULL_URL = $TH_URL = ""; } else { $TH_FileToUpload = $FULL_FileToUpload = ""; $FULL_URL = $TH_URL = $_POST['imgThumbUrl']; } ## Delete old FULL image $img->DeleteLocalImage(FALSE,TRUE); $SameImagesN = 1; } ## Images were NOT the same, and selected as the same now elseif (!$SameImages && $_POST["imgSameImages"]) { ## Take care of Thumbnail & FULL here if ($LocalThumbN) { if ((int)$THFile['size']) { $img->DeleteLocalImage(TRUE, FALSE); $TH_FileToUpload = $THFile; } else $TH_FileToUpload = ""; $FULL_URL = $TH_URL = ""; } else { $img->DeleteLocalImage(TRUE, FALSE); $TH_FileToUpload = $FULL_FileToUpload = ""; $FULL_URL = $TH_URL = $_POST['imgThumbUrl']; } ## Clean up FULL image $img->DeleteLocalImage(FALSE, TRUE); $SameImagesN = 1; } ## Images were NOT the same, and selected as NOT the same elseif (!$SameImages && !$_POST["imgSameImages"]) { ## Take care of Thumbnail if ($LocalThumbN) { if ((int)$THFile['size']) { $img->DeleteLocalImage(TRUE, FALSE); $TH_FileToUpload = $THFile; } else $TH_FileToUpload = ""; $TH_URL = ""; } else { $img->DeleteLocalImage(TRUE, FALSE); $TH_FileToUpload = ""; $TH_URL = $_POST['imgThumbUrl']; } ## Take care of FULL here if ($LocalImageN) { if ((int)$FULLFile['size']) { $img->DeleteLocalImage(FALSE, TRUE); $FULL_FileToUpload = $FULLFile; } else $FULL_FileToUpload = ""; $FULL_URL = ""; } else { $img->DeleteLocalImage(FALSE, TRUE); $FULL_FileToUpload = ""; $FULL_URL = $_POST['imgFullUrl']; } } ## Unknow condition else { ; } $img = $objImageList->Edit($_POST["ImageId"],$_POST["imgName"], $_POST["imgAlt"], $_POST["ResourceId"], $LocalImageN, $LocalThumbN, $FULL_URL, $TH_URL, (int)$_POST["imgEnabled"], (int)$_POST["imgPriority"], (int)$_POST["imgDefault"], 0, $SameImagesN); // echo "<B>DATA:</B> <BR> LocalImageN: $LocalImageN, LocalThumbN: $LocalThumbN, FULL_URL: $FULL_URL, TH_URL: $TH_URL, SameImagesN: $SameImagesN <BR>"; $img->Pending = TRUE; if (!empty($FULL_FileToUpload)) { $img->Set("LocalPath",$img->StoreUploadedImage($FULL_FileToUpload, 1, $DestDir, 0)); $uploaded = 1; } /* elseif (!$LocalImageN) { $img->Set("LocalPath", ""); $uploaded = 1; } */ if (!empty($TH_FileToUpload)) { $img->Set("ThumbPath", $img->StoreUploadedImage($TH_FileToUpload, 1, $DestDir, 1)); $uploaded = 1; } if ($copied) { $img->Set("LocalPath", $DestDir."pending/".$LocalThumb_FileN); $uploaded = 1; } if($uploaded==1) $img->Update(); break; case "m_img_move_up": if (isset($_POST["itemlist"])) { $objImageList = new clsImageList(); $objImageList->SourceTable = $objSession->GetEditTable("Images"); foreach($_POST["itemlist"] as $id) { $img = $objImageList->GetItem($id); $img->MoveUp(); } } break; case "m_img_move_down": if (isset($_POST["itemlist"])) { $objImageList = new clsImageList(); $objImageList->SourceTable = $objSession->GetEditTable("Images"); $itemlist=array_reverse($_POST["itemlist"]); foreach($itemlist as $id) { $img = $objImageList->GetItem($id); $img->MoveDown(); } } break; case "m_img_delete": if(isset($_POST["itemlist"])) { $objImageList = new clsImageList(); $objImageList->SourceTable = $objSession->GetEditTable("Images"); foreach($_POST["itemlist"] as $id) { $img = $objImageList->GetItem($id); $img->Set("ResourceId", 0); $img->Update(); //$img->Delete(); } } break; case "m_restore_delete": $bdate = $_POST["backupdate"]; if($bdate>0) { $BackupFile = $objConfig->Get("Backup_Path")."/dump".$bdate.".txt"; if(file_exists($BackupFile)) unlink($BackupFile); } break; case "m_taglib": include($pathtoroot."kernel/include/tag-class.php"); ParseTagLibrary(); break; case "m_sql_query": $SqlQuery = $_POST["sql"]; $ado = GetADODBConnection(); if(strlen($sql)) { $SqlResult = $ado->Execute(stripslashes($SqlQuery)); $SqlError = $ado->ErrorMsg(); $SqlErrorNum = $ado->ErrorNo(); } break; case "m_session_delete": if($ro_perm) break; $ado = GetADODBConnection(); if (count($_POST['itemlist']) > 0) { foreach($_POST["itemlist"] as $id) { $sql = "DELETE FROM ".GetTablePrefix()."UserSession WHERE SessionKey='$id'"; $ado->Execute($sql); } } else { $sql = "DELETE FROM ".GetTablePrefix()."UserSession WHERE Status='0'"; $ado->Execute($sql); } break; case "m_add_rule": $objEditItems = new clsBanRuleList(); $objEditItems->SourceTable = $objSession->GetEditTable("BanRules"); //$ItemType,$RuleType,$ItemField,$ItemVerb,$ItemValue,$Priority,$Status; $objEditItems->AddRule($_POST["rule_itemtype"],$_POST["rule_type"],$_POST["rule_field"], $_POST["rule_verb"],$_POST["rule_value"],(int)$_POST["rule_priority"], (int)$_POST["rule_status"], $_POST['rule_error']); break; case "m_edit_rule": $objEditItems = new clsBanRuleList(); $objEditItems->SourceTable = $objSession->GetEditTable("BanRules"); //$ItemType,$RuleType,$ItemField,$ItemVerb,$ItemValue,$Priority,$Status; $objEditItems->EditRule($_POST["rule_id"],$_POST["rule_itemtype"],$_POST["rule_type"],$_POST["rule_field"], $_POST["rule_verb"],$_POST["rule_value"],(int)$_POST["rule_priority"], (int)$_POST["rule_status"], $_POST['rule_error']); break; case "m_rule_move_up": if($ro_perm) break; if(isset($_POST["itemlist"])) { foreach($_POST["itemlist"] as $id) { $i = $objBanList->GetItem($id); $i->Increment("Priority"); } } break; case "m_rule_move_down": if($ro_perm) break; if(isset($_POST["itemlist"])) { foreach($_POST["itemlist"] as $id) { $i = $objBanList->GetItem($id); $i->Decrement("Priority"); } } break; case "m_rule_delete": if($ro_perm) break; if(isset($_POST["itemlist"])) { foreach($_POST["itemlist"] as $id) { $i = $objBanList->GetItem($id); $i->Delete(); } } break; case "m_ban_user": if($ro_perm) break; if($_POST["UserEditStatus"]==1) { $UserId = $_POST["user_id"]; $u = $objUsers->GetItem($UserId); if(is_object($u)) { if((int)$_POST["ban_login"]) { if(strlen($_POST["user_login"])) $objBanList->AddRule(6,0,"Login",3,$_POST["user_login"],0,1); } if((int)$_POST["ban_email"]) { if(strlen($_POST["user_email"])) $objBanList->AddRule(6,0,"Email",3,$_POST["user_email"],0,1); } if((int)$_POST["ban_ip"]) { if(strlen($_POST["user_ip"])) $objBanList->AddRule(6,0,"ip",3,$_POST["user_ip"],0,1); } $u->Deny(); } } break; } /* image upload management */ if( isset($_POST['img']) && $_POST['img'] == 1 ) { foreach($_FILES as $img => $FILE) { $name = $_POST["img_Name_$img"]; $alt = $_POST["img_Alt_$img"]; $url = $_POST["img_Url_$img"]; $res_id = $_POST["img_Res_$img"]; $relvalue = $_POST["img_Rel_$img"]; $thumb = (int)$_POST["img_Thumb_$img"]; $dest = AddSlash($_POST["img_DestDir_$img"]); if($_POST["img_Del_$img"]=="Delete") { $img = $objImageList->GetImageByResource($res_id,$relvalue); $img->Delete(); unset($img); $objImageList->Clear(); } else { if($FILE["size"]>0) { /* an image was uploaded */ $objImageList->HandleImageUpload($FILE,$res_id,$relvalue,$dest, $name,$alt,$thumb); } else { /* remote images handled here */ if(strlen($url)>0) { if($relvalue>0) { $img = $objImageList->GetImageByResource($res_id,$relvalue); $img->Set("Name",$name); $img->Set("AltName", $alt); $img->Set("IsThumbnail",$thumb); $img->Set("Url",$url); $img->Update(); } else { $relvalue = $objImageList->GetNextRelateValue($res_id); $objImageList->NewRemoteImage($url,$res_id,$relvalue, $name, $alt, $thumb); } } } } } } // ALL Saving Stuff From Temp Tables Heppens Here //echo "==== BEGIN ==== <br>"; $has_perm = $objSession->HasSystemPermission("SYSTEM_ACCESS.READONLY"); //echo "PortalUserID: [".$objSession->Get("PortalUserId")."]<br>"; //echo "PermSet: [".$has_perm."]<br>"; if( !$has_perm ) { /* category Edit */ if( GetVar('CatEditStatus') == 1 ) - { + { $adodbConnection = GetADODBConnection(); // $sql = "SELECT * FROM ".$objSession->GetEditTable("Category")." WHERE CategoryId=0"; $sql = "SELECT * FROM ".$objSession->GetEditTable("Category")." WHERE CategoryId=-1"; $rs = $adodbConnection->Execute($sql); while ($rs && !$rs->EOF) { if($rs->fields["ParentId"]>0) RunUp($rs->fields["ParentId"],"Increment_Count"); $rs->MoveNext(); } $objCatList->CopyFromEditTable("CategoryId"); $objCustomDataList->CopyFromEditTable("CustomDataId"); $objCatList->Clear(); - + if($_REQUEST['CategoryId'] > 0) // not root category is updated { $objImages = new clsImageList(); $objImages->CopyFromEditTable("ImageId"); } } if( GetVar('CatEditStatus') == 2 ) - { + { $objCatList->PurgeEditTable("CategoryId"); $objCustomDataList->PurgeEditTable("CustomDataId"); if($_REQUEST['CategoryId'] > 0) // not root category is updated { $objImages = new clsImageList(); - $objImages->PurgeEditTable("ImageId"); + $objImages->CopyFromEditTable("ImageId"); + //$objImages->PurgeEditTable("ImageId"); } $objCatList->Clear(); } /* User Edit */ if( GetVar('UserEditStatus') == 1 ) { $objUsers->CopyFromEditTable("PortalUserId"); $objCustomDataList->CopyFromEditTable("CustomDataId"); $objGroups->Clear(); $objImages = new clsImageList(); $objImages->CopyFromEditTable("ImageId"); } if( GetVar('UserEditStatus') == 2 ) { $objGroups->PurgeEditTable("PortalUserId"); $objCustomDataList->PurgeEditTable("CustomDataId"); $objGroups->Clear(); } /* Group Edit */ if( GetVar('GroupEditStatus') == 1 ) { $objGroups->CopyFromEditTable("GroupId"); $objCustomDataList->CopyFromEditTable("CustomDataId"); $objGroups->Clear(); } if( GetVar('GroupEditStatus') == 2 ) { $objGroups->PurgeEditTable("GroupId"); $objCustomDataList->PurgeEditTable("CustomDataId"); $objGroups->Clear(); } /* Theme Edit */ if( GetVar('ThemeEditStatus') == 1 ) { $objThemes->CopyFromEditTable(); $objThemes->Clear(); } if( GetVar('ThemeEditStatus') == 2 ) { $objThemes->PurgeEditTable(); $objThemes->Clear(); } /* Language Edit */ if( GetVar('LangEditStatus') == 1 ) { $Messages = new clsEmailMessageList(); $Messages->CopyFromEditTable(); $Messages->Clear(); $objLanguages->CopyFromEditTable(); $objLanguages->Clear(); $Phrases = new clsPhraseList(); $Phrases->CopyFromEditTable(); $Phrases->Clear(); $Phrases->PurgeEditTable(); } if( GetVar('LangEditStatus') == 2 ) { $objLanguages->PurgeEditTable(); $objLanguages->Clear(); $Phrases = new clsPhraseList(); $Phrases->PurgeEditTable(); $Messages = new clsEmailMessageList(); $Messages->PurgeEditTable(); } if( GetVar('MissingLangEditStatus') == 1 ) { $objPhraseList = new clsPhraseList(); $objPhraseList->SourceTable = $objSession->GetSessionKey()."_".$ThemeId."_labels"; $objEditList = new clsPhraseList(); $objEditList->SourceTable = $objSession->GetEditTable("Phrase"); $ado = GetADODBConnection(); $rs = $ado->Execute("SELECT MIN(PhraseId) as MinValue FROM ".$objEditList->SourceTable); $NewId = $rs->fields["MinValue"]-1; $objPhraseList->Query_Item("SELECT * FROM ".$objPhraseList->SourceTable); foreach($objPhraseList->Items as $p) { if(strlen($p->Get("Translation"))>0) { $p->tablename = $objEditList->SourceTable; $p->Dirty(); $p->UnsetIDField(); $p->Set("PhraseId",$NewId); $NewId--; $p->Create(); } } $ado->Execute("DROP TABLE IF EXISTS ".$objPhraseList->SourceTable); } if( GetVar('MissingLangEditStatus') == 2 ) { $table = $objSession->GetSessionKey()."_".$ThemeId."_labels"; $ado = GetADODBConnection(); $ado->Execute("DROP TABLE IF EXISTS ".$table); } /* Ban Rule Edit */ if( GetVar('RuleEditStatus') == 1 ) { $objBanList->CopyFromEditTable("RuleId"); $objBanList->Clear(); } if( GetVar('RuleEditStatus') == 2 ) { $objBanList->PurgeEditTable("RuleId"); $objBanList->Clear(); } } elseif( defined('DEBUG_ACTIONS') ) { if( isset($_REQUEST['Action']) && $_REQUEST['Action'] ) echo "<b>USER HAS RO-ACCESS</b> on action [<b>".$_REQUEST['Action']."</b>]<br>"; } //echo "==== END ==== <br>"; ?> Property changes on: trunk/kernel/action.php ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.28 \ No newline at end of property +1.29 \ No newline at end of property Index: trunk/kernel/include/parse.php =================================================================== --- trunk/kernel/include/parse.php (revision 292) +++ trunk/kernel/include/parse.php (revision 293) @@ -1,977 +1,977 @@ <?php class clsHtmlTag { var $rawtext; var $parsed; var $prefix; var $name; var $attributes; var $inner_html; function clsHtmlTag($text=NULL) { $this->SetRawText($text); if(strlen($text)) $this->parse(); } function Clear() { $this->parsed = FALSE; $this->rawtext = NULL; $this->prefix = ""; $this->name = ""; $this->attributes = NULL; $this->inner_html = ""; } function ValidTag() { return (strlen($this->prefix) && strlen($this->name)); } function SetRawText($text) { $this->Clear(); if($text != NULL) $text = trim($text); $this->rawtext = $text; } function GetAttributeByName($attr) { if(is_array($this->attributes)) { $attr = strtolower($attr); if( array_key_exists($attr,$this->attributes)) { return $this->attributes[$attr]; } else return FALSE; } else return FALSE; } function SetAttributeByName($attr,$value) { if(!is_array($this->attributes)) $this->attributes = array(); $this->attributes[$attr] = $value; } function GetAttributeByIndex($index) { if(is_array($this->attributes)) { if($index < count($this->attributes)) { return $this->attributes[$index]; } else return FALSE; } else return FALSE; } function ParseAttributes($attributes) { unset($output); $attribute = ""; $attributes = str_replace("\\>",">",$attributes); $attributes = str_replace("\\<","<",$attributes); $attributes = str_replace("\\\\","\\",$attributes); while(strpos($attributes,"=")>0) { $pos = strpos($attributes,"="); $attribute = trim(substr($attributes,0,$pos)); $attributes = trim(substr($attributes,$pos+1)); $pos2 = strpos($attributes,"\""); $pos3 = strpos($attributes,"'"); if(!($pos3===false) and !($pos2===false) and ($pos3<$pos2)) $pos2 = $pos3; if(!($pos3===false) and ($pos2===false) and (($pos3<$pos) or ($pos==0))) $pos2 = $pos3; if(!($pos2===false) and (($pos2<$pos) or ($pos==0))) { if (substr($attributes,0,1) == "\"") { $pos = strpos($attributes,"\"",1); $val = substr($attributes,1,$pos-1); } elseif (substr($attributes,0,1) == "'") { $pos = strpos($attributes,"'",1); $val = substr($attributes,1,$pos-1); } else { $pos1 = strpos($attributes,"=",1); $val = substr($attributes,0,$pos1); $pos1a = strrpos($val," "); $pos = $pos1-(strlen($val)-$pos1a); $val = substr($val,0,$pos1a); } while (strpos($attribute," ")>0) { $pos1 = strpos($attribute," "); $attr1 = substr($attribute,0,$pos1); $output[$attr1] = null; $attribute = trim(substr($attribute,$pos1+1)); } $output[strtolower($attribute)] = $val; $attributes = trim(substr($attributes,$pos+1)); } elseif ($pos>0) { if (strpos($attributes,"=")>0) { $pos = strpos($attributes,"="); $val = substr($attributes,0,$pos); } else { $val = $attributes; } $pos2 = strrpos($val," "); if($pos2>0) { $len = strlen($val); $val = substr($val,0,$pos2); $attributes = trim(substr($attributes,($pos-$len)+$pos2)); } else { $len = strlen($val); $attributes = trim(substr($attributes,$len)); } while (strpos($attribute," ")>0) { $pos1 = strpos($attribute," "); $attr1 = substr($attribute,0,$pos1); $output[$attr1] = null; $attribute = trim(substr($attribute,$pos1+1)); } $output[strtolower($attribute)] = $val; } else { while (strpos($attribute," ")>0) { $pos1 = strpos($attribute," "); $attr1 = substr($attribute,0,$pos1); $output[$attr1] = null; $attribute = trim(substr($attribute,$pos1+1)); } $output[strtolower($attribute)] = $attributes; } } if(strlen(trim($attributes))>0) { while (strpos($attribute," ")>0) { $pos1 = strpos($attribute," "); $attr1 = substr($attribute,0,$pos1); $output[$attr1] = null; $attribute = trim(substr($attribute,$pos1+1)); } $output[strtolower($attributes)] = null; } if (isset($output)) return($output); } function parse() { global $objSession; $html = $this->rawtext; $html = substr($html,1,strlen($html)-2); if(substr($html,strlen($html)-1,1)=="/") { $html = substr($html,0,strlen($html)-1); } $tagparts = explode(" ",$html,2); $tagname = $tagparts[0]; $attribs = array(); if(count($tagparts)>0) $attribs = $this->ParseAttributes( isset($tagparts[1]) ? $tagparts[1] : ''); if(is_object($objSession) && is_array($attribs)) { $referer = $objSession->GetVariable("Template_Referer"); foreach($attribs as $key=>$value) { if($value=="_referer_") $attribs[$key] = $referer; } } $name = explode(":",$tagname); $this->prefix = strtolower($name[0]); $this->name = strtolower($name[1]); if(is_array($attribs)) { foreach($attribs as $key=>$value) { if(!strlen($value)) { $attribs[$key]=1; } } $this->attributes = $attribs; } else $this->attributes = array(); $this->parsed=TRUE; } function Execute() { $func = $this->name; $override = "_".$func; if( function_exists($override) ) { $ret = @$override($this->attributes); } else { if(function_exists($func)) { $ret = @$func($this->attributes); } else { - $ret = "{Unknown Tag:" .$this->name."}"; + //$ret = "{Unknown Tag:" .$this->name."}"; } } return $ret; } } class clsTemplate { var $source; var $name; var $out; var $error; function clsTemplate($template=NULL) { $this->name=$template; $this->source=NULL; $this->out = NULL; $this->error = ""; } function LoadByFileName($file,$SupressError=FALSE) { if(file_exists($file)) { $fp = fopen ($file, "r"); if($fp) { $this->source = fread($fp, filesize ($file)); $this->source = trim($this->source); fclose($fp); return TRUE; } else { if(!$SupressError) $this->error = "lu_read_error"; return FALSE; } } else { if(!$SupressError) $this->error = "lu_missing_error"; return FALSE; } } function HasExtension() { $t = strtolower($this->name); if(strlen($t)) { return (substr($t,-4)==".tpl"); } else return false; } function TemplateFilename($template_root) { if(!$this->HasExtension()) { $filename = $template_root.$this->name.".tpl"; } else $filename = $template_root.$this->name; return $filename; } function LoadFile($template_root="",$SupressError=FALSE) { $filename = $this->TemplateFilename($template_root); if(file_exists($filename)) { //echo "Loading $filename from Filesystem<br>\n"; $fp = @fopen ($filename, "r"); if($fp) { $this->source = fread($fp, filesize ($filename)); $this->source = trim($this->source); fclose($fp); return TRUE; } else { if(!$SupressError) $this->error = "lu_read_error"; return FALSE; } } else { if(!$SupressError) $this->error = "lu_missing_error"; return FALSE; } } function WriteFile($template_root="") { $filename = $this->TemplateFilename($template_root); $pos = strrpos($this->name,"/"); if(!is_dir(substr($template_root,0,-1))) @mkdir(substr($tempalate_root0,-1)); if($pos>0) $path=$template_root.substr($this->name,0,$pos); if(!is_dir($path)) { @mkdir($path); } if(strlen($this->out)) { $fp = @fopen($filename, "w"); if($fp) { fwrite($fp,$this->out); fclose($fp); return TRUE; } else return FALSE; } else return TRUE; } } class clsTemplateList { var $templates; var $root_dir; var $ErrorStr; var $ErrorNo; var $stack; var $SkipIncludes = 0; function clsTemplateList($root_dir) { $this->templates = array(); $this->root_dir = $root_dir; $this->ErrorStr = ""; $this->ErrorNo = 0; $this->SkipIncludes = 0; $this->stack = array(); } function InStack($template) { if(in_array($template,$this->stack)) { return TRUE; } else return FALSE; } function GetTemplate($name,$SupressError=FALSE) { if(!strlen($name)) { $ret = FALSE; if(!$SupressError) { $this->ErrorNo = -2; $this->ErrorStr=language("lu_template_error").":".language("lu_no_template_error"); } } else { $ret = FALSE; foreach($this->templates as $n => $t) { if($n == $name) { $ret=$t; break; } } if(!is_object($ret)) { $ret = new clsTemplate($name); if($ret->LoadFile($this->root_dir,$SupressError)) { $this->templates[$name]=$ret; } else { if(!$SupressError) { $this->ErrorNo = -1; $this->ErrorStr = language("lu_template_error").":".language($ret->error).":"."'$name'"; LogEntry($this->ErrorStr); } } } } return $ret; } function GetTemplateCache($template,$SupressError=FALSE) { global $CurrentTheme, $pathtoroot; $ret = ''; if( $CurrentTheme->Get("CacheTimeout") > 0) { $id = $CurrentTheme->GetTemplateId($template); if($id) { $exp = isset($CurrentTheme->ParseCacheDate[$id]) ? $CurrentTheme->ParseCacheDate[$id] : false; if($exp) { //echo "$template Cache expires: ".date("m-d-Y h:m s",$exp)."<br>\n"; if( $exp > time() ) { /* look for a cache file */ $t = new clsTemplate($template); $dir = $CurrentTheme->ThemeDirectory(); if( $t->LoadFile($dir."/_cache/",$SupressError) ) $ret = $t->source; } } } } return $ret; } function SaveTemplateCache($objTemplate) { global $CurrentTheme, $objThemes, $pathtoroot; if(!is_object($CurrentTheme)) $CurrentTheme = $objThemes->GetItem($m_var_list["theme"]); if($CurrentTheme->Get("CacheTimeout")>0) { $TemplateId = $CurrentTheme->GetTemplateId($objTemplate->name); if($TemplateId) { if(isset($CurrentTheme->ParseCacheDate[$TemplateId])) { //echo "Writing Template ".$objTemplate->name."<br>\n"; $interval = $CurrentTheme->ParseCacheTimeout[$TemplateId]; $CurrentTheme->UpdateFileCacheData($TemplateId,time()+$interval); $dir = $CurrentTheme->ThemeDirectory()."/_cache/"; $objTemplate->WriteFile($dir); } } } } function IncludeTemplate($tag, $SupressError=FALSE) { global $LogLevel, $objSession,$objLanguages; $SupressError = ($SupressError || $tag->GetAttributeByName("_supresserror")); switch($tag->name) { case "perm_include": $perms = $tag->GetAttributeByName("_permission"); if(strlen($perms)) { $plist = explode(",",$perms); $value=0; $CheckSys = $tag->GetAttributeByName("_system"); for($p=0;$p<count($plist);$p++) { if($objSession->HasCatPermission(trim($plist[$p]))) { $value = 1; break; } else { if($CheckSys) { if($objSession->HasSystemPermission(trim($plist[$p]))) { $value = 1; break; } } } } if($value) { $t = $tag->GetAttributeByName("_template"); } else $t = $tag->GetAttributeByName("_noaccess"); } else { $module = $tag->GetAttributeByName("_module"); if(strlen($module)) { if(ModuleEnabled($module)) { $t = $tag->GetAttributeByName("_template"); } else $t = $tag->GetAttributeByName("_noaccess"); } } break; case "lang_include": $lang = $tag->GetAttributeByName("_language"); if(strlen($lang)) { $LangId = $objSession->Get("Language"); $l = $objLanguages->GetItem($LangId); if(strtolower($lang)==strtolower($l->Get("PackName"))) { $t = $tag->GetAttributeByName("_template"); } } break; case "include": $t = $tag->GetAttributeByName("_template"); break; }//switch LogEntry("Parsing $t\n"); $LogLevel++; if($t) { if(!$this->InStack($t)) { //return $this->ParseTemplate($t); //if(!$tag->GetAttributeByName("_nocache")); $ret = $this->GetTemplateCache($t,$SupressError); if(!strlen($ret)) { $req = $tag->GetAttributeByName("_dataexists"); if($req) { global $content_set; $content_set=1; $temp = $this->ParseTemplate($t,0,0,$SupressError); if($content_set) { $ret = $temp; } else { $t_nodata = $tag->GetAttributeByName("_nodatatemplate"); if(strlen($t_nodata)) { $nodata_tag = new clsHtmlTag(); $nodata = $tag; $nodata->attributes = $tag->attributes; $nodata->SetAttributeByName("_template",$t_nodata); $nodata->SetAttributeByName("_nodatatemplate",""); $nodata->SetAttributeByName("_dataexists",""); $ret = $this->IncludeTemplate($nodata,$SupressError); } else $ret = ""; } } else $ret = $this->ParseTemplate($t,0,0,$SupressError); } } else $ret = ""; } $LogLevel--; if($LogLevel<0) $LogLevel=0; LogEntry("Finished Parsing $t\n"); return $ret; } /* <inp:mod_include _Template=".." [_perm=".."] [_modules=".."] [_system=".."] */ function ModuleInclude($tag) { global $var_list; $o = ""; $el = new clsHtmlTag(); $el->attributes = $tag->attributes; $el->parsed=1; $t = $tag->attributes["_template"]; if(!strlen($t)) $t = $var_list["t"]; $el->name = "perm_include"; $tpath = GetModuleArray("template"); if(!strlen($tag->attributes["_modules"])) { $mods = array_keys($tpath); } else $mods = explode(",",$tag->attributes["_modules"]); foreach($mods as $m) { if($t==$var_list["t"] && !strlen($tpath[$m])) continue; $el->attributes = $tag->attributes; $el->attributes["_template"] = $tpath[$m].$t; $el->attributes["_module"] = $m; if(strlen($tag->attributes["_nodatatemplate"])) { $el->attributes["_nodatatemplate"] = $tpath[$m].$tag->attributes["_nodatatemplate"]; } //print_pre($el); $o .= $this->IncludeTemplate($el,true); } if(!strlen($o) && strlen($tag->attributes["_nodatamaintemplate"])) $o = $this->ParseTemplate($tag->attributes["_nodatamaintemplate"]); return $o; } function ParseTag($raw) { $tag = new clsHtmlTag($raw); $res = ""; switch($tag->name) { case "lang_include": case "include": case "perm_include": $res = $this->IncludeTemplate($tag); break; case "mod_include": $res = $this->ModuleInclude($tag); break; default: //print_pre($tag); $res = $tag->Execute(); break; } unset($tag); return $res; } function ParseTemplateText($text) { $html = $text; $search = "<inp:"; $next_tag = strpos($html,$search); $left = substr($html,0,5); while($next_tag || $left=="<inp:") { $left = ""; $closer = strpos(strtolower($html),">",$next_tag); $tmp = substr($html,$next_tag,$closer+1 - $next_tag); while(substr($html,$closer-1,1)=="\\" && $closer < strlen($html)) { $closer = strpos(strtolower($html),">",$closer+1); } $end_tag = strpos($html,"/>",$next_tag); if(($end_tag < $closer || $closer == 0)) { $tagtext = substr($html,$next_tag,($end_tag - $next_tag)+2); $pre = substr($html,0,$next_tag); $post = substr($html,$end_tag+2); $inner = $this->ParseTag($tagtext); $html = $pre.$inner.$post; } else { $OldTagStyle = "</inp>"; ## Try to find end of TagName $TagNameEnd = strpos($html, " ", $next_tag); ## Support Old version // $closer = strpos(strtolower($html),"</inp>",$next_tag); if ($TagNameEnd) { $Tag = strtolower(substr($html, $next_tag, $TagNameEnd-$next_tag)); $TagName = explode(":", $Tag); if (strlen($TagName[1])) $CloserTag = "</inp:".$TagName[1].">"; } else { $CloserTag = $OldTagStyle; } $closer = strpos(strtolower($html), $CloserTag, $next_tag); ## Try to find old tag closer if (!$closer && ($CloserTag != $OldTagStyle)) { $CloserTag = $OldTagStyle; $closer = strpos(strtolower($html), $CloserTag, $next_tag); } $end_tag = strpos($html,">",$next_tag); $tagtext = substr($html,$next_tag,($end_tag - $next_tag)+1); $pre = substr($html,0,$next_tag); $inner = substr($html,$end_tag+1,$closer-($end_tag+1)); $post = substr($html,$end_tag+1+strlen($inner) + strlen($CloserTag)); $parsed = trim($this->ParseTag($tagtext)); if(strlen($parsed)) { $html = $pre.$this->ParseTemplateText($inner).$post; } else $html = $pre.$post; } //$next_tag = strpos($html,"<inp:"); $next_tag = 0; $next_tag = strpos($html,$search); } return $html; } function ParseTemplate($tname, $NoCache=0, $NoStack=0,$SupressError=FALSE) { $html = ""; $t = $this->GetTemplate($tname,$SupressError); if(is_object($t)) { if(!$NoStack) array_push($this->stack,$tname); $html = $t->source; $html = $this->ParseTemplateText($html); if(!$NoStack) array_pop($this->stack); $t->out = $html; if(!$NoCache) $this->SaveTemplateCache($t); } unset($t); return $html; } } class clsAdminTemplateList extends clsTemplateList { function clsAdminTemplateList() { global $TemplateRoot; $this->clsTemplateList($TemplateRoot); } function GetTemplate($file) { $ret = FALSE; $ret = new clsTemplate(); if(!$ret->LoadByFileName($file)) { $this->ErrorNo = -1; $this->ErrorStr = "Error Loading Template '$file'"; } return $ret; } } class clsTemplateChecker extends clsTemplateList { var $Dependencies; var $TemplateType; var $Tags; function clsTemplateChecker($rootdir) { $this->clsTemplateList($rootdir); $this->Dependencies = Array(); $this->Tags = array(); $this->TemplateType="global"; //default } function ParseTag($text) { $this->Tags[] = new clsHtmlTag($text); return ""; } function ParseTemplateText($text) { $html = $text; $search = "<inp:"; $next_tag = strpos($html,$search); $left = substr($html,0,5); while($next_tag || $left=="<inp:") { $left = ""; $closer = strpos(strtolower($html),">",$next_tag); $end_tag = strpos($html,"/>",$next_tag); if($end_tag < $closer || $closer == 0) { $tagtext = substr($html,$next_tag,($end_tag - $next_tag)+2); $pre = substr($html,0,$next_tag); $post = substr($html,$end_tag+2); $inner = $this->ParseTag($tagtext); $html = $pre.$inner.$post; } else { $closer = strpos(strtolower($html),"</inp>",$next_tag); $end_tag = strpos($html,">",$next_tag); $tagtext = substr($html,$next_tag,($end_tag - $next_tag)+1); $pre = substr($html,0,$next_tag); $inner = substr($html,$end_tag+1,$closer-($end_tag+1)); $post = substr($html,$end_tag+1+strlen($inner)+6); $parsed = $this->ParseTag($tagtext); if(strlen($parsed)) { $html = $pre.$inner.$post; } else $html = $pre.$post; } //$next_tag = strpos($html,"<inp:"); $next_tag = 0; $next_tag = strpos($html,$search); } return $html; } function ParseTemplate($tname, $NoCache=0, $NoStack=0,$SupressError=FALSE) { $html = ""; $t = $this->GetTemplate($tname,$SupressError); if(is_object($t)) { $html = $this->ParseTemplateText($t->source); $t->out = $html; } unset($t); return $html; } function ReadTemplateTags($tname) { $this->Tags[]=Array(); $this->ParseTemplate($tname,1,1,TRUE); return $this->Tags; } function GetTemplateType($tname) { global $ItemTypePrefixes; $ret = "global"; $this->ReadTemplateTags($tname); if(count($this->Tags)>0) { foreach($this->Tags as $t) { if(in_array($t->name,$ItemTypePrefixes)) { $ret = $t->name; break; } } } return $ret; } function IncludeTemplate($tag, $SupressError=FALSE) { $this->AddDependency($tag->GetAttributeByName("_template")); $this->AddDependency($tag->GetAttributeByName("_noaccess")); } function ModuleInclude($tag) { } function AddDependency($template) { $template = strtolower($template); if(!in_array($template,$this->Dependencies)) $this->Dependencies[] = $template; } } function admintemplate($fileh) { if(file_exists($fileh)) { $fd = fopen($fileh, "r"); $ret=fread($fd, filesize($fileh)); fclose($fd); return $ret; } else echo "Unable to load $fileh"; } function ExtraAttributes($attribs) { $html_attr = ""; if(is_array($attribs)) { foreach($attribs as $name=>$value) { if(substr($name,0,1)!="_") $html_attr .= $name."=\"$value\" "; } } return $html_attr; } ?> Property changes on: trunk/kernel/include/parse.php ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.2 \ No newline at end of property +1.3 \ No newline at end of property Index: trunk/kernel/frontaction.php =================================================================== --- trunk/kernel/frontaction.php (revision 292) +++ trunk/kernel/frontaction.php (revision 293) @@ -1,855 +1,855 @@ <?php if( defined('DEBUG_ACTIONS') && (DEBUG_ACTIONS & FRONT_KERNEL_ACTIONS) == FRONT_KERNEL_ACTIONS ) { if($Action) echo '<span class="debug_text">Front, Kernel Action [<b>'.$Action."</b>]</span><br>\n"; } if( defined('DEBUG_ACTIONS') && (DEBUG_ACTIONS & FRONT_SHOW_REQUEST) == FRONT_SHOW_REQUEST ) { // don't show debug output in tree & header of admin & while logging in $script = basename($_SERVER['PHP_SELF']); echo '<table width="100%" cellspacing="0" cellpadding="5"><tr><td>'; echo "<div class=\"debug_text\">ScriptName: <b>$script</b> (<b>".dirname($_SERVER['PHP_SELF'])."</b>)</div><br>"; $div_height = (count($_REQUEST)+1)*26; if($div_height > 300) $div_height = 300; echo '<div class="debug_layer" style="height: '.$div_height.'px;">'; echo '<table border="0" cellspacing="0" cellpadding="4" class="debug_table">'; echo '<thead style="font-weight: bold;"><td>Src</td><td>Name</td><td>Value</td></thead>'; foreach($_REQUEST as $key => $value) { if( !is_array($value) && trim($value) == '' ) $value = ' '; $src = isset($_GET[$key]) ? 'GE' : (isset($_POST[$key]) ? 'PO' : (isset($_COOKIE[$key]) ? 'CO' : '?') ); echo '<tr><td>'.$src.'</td><td>'.$key.'</td><td>'.print_r($value, true).'</td></tr>'; } echo '</table></div>'; echo '</td></tr></table>'; unset($script); // echo "SID: ".$objSession->GetSessionKey().'<br>'; } switch($Action) { case "m_login": // if($objSession->ValidSession()) $objSession->Logout(); //echo $objSession->GetSessionKey()."<br>\n"; if ($objConfig->Get("CookieSessions") == 1 && $_COOKIE["CookiesTest"] != "1") { $FormError["login"]["login_user"] = language("lu_cookies_error"); } else { $MissingCount = SetMissingDataErrors("login"); if($MissingCount==2) { $FormError["login"]["login_user"]= language("lu_ferror_loginboth"); unset($FormError["login"]["login_password"]); } if($MissingCount==0) { if($_POST["login_user"]=="root") { $FormError["login"]["login_user"]= language("lu_access_denied"); } else { if ($objSession->Login($_POST["login_user"], md5($_POST["login_password"])) == FALSE) { $FormError["login"]["login_password"] = language("lu_incorrect_login"); } else { if( !headers_sent() && GetVar('usercookie') == 1 ) { $c = $_POST["login_user"]."|"; $pw = $_POST["login_password"]; if(strlen($pw) < 31) $pw = md5($pw); $c .= $pw; setcookie("login",$c,time()+2592000); } // set new destination template if passed $dest = GetVar('dest', true); if(!$dest) $dest = GetVar('DestTemplate', true); if($dest) $var_list['t'] = $dest; echo "DEST: $dest<br>"; } } } } break; case "m_forgotpw": $MissingCount = SetMissingDataErrors("forgotpw"); if($MissingCount==0) { $username = $_POST["username"]; $email = $_POST["email"]; $found = FALSE; if(strlen($username)) { $u = $objUsers->GetItemByField("Login",$username); if(is_object($u)) $found = ($u->Get("Login")==$username && $u->Get("Status")==1) && strlen($u->Get("Password")); } else if(strlen($email)) { $u = $objUsers->GetItemByField("Email",$email); if(is_object($u)) $found = ($u->Get("Email")==$email && $u->Get("Status")==1) && strlen($u->Get("Password")); } if($found) { $newpw = makepassword(); $u->Set("Password",$newpw); $u->Update(); $u->SendUserEventMail("USER.PSWD",$u->Get("PortalUserId")); $u->SendAdminEventMail("USER.PSWD"); $u->Set("Password",md5($newpw)); $u->Update(); $u->Clean(); } else { if(!strlen($username) && !strlen($email)) { $FormError["forgotpw"]["username"] = language("lu_ferror_forgotpw_nodata"); $MissingCount++; } else { if(strlen($username)) $FormError["forgotpw"]["username"] = language("lu_ferror_unknown_username"); if(strlen($email)) $FormError["forgotpw"]["email"] = language("lu_ferror_unknown_email"); $MissingCount++; } if(strlen($_GET["error"])) $var_list["t"] = $_GET["error"]; } } else if(strlen($_GET["error"])) $var_list["t"] = $_GET["error"]; break; case "m_subscribe_confirm": $t = ""; $SubscribeAddress = $_POST["subscribe_email"]; if(!ValidEmail($SubscribeAddress)&& strlen($SubscribeAddress)) { $t = $_GET["Error"]; $SubscribeError = "lu_invalid_emailaddress"; } else { if((int)$objConfig->Get("User_SubscriberGroup")>0) { $g = $objGroups->GetItem($objConfig->Get("User_SubscriberGroup")); if(is_object($g)) { $email = $_POST["subscribe_email"]; if(strlen($email)>0) { $u = $objUsers->GetItemByField("Email",$email); if(is_object($u)) { if($u->CheckBanned()) { $t = $_GET["Error"]; $SubscribeError ="lu_subscribe_banned"; } else { if($u->IsInGroup($g->Get("GroupId"))) { $t = $_GET["Unsubscribe"]; } else $t = $_GET["Subscribe"]; } } else $t = $_GET["Subscribe"]; } else { $t = $_GET["Error"]; $SubscribeError ="lu_subscribe_no_address"; } } else { $t = $_GET["Error"]; $SubscribeError ="lu_subscribe_unknown_error"; } } } if(strlen($t)) { $var_list["t"] = $t; $var_list_update["t"] = $t; } break; case "m_subscribe": //phpinfo(INFO_VARIABLES); if($_POST["buttons"][0]==language("lu_button_yes")) { $SubscribeAddress = $_POST["subscribe_email"]; if(strlen($SubscribeAddress)>0) { if(ValidEmail($SubscribeAddress)) { $GroupId = (int)$objConfig->Get("User_SubscriberGroup"); if ($GroupId) { $g = $objGroups->GetItem($GroupId); $u = $objUsers->GetItemByField("Email",$SubscribeAddress); if(is_object($u)) { if(strtolower($u->Get("Email"))==strtolower($SubscribeAddress)) { $bExists = TRUE; } else $bExists = FALSE; } if($bExists) { $g->AddUser($u->Get("PortalUserId")); } else { $u = new clsPortalUser(NULL); $u->Set("Email",$SubscribeAddress); $u->Set("ip",$_SERVER['REMOTE_ADDR']); $u->Set("CreatedOn",date("U")); $u->Set("Status",1); if(!$u->CheckBanned()) { $u->Create(); $g->AddUser($u->Get("PortalUserId"),1); } else $SubscribeResult = "lu_subscribe_banned"; } $SubscribeResult = "lu_subscribe_success"; $u->SendUserEventMail("USER.SUBSCRIBE",$u->Get("PortalUserId")); $u->SendAdminEventMail("USER.SUBSCRIBE"); if(strlen($_GET["Subscribe"])>0) $var_list["t"] = $_GET["Subscribe"]; } } else { $SubscribeResult = "lu_invalid_emailaddress"; } } else $SubscribeResult = "lu_subscribe_missing_address"; } if(!strlen($SubscribeResult)) $SubscribeResult = "lu_subscribe_success"; break; case "m_unsubscribe": if($_POST["buttons"][0]==language("lu_button_yes")) { $MissingCount = SetMissingDataErrors("m_unsubscribe"); if($MissingCount==0) { $email = $_POST["subscribe_email"]; $u = $objUsers->GetItemByField("Email",$email); if(is_object($u)) { if(strtolower($u->Get("Email"))==strtolower($email)) { $GroupId = (int)$objConfig->Get("User_SubscriberGroup"); if($u->PrimaryGroup()==$GroupId) { $u_gorup_list = $u->GetGroupList(); if (count($u_gorup_list) > 1) { $u->RemoveFromGroup($GroupId); } else { $u->RemoveFromAllGroups(); $u->Delete(); } } else { $u->RemoveFromGroup($GroupId); } } } if(strlen($_GET["Subscribe"])>0) $var_list["t"] = $_GET["Subscribe"]; } } break; case "m_logout": // $objSession->Logout(); //unset($objSession); //$objSession = new clsUserSession(); // $var_list_update["t"] = "index"; // setcookie("login","",time()-3600); break; case "m_register": $MissingCount = SetMissingDataErrors("m_register"); if(!$objConfig->Get("User_Password_Auto")) - { + { if(($_POST["password"] != $_POST["passwordverify"]) || !strlen($_POST["passwordverify"])) { $MissingCount++; $FormError["m_register"]["passwordverify"] = language("lu_ferror_pswd_mismatch"); } - } - - if(strlen($_POST["password"])>30) - { - // echo "VAR: ".$_POST["password"]; die(); - $MissingCount++; - $FormError["m_register"]["password"] = language("lu_ferror_pswd_toolong"); - } - - if (strlen($_POST['password']) < $objConfig->Get("Min_Password")) - { - $MissingCount++; - $FormError["m_register"]["password"] = language("lu_ferror_pswd_tooshort"); + + if(strlen($_POST["password"])>30) + { + // echo "VAR: ".$_POST["password"]; die(); + $MissingCount++; + $FormError["m_register"]["password"] = language("lu_ferror_pswd_toolong"); + } + + if (strlen($_POST['password']) < $objConfig->Get("Min_Password")) + { + $MissingCount++; + $FormError["m_register"]["password"] = language("lu_ferror_pswd_tooshort"); + } } $u = $objUsers->GetItemByField("Login",$_POST["username"]); if(is_object($u)) { if($u->Get("Login")==$_POST["username"]) { $MissingCount++; $FormError["m_register"]["username"] = language("lu_user_exists"); } } if (strlen($_POST['username']) < $objConfig->Get("Min_UserName")) { $MissingCount++; $FormError["m_register"]["username"] = language("lu_ferror_username_tooshort"); } if(!$MissingCount) { $CreatedOn = adodb_date("U"); $GroupId = $objConfig->Get("User_NewGroup"); $Status=0; /* determine the status of new users */ switch ($objConfig->Get("User_Allow_New")) { case "1": $Status=1; break; case "3": $Status=2; break; } /* set Destination template */ $var_list["t"] = strlen($_GET["dest"])? $_GET["dest"] : "index"; if($Status>0) { if($objConfig->Get("User_Password_Auto")) { $password = makepassword(); } else $password = $_POST["password"]; $_POST["dob"] = $_POST["dob_month"]."/".$_POST["dob_day"]."/".$_POST["dob_year"]; $dob = DateTimestamp($_POST["dob"],GetDateFormat()); $ip = $_SERVER['REMOTE_ADDR']; $u = &$objUsers->Add_User($_POST["username"], md5($password), $_POST["email"], $CreatedOn, $_POST["firstname"], $_POST["lastname"], $Status, $_POST["phone"], $_POST["street"], $_POST["city"], $_POST["state"], $_POST["zip"], $_POST["country"], $dob, $ip, TRUE); if(!is_object($u)) { $RuleId=$u; $r = $objBanList->GetItem($RuleId); $err = $r->Get("ErrorTag"); if(strlen($err)) { $FormError["m_register"][$r->Get("ItemField")] = language($err); $MissingCount++; } } else { $u->Set("Password",$password); $u->Clean(); if($GroupId>0) { $g = $objGroups->GetItem($GroupId); $g->AddUser($u->Get("PortalUserId"),1); } $custom = $_POST["custom"]; if(is_array($custom)) { for($x=0;$x<count($custom);$x++) { $u->SetCustomField($custom[$x],$_POST[$custom[$x]]); } $u->SaveCustomFields(); } if($Status==1) { if($objConfig->Get("User_Password_Auto")) { $u->SendUserEventMail("USER.VALIDATE",$u->Get("PortalUserId")); $u->SendAdminEventMail("USER.VALIDATE"); } else { $doLoginNow = true; $u->SendUserEventMail("USER.ADD",$u->Get("PortalUserId")); $u->SendAdminEventMail("USER.ADD"); } } else { $u->SendUserEventMail("USER.ADD.PENDING",$u->Get("PortalUserId")); $u->SendAdminEventMail("USER.ADD.PENDING"); } if ($doLoginNow) $objSession->Login($_POST["username"], md5($password)); } } } break; case "m_add_friend": $id = $_GET["UserId"]; $userid = $objSession->Get("PortalUserId"); if($id!=$userid) { $u =& $objUsers->GetItem($id); $u->AddFavorite($userid); } break; case "m_del_friend": $id = $_GET["UserId"]; $userid = $objSession->Get("PortalUserId"); $u =& $objUsers->GetItem($id); $u->DeleteFavorite(); break; case "m_acctinfo": // phpinfo(INFO_VARIABLES); $MissingCount = SetMissingDataErrors("m_acctinfo"); $UserId = $_GET["UserId"]; if($UserId != $objSession->Get("PortalUserId")) { $MissingCount++; $FormError["m_acctinfo"]["UserId"] = language("lu_ferror_m_profile_userid"); } if(strlen($_POST["password"])>0) { if(($_POST["password"] != $_POST["passwordverify"]) || !strlen($_POST["passwordverify"])) { $MissingCount++; $FormError["m_acctinfo"]["passwordverify"] = language("lu_ferror_pswd_mismatch"); } if(strlen($_POST["password"])>30) { // echo "VAR: ".$_POST["password"]; die(); $MissingCount++; $FormError["m_acctinfo"]["password"] = language("lu_ferror_pswd_toolong"); } if (strlen($_POST['password']) < $objConfig->Get("Min_Password")) { $MissingCount++; $FormError["m_acctinfo"]["password"] = language("lu_ferror_pswd_tooshort"); } } if(!$MissingCount) { /* save profile */ $u =& $objUsers->GetItem($UserId); $status = $u->Get("Status"); $_POST["dob"] = $_POST["dob_month"]."/".$_POST["dob_day"]."/".$_POST["dob_year"]; $dob = DateTimestamp($_POST["dob"], GetDateFormat()); if(strlen($_POST["password"])>0) { $password = md5($_POST["password"]); } else $password = ""; $objUsers->Edit_User($UserId, $_POST["username"], $password, $_POST["email"], 0, $_POST["firstname"], $_POST["lastname"], $status, $_POST["phone"], $_POST["street"], $_POST["city"], $_POST["state"], $_POST["zip"], $_POST["country"], $dob); } break; case "m_profile": $userid = $objSession->Get("PortalUserId"); if($userid>0) { $u = $objUsers->GetItem($userid); foreach($_POST as $field=>$value) { if(substr($field,0,3)=="pp_") { $objSession->SetPersistantVariable($field,$value); } } } break; case "m_set_lang": $lang = $_GET["lang"]; $LangId = 0; if(strlen($lang)) { $l = $objLanguages->GetItemByField("PackName",$lang); if(is_object($l)) { $LangId = $l->Get("LanguageId"); } } if($LangId) { if($objSession->Get("PortalUserId")>0) { $objSession->SetPersistantVariable("Language",$LangId); } $objSession->Set("Language",$LangId); $objSession->Update(); $m_var_list_update["lang"] = $LangId; $m_var_list["lang"] = $LangId; } break; case "m_set_theme": $id = $_POST["ThemeId"]; if(!is_numeric($id)) $id = $_GET["ThemeId"]; if($id) { $objSession->SetThemeName($id); $m_var_list["t"] = "index"; $m_var_list_update["theme"] = $id; $m_var_list["theme"] = $id; unset($CurrentTheme); } break; case "m_sort_cats": $objSession->SetVariable("Category_Sortfield",$_POST["cat_field_sort"]); $objSession->SetVariable("Category_Sortorder",$_POST["cat_sort_order"]); break; case "m_add_cat_confirm": // phpinfo(INFO_VARIABLES); $perm = 0; $CategoryId=$objCatList->CurrentCategoryID(); if ($objSession->HasCatPermission("CATEGORY.ADD.PENDING")) $perm = 2; if ($objSession->HasCatPermission("CATEGORY.ADD")) $perm = 1; if ($perm == 0) { $MissingCount++; $FormError["m_addcat"]["name"] = language("lu_ferror_no_access"); } else { $MissingCount = SetMissingDataErrors("m_addcat"); if(is_array($_FILES)) { foreach($_FILES as $field => $file) { $allowed = TRUE; if(strlen($_POST["imagetypes"][$field])) { $types = explode(",",strtolower($_POST["imagetypes"][$field])); if(is_array($types)) { if(count($types)>0) { $path_parts = pathinfo($file["name"]); $ext = $path_parts["extension"]; $allowed = in_array($ext,$types); if(!$allowed) { $MissingCount++; $FormError["m_addcat"][$field] = language("lu_ferror_wrongtype"); } } } } $maxsize = (int)$_POST["maxsize"][$field]; if($maxsize>0 && $allowed && $file["size"]>$maxsize) { $allowed = FALSE; $MissingCount++; $FormError["m_addcat"][$field] = language("lu_ferror_toolarge"); } } } if($MissingCount==0) { $CreatedOn = date("U"); $name = $_POST["name"]; $desc = $_POST["description"]; $metadesc = $_POST["meta_description"]; $keywords = $_POST["meta_keywords"]; $parent = $objCatList->CurrentCategoryID(); $cat =& $objCatList->Add($parent, $name, inp_escape($desc,0), $CreatedOn, 0, $perm, 2, 2, 2, 0, $keywords,$metadesc); $cat->UpdateCachedPath(); $cat->Update(); $cat->UpdateACL(); $objCatList->UpdateMissingCacheData(); if(strlen($_GET["Confirm"])) { $var_list["t"] = $_GET["Confirm"]; } else $var_list["t"] = $_GET["DestTemplate"]; } } break; case "m_front_review_add": if($objSession->InSpamControl($_POST["ItemId"])) { $StatusMessage["review"] = language("la_Review_AlreadyReviewed"); } else { $objReviews = new clsItemReviewList(); $Status = $objConfig->Get("Review_DefaultStatus"); $CreatedOn = adodb_date("U"); $html = (int)$objConfig->Get("Review_Html"); $ReviewText = inp_escape($_POST["review_text"],$html); $r = $objReviews->AddReview($CreatedOn,$ReviewText,$Status, $IPAddress, 0, $_POST["ItemId"], $_POST["ItemType"], $objSession->Get("PortalUserId")); foreach($ItemTypes as $type=>$id) { if($id==$_POST["ItemType"]) { $ValName = $type."_ReviewDelay_Value"; $IntName = $type."_ReviewDelay_Interval"; break; } } if(strlen($ValName) && strlen($IntName)) { $exp_secs = $objConfig->Get($ValName) * $objConfig->Get($IntName); $objSession->AddToSpamControl($_POST["ItemId"],$exp_secs); if(is_object($r)) { if($Status) { $StatusMessage["review"] = language("la_Review_Added"); } else $StatusMessage["review"] = language("la_Review_Pending"); } else $StatusMessage["review"] = language("la_Review_Error"); } else $StatusMessage["error"] = language("la_ConfigError_Review"); } break; case "m_suggest_email": $cutoff = time()+(int)$objConfig->Get("Suggest_MinInterval"); $email = $_POST["suggest_email"]; if (strlen($email)) { if(ValidEmail($email)) { $sql = "SELECT * FROM ".GetTablePrefix()."SuggestMail WHERE email='".inp_escape($email,0)."' and sent<".$cutoff; $adodbConnection = GetADODBConnection(); $rs = $adodbConnection->Execute($sql); $rs = false; if($rs && !$rs->EOF) { if(strlen($_GET["Error"])>0) $var_list["t"] = $_GET["Error"]; $suggest_result = "$email ".language("lu_already_suggested ")." ".LangDate($rs->fields["sent"]); } else { $Event =& $objMessageList->GetEmailEventObject("USER.SUGGEST"); if(is_object($Event)) { if($Event->Get("Enabled")=="1") { $Event->Item = $this; $Event->SendToAddress($email); $sql = "INSERT INTO ".GetTablePrefix()."SuggestMail (email,sent) VALUES ('".inp_escape($email,0)."','".time()."')"; $rs = $adodbConnection->Execute($sql); $suggest_result=language("lu_suggest_success")." ".$email; } } $e =& $objMessageList->GetEmailEventObject("USER.SUGGEST",1); if($e->Get("Enabled")==1) $e->SendAdmin(); if(strlen($_GET["Confirm"])>0) $var_list["t"] = $_GET["Confirm"]; } } else { if(strlen($_GET["Error"])>0) $var_list["t"] = $_GET["Error"]; $suggest_result=language("lu_invalid_emailaddress"); } } else { if(strlen($_GET["Error"])>0) $var_list["t"] = $_GET["Error"]; $suggest_result=language("lu_suggest_no_address"); } break; case "m_simple_search": $keywords = $_POST["keywords"]; $type = $objItemTypes->GetTypeByName("Category"); $objSearch = new clsSearchResults("Category","clsCategory"); if(strlen($keywords)) { $objSearchList = new clsSearchLogList(); $objSearchList->UpdateKeyword($keywords,0); $objSearch->SetKeywords($keywords); $objSearch->AddSimpleFields(); if(is_numeric($objConfig->Get("SearchRel_Pop_category"))) $objSearch->PctPop = ($objConfig->Get("SearchRel_Pop_category")/100); if(is_numeric($objConfig->Get("SearchRel_Keyword_category"))) $objSearch->PctRelevance = ($objConfig->Get("SearchRel_Keyword_category")/100); if(is_numeric($objConfig->Get("SearchRel_Rating_article"))) $objSearch->PctRating = ($objConfig->Get("SearchRel_Rating_category")/100); //echo "Searching On $keywords<br>\n"; $objSearch->PerformSearch(1,$SortOrder,TRUE); $SearchPerformed = TRUE; //$objSearch->SetRelevence($type->Get("ItemType"), "CategoryId"); //echo "Finished Setting Category Relevence<br>\n"; } else { if(strlen($_GET["Error"])>0) $var_list["t"] = $_GET["Error"]; $MissingCount = SetMissingDataErrors("m_simplesearch"); $MissingCount++; $FormError["m_simplesearch"]["keywords"] = language("lu_no_keyword"); } break; case "m_adv_search": if( !is_object($objSearchConfig) ) $objSearchConfig = new clsSearchConfigList(); switch($_GET["type"]) { case 1: /* category */ //echo "Searching for categories<br>"; $objAdvSearch = new clsAdvancedSearchResults("Category","clsCategory"); foreach($objSearchConfig->Items as $field) { $fld = $field->Get("FieldName"); $Verb = $_POST["verb"][$field->Get("FieldName")]; if(!strlen($Verb) && $field->Get("FieldType")=="boolean") { if($_POST["value"][$field->Get("FieldName")]!=-1) { $Value = $_POST["value"][$field->Get("FieldName")]; $Verb = "is"; } } else { $Value = $_POST["value"][$field->Get("FieldName")]; } switch( $_POST["andor"][$field->Get("FieldName")]) { case 1: $Conjuction = "AND"; break; case 2: $Conjuction = "OR"; break; default: $Conjuction = ""; break; } if(strlen($Verb)>0 && $Verb!="any") { //echo "Adding CAT SearchField: [".$field->Get("TableName")."]; [".$field->Get("FieldName")."]; [$Verb]; [$Value]; [$Conjuction]<br>"; $objAdvSearch->AddAdvancedField($field->Get("TableName"),$field->Get("FieldName"),$Verb,$Value,$Conjuction); } } $objAdvSearch->PerformSearch(1,NULL,TRUE); break; } break; case "m_id": echo $Action.":".$DownloadId; die(); break; case "m_simple_subsearch": $keywords = $_POST["keywords"]; $type = $objItemTypes->GetTypeByName("Category"); $objSearch = new clsSearchResults("Category","clsCategory"); if(strlen($keywords)) { $objSearchList = new clsSearchLogList(); $objSearchList->UpdateKeyword($keywords,0); $objSearch->SetKeywords($keywords); $objSearch->AddSimpleFields(); if(is_numeric($objConfig->Get("SearchRel_Pop_category"))) $objSearch->PctPop = ($objConfig->Get("SearchRel_Pop_category")/100); if(is_numeric($objConfig->Get("SearchRel_Keyword_category"))) $objSearch->PctRelevance = ($objConfig->Get("SearchRel_Keyword_category")/100); if(is_numeric($objConfig->Get("SearchRel_Rating_article"))) $objSearch->PctRating = ($objConfig->Get("SearchRel_Rating_category")/100); $SearchResultIdList = $objSearch->Result_IdList(); if(count($SearchResultIdList)>0) { $objSearch->PerformSearch(1,$SortOrder,TRUE,$SearchResultIdList); //$objSearch->SetRelevence($type->Get("ItemType"), "CategoryId"); } $SearchPerformed = TRUE; } else { $MissingCount = SetMissingDataErrors("m_simplesearch"); $MissingCount++; $FormError["m_simplesearch"]["keywords"] = language("lu_no_keyword"); } break; } ?> Property changes on: trunk/kernel/frontaction.php ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.11 \ No newline at end of property +1.12 \ No newline at end of property Index: trunk/admin/users/group_addpermission.php =================================================================== --- trunk/admin/users/group_addpermission.php (revision 292) +++ trunk/admin/users/group_addpermission.php (revision 293) @@ -1,200 +1,200 @@ <?php ############################################################## ##In-portal ## ############################################################## ## In-portal ## ## Intechnic Corporation ## ## All Rights Reserved, 1998-2002 ## ## ## ## No portion of this code may be copied, reproduced or ## ## otherwise redistributed without proper written ## ## consent of Intechnic Corporation. Violation will ## ## result in revocation of the license and support ## ## privileges along maximum prosecution allowed by law. ## ############################################################## if(!strlen($pathtoroot)) { $path=dirname(realpath($_SERVER['SCRIPT_FILENAME'])); if(strlen($path)) { /* determine the OS type for path parsing */ $pos = strpos($path,":"); if ($pos === false) { $gOS_TYPE="unix"; $pathchar = "/"; } else { $gOS_TYPE="win"; $pathchar="\\"; } $p = $path.$pathchar; /*Start looking for the root flag file */ while(!strlen($pathtoroot) && strlen($p)) { $sub = substr($p,strlen($pathchar)*-1); if($sub==$pathchar) { $filename = $p."root.flg"; } else $filename = $p.$pathchar."root.flg"; if(file_exists($filename)) { $pathtoroot = $p; } else { $parent = realpath($p.$pathchar."..".$pathchar); if($parent!=$p) { $p = $parent; } else $p = ""; } } if(!strlen($pathtoroot)) $pathtoroot = ".".$pathchar; } else { $pathtoroot = ".".$pathchar; } } $sub = substr($pathtoroot,strlen($pathchar)*-1); if($sub!=$pathchar) { $pathtoroot = $pathtoroot.$pathchar; } //echo $pathtoroot; require_once($pathtoroot."kernel/startup.php"); //admin only util $rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); $admin = $objConfig->Get("AdminDirectory"); if(!strlen($admin)) $admin = "admin"; $localURL=$rootURL."kernel/"; $adminURL = $rootURL.$admin; $imagesURL = $adminURL."/images"; //$pathtolocal = $pathtoroot."in-news/"; 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"); unset($objEditItems); $objEditItems = new clsGroupList(); $objEditItems->SourceTable = $objSession->GetEditTable("PortalGroup"); $objEditItems->EnablePaging = FALSE; $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_group"; $envar = "env=" . BuildEnv() . "&en=$en"; $section = 'in-portal:editgroup_permissions'; //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('editgroup','GroupEditStatus','".$admin."/users/addgroup_permissions.php',0);","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('editgroup','GroupEditStatus','".$admin."/users/addgroup_permissions.php',-1);","tool_cancel.gif"); $PermModule = $_GET["module"]; $title = prompt_language("la_Text_Editing")." ".prompt_language("la_Text_Group")." '".$c->Get("Name")."' - ".prompt_language("la_tab_Permissions"); if ( isset($en_prev) || isset($en_next) ) { $url = $RootUrl.$admin."/users/group_addpermission.php"; $StatusField = "GroupEditStatus"; $form = "editgroup"; MultiEditButtons($objCatToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'&module='.$_REQUEST['module'],'la_PrevGroup','la_NextGroup'); } int_header($objCatToolBar,NULL,$title); ?> <TABLE CELLPADDING=0 CELLSPACING=0 class="tableborder" width="100%"> <TBODY> <tr BGCOLOR="#e0e0da"> <td WIDTH="100%" CLASS="navar"> <img height="15" src="<?php echo $imagesURL; ?>/arrow.gif" width="15" align="middle" border="0"> <span class="NAV_CURRENT_ITEM"><A CLASS="control_link" HREF="javascript:edit_submit('editgroup','GroupEditStatus','<?php echo $admin; ?>/users/addgroup_permissions.php',0);"><?php echo prompt_language("la_Prompt_GeneralPermissions"); ?></A>><?php echo prompt_language("la_PermType_$PermModule"); ?></span> </td> </TR> </TBODY> </TABLE> <table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder"> <form ID="editgroup" name="editgroup" action="" method=POST> <TR class="subsectiontitle"> <?php - echo "<TD>".prompt_language("la_prompt_Description")."</TD><TD>".prompt_language("la_ColHeader_PermInherited")."</TD><TD>".prompt_language("la_ColHeader_PermAccess")."</TD></TR>\n"; + echo "<TD>".prompt_language("la_prompt_Description")."</TD><!--<TD>".prompt_language("la_ColHeader_PermInherited")."</TD>--><TD>".prompt_language("la_ColHeader_PermAccess")."</TD></TR>\n"; ?> </TR> <?php $GroupId= $c->Get("GroupId"); $ado = GetADODBConnection(); $sql = "SELECT * FROM ".GetTablePrefix()."PermissionConfig WHERE ModuleId='$PermModule'"; if($objSession->HasSystemPermission("DEBUG.LIST")) echo htmlentities($sql,ENT_NOQUOTES)."<br>\n"; $permlist = array(); $rs = $ado->Execute($sql); while($rs && !$rs->EOF) { $Permission = $rs->fields["PermissionName"]; echo "<tr ".int_table_color_ret().">\n"; echo " <TD>".prompt_language($rs->fields["Description"])."</TD>\n"; $checked = ""; $value = $c->HasSystemPermission($Permission); $disabled = ""; if($value==-1) { $checked = " checked"; - $disabled = "DISABLED=\"true\""; + // $disabled = "DISABLED=\"true\""; } - echo " <TD><INPUT access=\"chk".$Permission."\" ONCLICK=\"SetAccessEnabled(this); \" TYPE=CHECKBOX name=\"inherit[]\" VALUE=\"".$Permission."\" $checked></TD>\n"; + //echo " <TD><INPUT access=\"chk".$Permission."\" ONCLICK=\"SetAccessEnabled(this); \" TYPE=CHECKBOX name=\"inherit[]\" VALUE=\"".$Permission."\" $checked></TD>\n"; $checked = ""; if($value==1) { $checked = "checked"; $imgsrc = "green"; } else $imgsrc = "red"; echo " <TD><INPUT $disabled InheritValue=\"false\" UnInheritValue=\"false\" ID=\"chk".$Permission."\" ONCLICK=\"SetPermImage(this); \" permimg=\"img".$Permission."\" TYPE=CHECKBOX name=\"permvalue[]\" VALUE=\"".$Permission."\" $checked>"; echo " <img ID=\"img".$Permission."\" SRC=\"$imagesURL/perm_".$imgsrc.".gif\"> </TD>"; echo "</TR>"; $permlist[]=$Permission; $rs->MoveNext(); } ?> <input type="hidden" name="Action" value="m_group_sysperm"> <input type="hidden" name="GroupId" value="<?php echo $c->Get("ResourceId"); ?>"> <input type="hidden" name="PermList" value="<?php echo implode(",",$permlist); ?>"> <input type="hidden" name="GroupEditStatus" value="0"> </FORM> </TABLE> <?php int_footer(); ?> Property changes on: trunk/admin/users/group_addpermission.php ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.1 \ No newline at end of property +1.2 \ No newline at end of property Index: trunk/admin/images/toolbar/tool_import_language_f3.gif =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: trunk/admin/images/toolbar/tool_import_language_f3.gif ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.1 \ No newline at end of property +1.2 \ No newline at end of property Index: trunk/admin/images/toolbar/tool_import_language.gif =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: trunk/admin/images/toolbar/tool_import_language.gif ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.1 \ No newline at end of property +1.2 \ No newline at end of property Index: trunk/admin/images/toolbar/tool_import_language_f2.gif =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: trunk/admin/images/toolbar/tool_import_language_f2.gif ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.1 \ No newline at end of property +1.2 \ No newline at end of property Index: trunk/admin/category/addcategory_images.php =================================================================== --- trunk/admin/category/addcategory_images.php (revision 292) +++ trunk/admin/category/addcategory_images.php (revision 293) @@ -1,346 +1,347 @@ <?php ############################################################## ##In-portal ## ############################################################## ## In-portal ## ## Intechnic Corporation ## ## All Rights Reserved, 1998-2002 ## ## ## ## No portion of this code may be copied, reproduced or ## ## otherwise redistributed without proper written ## ## consent of Intechnic Corporation. Violation will ## ## result in revocation of the license and support ## ## privileges along maximum prosecution allowed by law. ## ############################################################## if(!strlen($pathtoroot)) { $path=dirname(realpath($_SERVER['SCRIPT_FILENAME'])); if(strlen($path)) { /* determine the OS type for path parsing */ $pos = strpos($path,":"); if ($pos === false) { $gOS_TYPE="unix"; $pathchar = "/"; } else { $gOS_TYPE="win"; $pathchar="\\"; } $p = $path.$pathchar; /*Start looking for the root flag file */ while(!strlen($pathtoroot) && strlen($p)) { $sub = substr($p,strlen($pathchar)*-1); if($sub==$pathchar) { $filename = $p."root.flg"; } else $filename = $p.$pathchar."root.flg"; if(file_exists($filename)) { $pathtoroot = $p; } else { $parent = realpath($p.$pathchar."..".$pathchar); if($parent!=$p) { $p = $parent; } else $p = ""; } } if(!strlen($pathtoroot)) $pathtoroot = ".".$pathchar; } else { $pathtoroot = ".".$pathchar; } } $sub = substr($pathtoroot,strlen($pathchar)*-1); if($sub!=$pathchar) { $pathtoroot = $pathtoroot.$pathchar; } //echo $pathtoroot; require_once($pathtoroot."kernel/startup.php"); //admin only util $rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); $admin = $objConfig->Get("AdminDirectory"); if(!strlen($admin)) $admin = "admin"; $localURL=$rootURL."kernel/"; $adminURL = $rootURL.$admin; $imagesURL = $adminURL."/images"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/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); } } /* ------------------------------------- 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,'','<br>(".admin_language("la_prompt_Primary").") ')) as FullName, "; $sql .="if(img.LocalImage=1,'(".admin_language("la_Text_Local").") ',img.Url) as ShowURL, concat( '<IMG src=\"',"; $sql .="IF (img.LocalThumb=1, CASE WHEN ( LENGTH( img.ThumbPath ) >0 AND img.LocalThumb =1 ) "; $sql .="THEN concat('".$rootURL."',img.ThumbPath,'?".time()."') END , img.ThumbUrl), '\">') 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)."<br>\n"; for($i=0;$i<count($objImageList->Items);$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;$i<count($objImageList->Items);$i++) { $img =& $objImageList->GetItemRefByIndex($i); $objListView->RowIcons[] = $img->Get("Icon"); } $objListToolBar->AddToInitScript("fwLoadMenus();\n"); $h = "\n\n<SCRIPT Language=\"JavaScript1.2\">\n".$objListView->GetViewMenu($imagesURL)."\n</SCRIPT>\n"; int_header($objListToolBar,NULL, $title,NULL,$h); if ($objSession->GetVariable("HasChanges") == 1) { ?> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar"> <tr> <td valign="top"> <?php int_hint_red(admin_language("la_Warning_Save_Item")); ?> </td> </tr> </table> <?php } ?> <form name="imagelistform" ID="imagelistform" action="<?php echo $_SERVER["PHP_SELF"]."?".$envar;?>" method=POST> <table cellSpacing="0" cellPadding="2" width="100%" class="tableborder"> <tbody> <?php print $objListView->PrintList(); ?> <input TYPE="hidden" NAME="ResourceId" VALUE="<?php echo $c->Get("ResourceId"); ?>"> <input type="hidden" name="Action" value="m_item_image"> </FORM> </TBODY> </table> <FORM NAME="save_edit_buttons" ID="save_edit_buttons" method="POST" ACTION=""> - <input type=hidden NAME="Action" VALUE="save_category_edit"> + <input type=hidden NAME="Action" VALUE="save_category_edit"> + <INPUT TYPE="hidden" NAME="CategoryId" VALUE="<?php echo $c->Get("CategoryId"); ?>"> <input type="hidden" name="CatEditStatus" VALUE="0"> </FORM> <FORM ID="ListSearchForm" NAME="ListSearchForm" method="POST" action="<?php echo $_SERVER["PHP_SELF"]."?env=".BuildEnv(); ?>"> <INPUT TYPE="HIDDEN" NAME="Action" VALUE=""> <INPUT TYPE="HIDDEN" NAME="list_search"> </FORM> <!-- CODE FOR VIEW MENU --> <form ID="viewmenu" method="post" action="<?php echo $_SERVER["PHP_SELF"]."?".$envar; ?>" name="viewmenu"> <input type="hidden" name="fieldname" value=""> <input type="hidden" name="varvalue" value=""> <input type="hidden" name="varvalue2" value=""> <input type="hidden" name="Action" value=""> </form> <script language="JavaScript1.2" src="<?php echo $adminURL; ?>/listview/listview.js"></script> <script language="JavaScript1.2"> initSelectiorContainers(); <?php echo $objListToolBar->Get("CheckClass").".setImages();"; ?> </script> <!-- END CODE--> <?php int_footer(); ?> \ No newline at end of file Property changes on: trunk/admin/category/addcategory_images.php ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.2 \ No newline at end of property +1.3 \ No newline at end of property Index: trunk/admin/install.php =================================================================== --- trunk/admin/install.php (revision 292) +++ trunk/admin/install.php (revision 293) @@ -1,1894 +1,1894 @@ <?php error_reporting(0); //$new_version = '1.0.2'; define("GET_LICENSE_URL", "http://www.intechnic.com/myaccount/license.php"); define('BACKUP_NAME', 'dump(.*).txt'); // how backup dump files are named $general_error = ''; if ($_POST['install_type'] != '') { $install_type = $_POST['install_type']; } else if ($_GET['install_type'] != '') { $install_type = $_GET['install_type']; } $force_finish = isset($_REQUEST['ff']) ? true : false; $pathtoroot = ""; if(!strlen($pathtoroot)) { $path=dirname(realpath($_SERVER['SCRIPT_FILENAME'])); //$path=dirname(realpath($_SERVER['PATH_TRANSLATED'])); if(strlen($path)) { /* determine the OS type for path parsing */ $pos = strpos($path,":"); if ($pos === false) { $gOS_TYPE="unix"; $pathchar = "/"; } else { $gOS_TYPE="win"; $pathchar="\\"; } $p = $path.$pathchar; /*Start looking for the root flag file */ while(!strlen($pathtoroot) && strlen($p)) { $sub = substr($p,strlen($pathchar)*-1); if($sub==$pathchar) { $filename = $p."root.flg"; } else $filename = $p.$pathchar."root.flg"; if(file_exists($filename)) { $pathtoroot = $p; } else { $parent = realpath($p.$pathchar."..".$pathchar); if($parent!=$p) { $p = $parent; } else $p = ""; } } if(!strlen($pathtoroot)) $pathtoroot = ".".$pathchar; } else { $pathtoroot = ".".$pathchar; } } if( file_exists($pathtoroot.'debug.php') && !defined('DEBUG_MODE') ) include_once($pathtoroot.'debug.php'); //if( !defined('DEBUG_MODE') ) error_reporting(0); $path_char = GetPathChar(); //phpinfo(INFO_VARIABLES); $sub = substr($pathtoroot,strlen($pathchar)*-1); if($sub!=$pathchar) { $pathtoroot = $pathtoroot.$pathchar; } $is_install = TRUE; $admin = substr($path,strlen($pathtoroot)); $state = isset($_GET["state"]) ? $_GET["state"] : ''; if(!strlen($state)) { $state = $_POST["state"]; } include($pathtoroot.$admin."/install/install_lib.php"); $ini_file = $pathtoroot."config.php"; if(file_exists($ini_file)) { $write_access = is_writable($ini_file); $ini_vars = inst_parse_portal_ini($ini_file,TRUE); foreach($ini_vars as $secname => $section) { foreach($section as $key => $value) { $key = "g_".str_replace('-', '', $key); global $$key; $$key = $value; } } } else { $state=""; $write_access = is_writable($pathtoroot); if($write_access) { set_ini_value("Database", "DBType", ""); set_ini_value("Database", "DBHost", ""); set_ini_value("Database", "DBUser", ""); set_ini_value("Database", "DBUserPassword", ""); set_ini_value("Database", "DBName", ""); set_ini_value("Module Versions", "In-Portal", ""); save_values(); } } $titles[1] = "General Site Setup"; $configs[1] = "in-portal:configure_general"; $mods[1] = "In-Portal"; $titles[2] = "User Setup"; $configs[2] = "in-portal:configure_users"; $mods[2] = "In-Portal:Users"; $titles[3] = "Category Display Setup"; $configs[3] = "in-portal:configure_categories"; $mods[3] = "In-Portal"; // simulate rootURL variable: begin $rootURL = 'http://'.dirname($_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']); $tmp = explode('/', $rootURL); if( $tmp[ count($tmp) - 1 ] == $admin) unset( $tmp[ count($tmp) - 1 ] ); $rootURL = implode('/', $tmp).'/'; unset($tmp); //echo "RU: $rootURL<br>"; // simulate rootURL variable: end $db_savings = Array('dbinfo', 'db_config_save', 'db_reconfig_save'); //, 'reinstall_process' if(strlen($g_DBType)>0 && strlen($state)>0 && !in_array($state, $db_savings) ) { require_once($pathtoroot."kernel/startup.php"); $localURL=$rootURL."kernel/"; $adminURL = $rootURL.$admin; $imagesURL = $adminURL."/images"; //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."/toolbar.php"); } function GetPathChar($path = null) { if( !isset($path) ) $path = $GLOBALS['pathtoroot']; $pos = strpos($path, ':'); return ($pos === false) ? "/" : "\\"; } function SuperStrip($str, $inverse = false) { $str = $inverse ? str_replace("%5C","\\",$str) : str_replace("\\","%5C",$str); return stripslashes($str); } require_once($pathtoroot.$admin."/install/inst_ado.php"); $helpURL = $rootURL.$admin.'/help/install_help.php?destform=popup&help_usage=install'; ?> <html> <head> <title>In-Portal Installation</title> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <meta name="generator" content="Notepad"> <link rel="stylesheet" type="text/css" href="include/style.css"> <LINK REL="stylesheet" TYPE="text/css" href="install/2col.css"> <SCRIPT LANGUAGE="JavaScript1.2"> function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function swap(imgid, src){ var ob = document.getElementById(imgid); ob.src = 'images/' + src; } function Continue() { document.iform1.submit(); } function CreatePopup(window_name, url, width, height) { // creates a popup window & returns it if(url == null && typeof(url) == 'undefined' ) url = ''; if(width == null && typeof(width) == 'undefined' ) width = 750; if(height == null && typeof(height) == 'undefined' ) height = 400; return window.open(url,window_name,'width='+width+',height='+height+',status=yes,resizable=yes,menubar=no,scrollbars=yes,toolbar=no'); } function ShowHelp(section) { var frm = document.getElementById('help_form'); frm.section.value = section; frm.method = 'POST'; CreatePopup('HelpPopup','<?php echo $rootURL.$admin; ?>/help/blank.html'); // , null, 600); frm.target = 'HelpPopup'; frm.submit(); } </SCRIPT> </head> <body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" style="height: 100%"> <form name="help_form" id="help_form" action="<?php echo $helpURL; ?>" method="post"><input type="hidden" id="section" name="section" value=""></form> <form enctype="multipart/form-data" name="iform1" id="iform1" method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>"> <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"> <tr> <td height="90"> <table cellpadding="0" cellspacing="0" border="0" width="100%" height="90"> <tr> <td rowspan="3" valign="top"><a href="http://www.in-portal.net" target="_top"><img alt="In-portal" src="images/globe.gif" width="84" height="91" border="0"></a></td> <td rowspan="3" valign="top"><a href="http://www.in-portal.net" target="_top"><img alt="In-portal" src="images/logo.gif" width="150" height="91" border="0"></a></td> <td rowspan="3" width="100000" align="right"> </td> <td width="400"><img alt="" src="images/blocks.gif" width="400" height="73"></td> </tr> <tr><td align="right" background="images/version_bg.gif" class="head_version" valign="top"><img alt="" src="images/spacer.gif" width="1" height="14">In-Portal Version <?php echo GetMaxPortalVersion($pathtoroot.$admin)?>: English US</td></tr> <tr><td><img alt="" src="images/blocks2.gif" width="400" height="2"><br></td></tr> <tr><td bgcolor="black" colspan="4"><img alt="" src="images/spacer.gif" width="1" height="1"><br></td></tr> </table> </td> </tr> <?php require_once($pathtoroot."kernel/include/adodb/adodb.inc.php"); if(!strlen($state)) $state = @$_POST["state"]; //echo $state; if(strlen($state)==0) { $ado = inst_GetADODBConnection(); if($ado) { $installed = TableExists($ado,"ConfigurationAdmin,Category,Permissions"); } if(!minimum_php_version("4.1.2")) { $general_error = "You have version ".phpversion()." - please upgrade!"; //die(); } if(!$write_access) { if ($general_error != '') { $general_error .= '<br /><br />'; } $general_error .= "Install cannot write to config.php in the root directory of your in-portal installation ($pathtoroot)."; //die(); } if(!is_writable($pathtoroot."themes/")) { if ($general_error != '') { $general_error .= '<br /><br />'; } $general_error .= "In-portal's Theme directory must be writable (".$pathtoroot."themes/)."; //die(); } if(!is_writable($pathtoroot."kernel/images/")) { if ($general_error != '') { $general_error .= '<br /><br />'; } $general_error .= "In-portal's Image Upload directory must be writable (".$pathtoroot."kernel/images/)."; //die(); } if(!is_writable($pathtoroot."admin/backupdata/")) { if ($general_error != '') { $general_error .= '<br /><br />'; } $general_error .= "In-portal's Backup directory must be writable (".$pathtoroot."admin/backupdata/)."; //die(); } if(!is_writable($pathtoroot."admin/export/")) { if ($general_error != '') { $general_error .= '<br /><br />'; } $general_error .= "In-portal's Exportd directory must be writable (".$pathtoroot."admin/export/)."; //die(); } if($installed) { $state="reinstall"; } else { $state="dbinfo"; } } if($state=="reinstall_process") { $lic = base64_decode($g_License); if(strlen($lic)) { inst_ParseLicense($lic); $ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0)); } $LoggedIn = FALSE; if($_POST["UserName"]=="root") { $ado = inst_GetADODBConnection(); $sql = "SELECT * FROM ".$g_TablePrefix."ConfigurationValues WHERE VariableName='RootPass'"; $rs = $ado->Execute($sql); if($rs && !$rs->EOF) { $RootPass = $rs->fields["VariableValue"]; if(strlen($RootPass)>0) $LoggedIn = ($RootPass==md5($_POST["UserPass"])); } } else { $act = ''; if (ConvertVersion($g_InPortal) >= ConvertVersion("1.0.5")) { $act = 'check'; } - $rfile = @fopen(GET_LICENSE_URL."?login=".md5($_POST['UserName'])."&password=".md5($_POST['UserPass'])."&action=$act&license_code=".base64_encode($g_LicenseCode)."&version=".ConvertVersion(GetMaxPortalVersion($pathtoroot.$admin))."&domain=".base64_encode($_SERVER['SERVER_NAME']), "r"); + $rfile = @fopen(GET_LICENSE_URL."?login=".md5($_POST['UserName'])."&password=".md5($_POST['UserPass'])."&action=$act&license_code=".base64_encode($g_LicenseCode)."&version=".GetMaxPortalVersion($pathtoroot.$admin)."&domain=".base64_encode($_SERVER['SERVER_NAME']), "r"); if (!$rfile) { $login_err_mesg = "Unable to connect to the Intechnic server!"; $LoggedIn = false; } else { $rcontents = ''; while (!feof($rfile)) { $line = fgets($rfile, 10000); $rcontents .= $line; } @fclose($rfile); if (substr($rcontents, 0, 5) == 'Error') { $login_err_mesg = substr($rcontents, 6); $LoggedIn = false; } else { $LoggedIn = true; } } //$LoggedIn = ($i_User == $_POST["UserName"] && ($i_Pswd == $_POST["UserPass"]) && strlen($i_User)>0) || strlen($i_User)==0; } if($LoggedIn) { if (!(int)$_POST["inp_opt"]) { $state="reinstall"; $inst_error = "Please select one of the options above!"; } else { switch((int)$_POST["inp_opt"]) { case 0: $inst_error = "Please select an option above"; break; case 1: /* clean out all tables */ $install_type = 4; $ado = inst_GetADODBConnection(); $filename = $pathtoroot.$admin."/install/inportal_remove.sql"; RunSchemaFile($ado,$filename); /* run install again */ $state="license"; break; case 2: $install_type = 3; $state="dbinfo"; break; case 3: $install_type = 5; $state="license"; break; case 4: $install_type = 6; /* clean out all tables */ $ado = inst_GetADODBConnection(); //$filename = $pathtoroot.$admin."/install/inportal_remove.sql"; //RunSchemaFile($ado,$filename); /* run install again */ $state="restore_select"; break; case 5: $install_type = 7; /* change DB config */ $state="db_reconfig"; break; case 6: $install_type = 8; $state = "upgrade"; break; } } } else { $state="reinstall"; $login_error = $login_err_mesg;//"Invalid Username or Password - Try Again"; } } if ($state == "upgrade") { $ado = inst_GetADODBConnection(); $Modules = array(); $Texts = array(); if (str_replace('.', '', GetMaxPortalVersion($pathtoroot.$admin)) >= 105 && $g_LicenseCode == '') { $state = 'reinstall'; $inst_error = "Your license must be updated before you can upgrade. Please don't use 'Existing License' option, instead either Download from Intechnic or Upload a new license file!"; } else { $sql = "SELECT Name, Version FROM ".$g_TablePrefix."Modules"; $rs = $ado->Execute($sql); $i = 0; while ($rs && !$rs->EOF) { $p = strtolower($rs->fields['Name']); if ($p == 'in-portal') { $p = ''; } $dir_name = $pathtoroot.$p."/admin/install/upgrades/"; $dir = @dir($dir_name); while ($file = $dir->read()) { if ($file != "." && $file != ".." && !is_dir($dir_name.$file)) { if (strstr($file, 'inportal_upgrade_v')) { $file = str_replace("inportal_upgrade_v", "", $file); $file = str_replace(".sql", "", $file); $sql = "SELECT count(*) AS count FROM ".$g_TablePrefix."Modules WHERE Name = '".$rs->fields['Name']."' AND Version = '$file'"; $rs1 = $ado->Execute($sql); if ($rs1->fields['count'] == 0 && ConvertVersion($file) > ConvertVersion($rs->fields['Version'])) { if ($Modules[$i-1] == $rs->fields['Name']) { $Texts[$i-1] = $rs->fields['Name']." (".$rs->fields['Version']." ".prompt_language("la_to")." ".$file.")"; $i--; } else { $Texts[$i] = $rs->fields['Name']." (".$rs->fields['Version']." ".prompt_language("la_to")." ".$file.")"; $Modules[$i] = $rs->fields['Name']; } $i++; } } } } $rs->MoveNext(); } $include_file = $pathtoroot.$admin."/install/upgrade.php"; } } if ($state == "upgrade_process") { $ado = inst_GetADODBConnection(); $mod_arr = $_POST['modules']; foreach($mod_arr as $p) { $mod_name = strtolower($p); $sql = "SELECT Version FROM ".$g_TablePrefix."Modules WHERE Name = '$p'"; $rs = $ado->Execute($sql); $current_version = $rs->fields['Version']; if ($mod_name == 'in-portal') { $mod_name = ''; } $dir_name = $pathtoroot.$mod_name."/admin/install/upgrades/"; $dir = @dir($dir_name); $new_version = ''; $tmp1 = 0; $tmp2 = 0; while ($file = $dir->read()) { if ($file != "." && $file != ".." && !is_dir($dir_name.$file)) { if (strstr($file, 'inportal_upgrade_v')) { $file_tmp = str_replace("inportal_upgrade_v", "", $file); $file_tmp = str_replace(".sql", "", $file); if (ConvertVersion($file_tmp) > ConvertVersion($current_version)) { $filename = $pathtoroot.$mod_name."/admin/install/upgrades/$file"; //echo "Trying Version: $try_version<br>"; if(file_exists($filename)) { RunSQLFile($ado, $filename); set_ini_value("Module Versions", $p, $try_version); save_values(); } /* $tmp1 = str_replace(".", "", $file); if ($tmp1 > $tmp2) { $new_version = $file; }*/ } } //$tmp2 = $tmp1; } } } $state = 'languagepack_upgrade'; } // upgrade language pack if($state=='languagepack_upgrade') { $state = 'lang_install_init'; $_POST['lang'][] = 'english.lang'; $force_finish = true; } if($state=="db_reconfig_save") { $ini_vars = inst_parse_portal_ini($ini_file,TRUE); foreach($ini_vars as $secname => $section) { foreach($section as $key => $value) { $key = "g_".str_replace("-", "", $key); global $$key; $$key = $value; } } unset($ado); $ado = VerifyDB('db_reconfig', 'finish', 'SaveDBConfig', true); } if($state=="db_reconfig") { $include_file = $pathtoroot.$admin."/install/db_reconfig.php"; } if($state=="restore_file") { if($_POST["submit"]=="Update") { $filepath = $_POST["backupdir"]; $state="restore_select"; } else { $filepath = stripslashes($_POST['backupdir']); $backupfile = $filepath.$path_char.str_replace('(.*)', $_POST['backupdate'], BACKUP_NAME); if(file_exists($backupfile) && is_readable($backupfile)) { $ado = inst_GetADODBConnection(); $show_warning = false; if (!$_POST['warning_ok']) { // Here we comapre versions between backup and config $file_contents = file_get_contents($backupfile); $file_tmp_cont = explode("#------------------------------------------", $file_contents); $tmp_vers = $file_tmp_cont[0]; $vers_arr = explode(";", $tmp_vers); $ini_values = inst_parse_portal_ini($ini_file); foreach ($ini_values as $key => $value) { foreach ($vers_arr as $k) { if (strstr($k, $key)) { if (!strstr($k, $value)) { $show_warning = true; } } } } //$show_warning = true; } if (!$show_warning) { $filename = $pathtoroot.$admin.$path_char.'install'.$path_char.'inportal_remove.sql'; RunSchemaFile($ado,$filename); $state="restore_run"; } else { $state = "warning"; $include_file = $pathtoroot.$admin."/install/warning.php"; } } else { if ($_POST['backupdate'] != '') { $include_file = $pathtoroot.$admin."/install/restore_select.php"; $restore_error = "$backupfile not found or could not be read"; } else { $include_file = $pathtoroot.$admin."/install/restore_select.php"; $restore_error = "No backup selected!!!"; } } } //echo $restore_error; } if($state=="restore_select") { if( isset($_POST['backupdir']) ) $filepath = stripslashes($_POST['backupdir']); $include_file = $pathtoroot.$admin."/install/restore_select.php"; } if($state=="restore_run") { $ado = inst_GetADODBConnection(); $FileOffset = (int)$_GET["Offset"]; if(!strlen($backupfile)) $backupfile = SuperStrip($_GET['File'], true); $include_file = $pathtoroot.$admin."/install/restore_run.php"; } if($state=="db_config_save") { set_ini_value("Database", "DBType",$_POST["ServerType"]); set_ini_value("Database", "DBHost",$_POST["ServerHost"]); set_ini_value("Database", "DBName",$_POST["ServerDB"]); set_ini_value("Database", "DBUser",$_POST["ServerUser"]); set_ini_value("Database", "DBUserPassword",$_POST["ServerPass"]); set_ini_value("Database","TablePrefix",$_POST["TablePrefix"]); save_values(); $ini_vars = inst_parse_portal_ini($ini_file,TRUE); foreach($ini_vars as $secname => $section) { foreach($section as $key => $value) { $key = "g_".str_replace("-", "", $key); global $$key; $$key = $value; } } unset($ado); $ado = VerifyDB('dbinfo', 'license'); } if($state=="dbinfo") { if ($install_type == '') { $install_type = 1; } $include_file = $pathtoroot.$admin."/install/dbinfo.php"; } if ($state == "download_license") { $ValidLicense = FALSE; if ($_POST['login'] != '' && $_POST['password'] != '') { // Here we determine weather login is ok & check available licenses - $rfile = @fopen(GET_LICENSE_URL."?login=".md5($_POST['login'])."&password=".md5($_POST['password'])."&version=".ConvertVersion(GetMaxPortalVersion($pathtoroot.$admin))."&domain=".base64_encode($_SERVER['SERVER_NAME']), "r"); + $rfile = @fopen(GET_LICENSE_URL."?login=".md5($_POST['login'])."&password=".md5($_POST['password'])."&version=".GetMaxPortalVersion($pathtoroot.$admin)."&domain=".base64_encode($_SERVER['SERVER_NAME']), "r"); if (!$rfile) { $get_license_error = "Unable to connect to the Intechnic server! Please try again later!"; $state = "get_license"; $include_file = $pathtoroot.$admin."/install/get_license.php"; } else { $rcontents = ''; while (!feof($rfile)) { $line = fgets($rfile, 10000); $rcontents .= $line; } @fclose($rfile); if (substr($rcontents, 0, 5) == 'Error') { $get_license_error = substr($rcontents, 6); $state = "get_license"; $include_file = $pathtoroot.$admin."/install/get_license.php"; } else { if (substr($rcontents, 0, 3) == "SEL") { $state = "download_license"; $license_select = substr($rcontents, 4); $include_file = $pathtoroot.$admin."/install/download_license.php"; } else { // Here we get one license $tmp_data = explode('Code==:', $rcontents); $data = base64_decode(str_replace("In-Portal License File - do not edit!\n", "", $tmp_data[0])); inst_ParseLicense($data); $ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0)); if($ValidLicense) { set_ini_value("Intechnic","License",base64_encode($data)); set_ini_value("Intechnic","LicenseCode",$tmp_data[1]); save_values(); $state="domain_select"; $got_license = 1; } else { $license_error="Invalid License File"; } if(!$ValidLicense) { $state="license"; } } } } } else if ($_POST['licenses'] == '') { $state = "get_license"; $get_license_error = "Username and / or password not specified!!!"; $include_file = $pathtoroot.$admin."/install/get_license.php"; } else { // Here we download license - $rfile = @fopen(GET_LICENSE_URL."?license_id=".md5($_POST['licenses'])."&dlog=".md5($_POST['dlog'])."&dpass=".md5($_POST['dpass'])."&version=".ConvertVersion(GetMaxPortalVersion($pathtoroot.$admin))."&domain=".base64_encode($_POST['domain']), "r"); + $rfile = @fopen(GET_LICENSE_URL."?license_id=".md5($_POST['licenses'])."&dlog=".md5($_POST['dlog'])."&dpass=".md5($_POST['dpass'])."&version=".GetMaxPortalVersion($pathtoroot.$admin)."&domain=".base64_encode($_POST['domain']), "r"); if (!$rfile) { $get_license_error = "Unable to connect to the Intechnic server! Please try again later!"; $state = "get_license"; $include_file = $pathtoroot.$admin."/install/get_license.php"; } else { $rcontents = ''; while (!feof($rfile)) { $line = fgets($rfile, 10000); $rcontents .= $line; } @fclose($rfile); if (substr($rcontents, 0, 5) == 'Error') { $download_license_error = substr($rcontents, 6); $state = "download_license"; $include_file = $pathtoroot.$admin."/install/download_license.php"; } else { $tmp_data = explode('Code==:', $rcontents); $data = base64_decode(str_replace("In-Portal License File - do not edit!\n", "", $tmp_data[0])); inst_ParseLicense($data); $ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0)); if($ValidLicense) { set_ini_value("Intechnic","License",base64_encode($data)); set_ini_value("Intechnic","LicenseCode",$tmp_data[1]); save_values(); $state="domain_select"; } else { $license_error="Invalid License File"; } if(!$ValidLicense) { $state="license"; } } } } } if($state=="license_process") { $ValidLicense = FALSE; switch($_POST["lic_opt"]) { case 1: /* download from intechnic */ $include_file = $pathtoroot.$admin."/install/get_license.php"; $state = "get_license"; //if(!$ValidLicense) //{ // $state="license"; //} break; case 2: /* upload file */ $file = $_FILES["licfile"]; if(is_array($file)) { move_uploaded_file($file["tmp_name"],$pathtoroot."themes/tmp.lic"); $fp = @fopen($pathtoroot."themes/tmp.lic","rb"); if($fp) { $lic = fread($fp,filesize($pathtoroot."themes/tmp.lic")); fclose($fp); } $tmp_data = inst_LoadLicense(FALSE,$pathtoroot."themes/tmp.lic"); $data = $tmp_data[0]; @unlink($pathtoroot."themes/tmp.lic"); inst_ParseLicense($data); $ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0)); if($ValidLicense) { set_ini_value("Intechnic","License",base64_encode($data)); set_ini_value("Intechnic","LicenseCode",$tmp_data[1]); save_values(); $state="domain_select"; } else $license_error="Invalid License File"; } if(!$ValidLicense) { $state="license"; } break; case 3: /* existing */ if(strlen($g_License)) { $lic = base64_decode($g_License); inst_ParseLicense($lic); $ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0)); if($ValidLicense) { $state="domain_select"; } else { $state="license"; $license_error="Invalid or corrupt license detected"; } } else { $state="license"; $license_error="Missing License File"; } if(!$ValidLicense) { $state="license"; } break; case 4: $state="domain_select"; break; } if($ValidLicense) $state="domain_select"; } if($state=="license") { $include_file = $pathtoroot.$admin."/install/sel_license.php"; } if($state=="reinstall") { $ado = inst_GetADODBConnection(); $show_upgrade = false; $sql = "SELECT Name FROM ".$g_TablePrefix."Modules"; $rs = $ado->Execute($sql); $modules = ''; while ($rs && !$rs->EOF) { $modules .= strtolower($rs->fields['Name']).','; $rs->MoveNext(); } $mod_arr = explode(",", substr($modules, 0, strlen($modules) - 1)); foreach($mod_arr as $p) { if ($p == 'in-portal') { $p = ''; } $dir_name = $pathtoroot.$p."/admin/install/upgrades/"; $dir = @dir($dir_name); //echo "<pre>"; print_r($dir); echo "</pre>"; while ($file = $dir->read()) { if ($file != "." && $file != ".." && !is_dir($dir_name.$file)) { if (strstr($file, 'inportal_upgrade_v')) { $file = str_replace("inportal_upgrade_v", "", $file); $file = str_replace(".sql", "", $file); if ($p == '') { $p = 'in-portal'; } $sql = "SELECT Version FROM ".$g_TablePrefix."Modules WHERE Name = '".$p."'"; $rs = $ado->Execute($sql); if (ConvertVersion($rs->fields['Version']) < ConvertVersion($file)) { $show_upgrade = true; } } } } } if ($install_type == '') { $install_type = 2; } $include_file = $pathtoroot.$admin."/install/reinstall.php"; } if($state=="login") { $lic = base64_decode($g_License); if(strlen($lic)) { inst_ParseLicense($lic); $ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0)); } if(!$ValidLicense) { $state="license"; } else if($i_User == $_POST["UserName"] || $i_Pswd == $_POST["UserPass"]) { $state = "domain_select"; } else { $state="getuser"; $login_error = "Invalid User Name or Password. If you don't know your username or password, contact Intechnic Support"; } //die(); } if($state=="getuser") { $include_file = $pathtoroot.$admin."/install/login.php"; } if($state=="set_domain") { if(!is_array($i_Keys)) { $lic = base64_decode($g_License); if(strlen($lic)) { inst_ParseLicense($lic); $ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0)); } } if($_POST["domain"]==1) { $domain = $_SERVER['HTTP_HOST']; if (strstr($domain, $i_Keys[0]['domain']) || inst_IsLocalSite($domain)) { set_ini_value("Intechnic","Domain",$domain); save_values(); $state="runsql"; } else { $DomainError = 'Domain name selected does not match domain name in the license!'; $state = "domain_select"; } } else { $domain = str_replace(" ", "", $_POST["other"]); if ($domain != '') { if (strstr($domain, $i_Keys[0]['domain']) || inst_IsLocalSite($domain)) { set_ini_value("Intechnic","Domain",$domain); save_values(); $state="runsql"; } else { $DomainError = 'Domain name entered does not match domain name in the license!'; $state = "domain_select"; } } else { $DomainError = 'Please enter valid domain!'; $state = "domain_select"; } } } if($state=="domain_select") { if(!is_array($i_Keys)) { $lic = base64_decode($g_License); if(strlen($lic)) { inst_ParseLicense($lic); $ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0)); } } $include_file = $pathtoroot.$admin."/install/domain.php"; } if($state=="runsql") { $ado = inst_GetADODBConnection(); $installed = TableExists($ado,"ConfigurationAdmin,Category,Permissions"); if(!$installed) { // create tables $filename = $pathtoroot.$admin."/install/inportal_schema.sql"; RunSchemaFile($ado,$filename); // insert default info $filename = $pathtoroot.$admin."/install/inportal_data.sql"; RunSQLFile($ado,$filename); $sql = "SELECT Version FROM ".$g_TablePrefix."Modules WHERE Name = 'In-Portal'"; $rs = $ado->Execute($sql); set_ini_value("Module Versions", "In-Portal", $rs->fields['Version']); save_values(); require_once $pathtoroot.'kernel/include/tag-class.php'; if( !is_object($objTagList) ) $objTagList = new clsTagList(); // install kernel specific tags $objTagList->DeleteTags(); // delete all existing tags in db // create 3 predifined tags (because there no functions with such names $t = new clsTagFunction(); $t->Set("name","include"); $t->Set("description","insert template output into the current template"); $t->Create(); $t->AddAttribute("_template","tpl","Template to insert","",TRUE); $t->AddAttribute("_supresserror","bool","Supress missing template errors","",FALSE); $t->AddAttribute("_dataexists","bool","Only include template output if content exists (content is defined by the tags in the template)","",FALSE); $t->AddAttribute("_nodatatemplate","tpl","Template to include if the nodataexists condition is true","",FALSE); unset($t); $t = new clsTagFunction(); $t->Set("name","perm_include"); $t->Set("description","insert template output into the current template if permissions are set"); $t->Create(); $t->AddAttribute("_template","tpl","Template to insert","",TRUE); $t->AddAttribute("_noaccess","tpl","Template to insert if access is denied","",FALSE); $t->AddAttribute("_permission","","Comma-separated list of permissions, any of which will grant access","",FALSE); $t->AddAttribute("_module","","Used in place of the _permission attribute, this attribute verifies the module listed is enabled","",FALSE); $t->AddAttribute("_system","bool","Must be set to true if any permissions in _permission list is a system permission","",FALSE); $t->AddAttribute("_supresserror","bool","Supress missing template errors","",FALSE); $t->AddAttribute("_dataexists","bool","Only include template output if content exists (content is defined by the tags in the template)","",FALSE); $t->AddAttribute("_nodatatemplate","tpl","Template to include if the nodataexists condition is true","",FALSE); unset($t); $t = new clsTagFunction(); $t->Set("name","mod_include"); $t->Set("description","insert templates from all enabled modules. No error occurs if the template does not exist."); $t->Create(); $t->AddAttribute("_template","tpl","Template to insert. This template path should be relative to the module template root directory","",TRUE); $t->AddAttribute("_modules","","Comma-separated list of modules. Defaults to all enabled modules if not set","",FALSE); $t->AddAttribute("_supresserror","bool","Supress missing template errors","",FALSE); $t->AddAttribute("_dataexists","bool","Only include template output if content exists (content is defined by the tags in the template)","",FALSE); $t->AddAttribute("_nodatatemplate","tpl","Template to include if the nodataexists condition is true","",FALSE); $objTagList->ParseFile($pathtoroot.'kernel/parser.php'); // insert module tags if( is_array($ItemTagFiles) ) foreach($ItemTagFiles as $file) $objTagList->ParseItemFile($pathtoroot.$file); $state="RootPass"; } else { $include_file = $pathtoroot.$admin."/install/install_finish.php"; $state="finish"; } } if ($state == "finish") { $include_file = $pathtoroot.$admin."/install/install_finish.php"; } if($state=="RootSetPass") { $pass = $_POST["RootPass"]; if(strlen($pass)<4) { $PassError = "Root Password must be at least 4 characters"; $state = "RootPass"; } else if ($pass != $_POST["RootPassConfirm"]) { $PassError = "Passwords does not match"; $state = "RootPass"; } else { $pass = md5($pass); $sql = "UPDATE ".$g_TablePrefix."ConfigurationValues SET VariableValue = '$pass' WHERE VariableName='RootPass' OR VariableName='RootPassVerify'"; $ado = inst_GetADODBConnection(); $ado->Execute($sql); $state="modselect"; } } if($state=="RootPass") { $include_file = $pathtoroot.$admin."/install/rootpass.php"; } if($state=="lang_install_init") { include_once($pathtoroot."kernel/include/xml.php"); $ado = inst_GetADODBConnection(); if (TableExists($ado, "Language,Phrase")) { $MaxInserts = 200; $PhraseTable = GetTablePrefix()."ImportPhrases"; $EventTable = GetTablePrefix()."ImportEvents"; $sql = "CREATE TABLE $PhraseTable SELECT Phrase,Translation,PhraseType,LanguageId FROM ".GetTablePrefix()."Phrase WHERE PhraseId=-1"; $ado->Execute($sql); $sql = "CREATE TABLE $EventTable SELECT Template,MessageType,EventId,LanguageId FROM ".GetTablePrefix()."EmailMessage WHERE EmailMessageId=-1"; $ado->Execute($sql); $sql = "SELECT EventId,Event,Type FROM ".GetTablePrefix()."Events"; $rs = $ado->Execute($sql); $Events = array(); while($rs && !$rs->EOF) { $Events[$rs->fields["Event"]."_".$rs->fields["Type"]] = $rs->fields["EventId"]; $rs->MoveNext(); } if(count($_POST["lang"])>0) { $Langs = $_POST["lang"]; for($x=0;$x<count($Langs);$x++) { $lang = $Langs[$x]; $p = $pathtoroot.$admin."/install/langpacks/".$lang; /* parse xml file */ $fp = fopen($p,"r"); $xml = fread($fp,filesize($p)); fclose($fp); unset($objInXML); $objInXML = new xml_doc($xml); $objInXML->parse(); $objInXML->getTag(0,$name,$attribs,$contents,$tags); if(is_array($tags)) { foreach($tags as $t) { $LangRoot =& $objInXML->getTagByID($t); $PackName = $LangRoot->attributes["PACKNAME"]; $l = $objLanguages->GetItemByField("PackName",$PackName); if(is_object($l)) { $LangId = $l->Get("LanguageId"); } else { $l = new clsLanguage(); $l->Set("Enabled",1); $l->Create(); $NewLang = TRUE; $LangId = $l->Get("LanguageId"); } foreach($LangRoot->children as $tag) { switch($tag->name) { case "PHRASES": foreach($tag->children as $PhraseTag) { $Phrase = $ado->qstr($PhraseTag->attributes["LABEL"]); $Translation = $ado->qstr(base64_decode($PhraseTag->contents)); $PhraseType = $PhraseTag->attributes["TYPE"]; $psql = "INSERT INTO $PhraseTable (Phrase,Translation,PhraseType,LanguageId) VALUES ($Phrase,$Translation,$PhraseType,$LangId)"; $ado->Execute($psql); //echo "$psql <br>\n"; } break; case "DATEFORMAT": $DateFormat = $tag->contents; break; case "TIMEFORMAT": $TimeFormat = $tag->contents; break; case "DECIMAL": $Decimal = $tag->contents; break; case "THOUSANDS": $Thousands = $tag->contents; break; case "EVENTS": foreach($tag->children as $EventTag) { $event = $EventTag->attributes["EVENT"]; $MsgType = strtolower($EventTag->attributes["MESSAGETYPE"]); $template = base64_decode($EventTag->contents); $Type = $EventTag->attributes["TYPE"]; $EventId = $Events[$event."_".$Type]; $esql = "INSERT INTO $EventTable (Template,MessageType,EventId,LanguageId) VALUES ('$template','$MsgType',$EventId,$LangId)"; $ado->Execute($esql); //echo htmlentities($esql)."<br>\n"; } break; } if($NewLang) { $l->Set("PackName",$PackName); $l->Set("LocalName",$PackName); $l->Set("DateFormat",$DateFormat); $l->Set("TimeFormat",$TimeFormat); $l->Set("DecimalPoint",$Decimal); $l->Set("ThousandSep",$Thousands); $l->Update(); } } } } } $state="lang_install"; } else { $state="lang_select"; } } else { $general_error = 'Database error! No language tables found!'; } } if($state=="lang_install") { /* do pack install */ $Offset = (int)$_GET["Offset"]; $Status = (int)$_GET["Status"]; $PhraseTable = GetTablePrefix()."ImportPhrases"; $EventTable = GetTablePrefix()."ImportEvents"; if($Status==0) { $Total = TableCount($PhraseTable,"",0); } else { $Total = TableCount($EventTable,"",0); } if($Status==0) { $Offset = $objLanguages->ReadImportTable($PhraseTable, 1,"0,1,2", $force_finish ? false : true, 200,$Offset); if($Offset>=$Total) { $Offset=0; $Status=1; } if ($_POST['next_step']) { $next_step = $_POST['next_step']; } else if ($_GET['next_step']) { $next_step = $_GET['next_step']; } if($force_finish == true) $next_step = 3; $NextUrl = $_SERVER['PHP_SELF']."?Offset=$Offset&Status=$Status&state=lang_install&next_step=$next_step&install_type=$install_type"; if($force_finish == true) $NextUrl .= '&ff=1'; $include_file = $pathtoroot.$admin."/install/lang_run.php"; } else { if(!is_object($objMessageList)) $objMessageList = new clsEmailMessageList(); $Offset = $objMessageList->ReadImportTable($EventTable, $force_finish ? false : true,100,$Offset); if($Offset>$Total) { if ($_POST['next_step']) { $next_step = $_POST['next_step']; } else if ($_GET['next_step']) { $next_step = $_GET['next_step']; } if($force_finish == true) $next_step = 3; $NextUrl = $_SERVER['PHP_SELF']."?Offset=$Offset&Status=$Status&State=lang_install&next_step=$next_step&install_type=$install_type"; if($force_finish == true) $NextUrl .= '&ff=1'; $include_file = $pathtoroot.$admin."/install/lang_run.php"; } else { if( !$force_finish ) { $state = 'lang_default'; } else { $_POST['next_step'] = 4; $state = 'finish'; $include_file = $pathtoroot.$admin."/install/install_finish.php"; } } } } if($state=="lang_default_set") { // phpinfo(INFO_VARIABLES); $ado = inst_GetADODBConnection(); $PhraseTable = GetTablePrefix()."ImportPhrases"; $EventTable = GetTablePrefix()."ImportEvents"; $ado->Execute("DROP TABLE IF EXISTS $PhraseTable"); $ado->Execute("DROP TABLE IF EXISTS $EventTable"); $Id = $_POST["lang"]; $objLanguages->SetPrimary($Id); $state="postconfig_1"; } if($state=="lang_default") { $Packs = Array(); $objLanguages->Clear(); $objLanguages->LoadAllLanguages(); foreach($objLanguages->Items as $l) { $Packs[$l->Get("LanguageId")] = $l->Get("PackName"); } $include_file = $pathtoroot.$admin."/install/lang_default.php"; } if($state=="modinstall") { $doms = $_POST["domain"]; if(is_array($doms)) { $ado = inst_GetADODBConnection(); require_once $pathtoroot.'kernel/include/tag-class.php'; if( !is_object($objTagList) ) $objTagList = new clsTagList(); foreach($doms as $p) { $filename = $pathtoroot.$p."/admin/install.php"; if(file_exists($filename)) { include($filename); } } } /* $sql = "SELECT Name FROM ".GetTablePrefix()."Modules"; $rs = $ado->Execute($sql); while($rs && !$rs->EOF) { $p = $rs->fields['Name']; $mod_name = strtolower($p); if ($mod_name == 'in-portal') { $mod_name = ''; } $dir_name = $pathtoroot.$mod_name."/admin/install/upgrades/"; $dir = @dir($dir_name); $new_version = ''; $tmp1 = 0; $tmp2 = 0; while ($file = $dir->read()) { if ($file != "." && $file != ".." && !is_dir($dir_name.$file)) { $file = str_replace("inportal_upgrade_v", "", $file); $file = str_replace(".sql", "", $file); if ($file != '' && !strstr($file, 'changelog') && !strstr($file, 'readme')) { $tmp1 = str_replace(".", "", $file); if ($tmp1 > $tmp2) { $new_version = $file; } } } $tmp2 = $tmp1; } $version_nrs = explode(".", $new_version); for ($i = 0; $i < $version_nrs[0] + 1; $i++) { for ($j = 0; $j < $version_nrs[1] + 1; $j++) { for ($k = 0; $k < $version_nrs[2] + 1; $k++) { $try_version = "$i.$j.$k"; $filename = $pathtoroot.$mod_name."/admin/install/upgrades/inportal_upgrade_v$try_version.sql"; if(file_exists($filename)) { RunSQLFile($ado, $filename); set_ini_value("Module Versions", $p, $try_version); save_values(); } } } } $rs->MoveNext(); } */ $state="lang_select"; } if($state=="lang_select") { $Packs = GetLanguageList(); $include_file = $pathtoroot.$admin."/install/lang_select.php"; } if($state=="modselect") { /* /admin/install.php */ $UrlLen = (strlen($admin) + 12)*-1; $pathguess =substr($_SERVER["SCRIPT_NAME"],0,$UrlLen); $sitepath = $pathguess; $esc_path = str_replace("\\","/",$pathtoroot); $esc_path = str_replace("/","\\",$esc_path); //set_ini_value("Site","DomainName",$_SERVER["SERVER_NAME"]); //$g_DomainName= $_SERVER["SERVER_NAME"]; save_values(); $ado = inst_GetADODBConnection(); if(substr($sitepath,0,1)!="/") $sitepath="/".$sitepath; if(substr($sitepath,-1)!="/") $sitepath .= "/"; $sql = "UPDATE ".$g_TablePrefix."ConfigurationValues SET VariableValue = '$sitepath' WHERE VariableName='Site_Path'"; $ado->Execute($sql); $sql = "UPDATE ".$g_TablePrefix."ConfigurationValues SET VariableValue = '$g_Domain' WHERE VariableName='Server_Name'"; $ado->Execute($sql); $sql = "UPDATE ".$g_TablePrefix."ConfigurationValues SET VariableValue = '".$_SERVER['DOCUMENT_ROOT'].$sitepath."admin/backupdata' WHERE VariableName='Backup_Path'"; $ado->Execute($sql); $Modules = inst_GetModuleList(); $include_file = $pathtoroot.$admin."/install/modselect.php"; } if(substr($state,0,10)=="postconfig") { $p = explode("_",$state); $step = $p[1]; if ($_POST['Site_Path'] != '') { $sql = "SELECT Name, Version FROM ".$g_TablePrefix."Modules"; $rs = $ado->Execute($sql); $modules_str = ''; while ($rs && !$rs->EOF) { $modules_str .= $rs->fields['Name'].' ('.$rs->fields['Version'].'),'; $rs->MoveNext(); } $modules_str = substr($modules_str, 0, strlen($modules_str) - 1); - $rfile = @fopen(GET_LICENSE_URL."?url=".base64_encode($_SERVER['SERVER_NAME'].$_POST['Site_Path'])."&modules=".base64_encode($modules_str)."&license_code=".base64_encode($g_LicenseCode)."&version=".str_replace('.', '', GetMaxPortalVersion($pathtoroot.$admin))."&domain=".md5($_SERVER['SERVER_NAME']), "r"); + $rfile = @fopen(GET_LICENSE_URL."?url=".base64_encode($_SERVER['SERVER_NAME'].$_POST['Site_Path'])."&modules=".base64_encode($modules_str)."&license_code=".base64_encode($g_LicenseCode)."&version=".GetMaxPortalVersion($pathtoroot.$admin)."&domain=".md5($_SERVER['SERVER_NAME']), "r"); if (!$rfile) { //$get_license_error = "Unable to connect to the Intechnic server! Please try again later!"; //$state = "postconfig_1"; //$include_file = $pathtoroot.$admin."/install/postconfig.php"; } else { $rcontents = ''; while (!feof($rfile)) { $line = fgets($rfile, 10000); $rcontents .= $line; } @fclose($rfile); } } if(strlen($_POST["oldstate"])>0) { $s = explode("_",$_POST["oldstate"]); $oldstep = $s[1]; if($oldstep<count($configs)) { $section = $configs[$oldstep]; $module = $mods[$oldstep]; $title = $titles[$oldstep]; $objAdmin = new clsConfigAdmin($module,$section,TRUE); $objAdmin->SaveItems($_POST,TRUE); } } $section = $configs[$step]; $module = $mods[$step]; $title = $titles[$step]; $step++; if($step <= count($configs)+1) { $include_file = $pathtoroot.$admin."/install/postconfig.php"; } else $state = "theme_sel"; } if($state=="theme_sel") { $objThemes->CreateMissingThemes(); $include_file = $pathtoroot.$admin."/install/theme_select.php"; } if($state=="theme_set") { ## get & define Non-Blocking & Blocking versions ## $blocking_sockets = minimum_php_version("4.3.0")? 0 : 1; $ado = inst_GetADODBConnection(); $sql = "UPDATE ".$g_TablePrefix."ConfigurationValues SET VariableValue = '$blocking_sockets' WHERE VariableName='SocketBlockingMode'"; $ado->Execute($sql); ## get & define Non-Blocking & Blocking versions ## $theme_id = $_POST["theme"]; $pathchar="/"; //$objThemes->SetPrimaryTheme($theme_id); $t = $objThemes->GetItem($theme_id); $t->Set("Enabled",1); $t->Set("PrimaryTheme",1); $t->Update(); $t->VerifyTemplates(); $include_file = $pathtoroot.$admin."/install/install_finish.php"; $state="finish"; } if ($state == "adm_login") { echo "<script>window.location='index.php';</script>"; } switch($state) { case "modselect": $title = "Select Modules"; $help = "<p>Select the In-Portal modules you wish to install. The modules listed to the right "; $help .="are all modules included in this installation that are licensed to run on this server. </p>"; break; case "reinstall": $title = "Installation Maintenance"; $help = "<p>A Configuration file has been detected on your system and it appears In-Portal is correctly installed. "; $help .="In order to work with the maintenance functions provided to the left you must provide the Intechnic "; $help .="Username and Password you used when obtaining the license file residing on the server, or your admin Root password. "; $help .=" <i>(Use Username 'root' if using your root password)</i></p>"; $help .= "<p>To removing your existing database and start with a fresh installation, select the first option "; $help .= "provided. Note that this operation cannot be undone and no backups are made! Use at your own risk.</p>"; $help .="<p>If you wish to scrap your current installation and install to a new location, choose the second option. "; $help .="If this option is selected you will be prompted for new database configuration information.</p>"; $help .="<p>The <i>Update License Information</i> option is used to update your In-Portal license data. Select this option if you have "; $help .="modified your licensing status with Intechnic, or you have received new license data via email</p>"; break; case "RootPass": $title = "Set Admin Root Password"; $help = "<p>The Root Password is initially required to access the admin sections of In-Portal. "; $help .="The root user cannot be used to access the front-end of the system, so it is recommended that you "; $help .="create additional users with admin privlidges.</p>"; break; case "finish": $title = "Thank You!"; $help ="<P>Thanks for using In-Portal! Be sure to visit <A TARGET=\"_new\" HREF=\"http://www.in-portal.net\">www.in-portal.net</A> "; $help.=" for the latest news, module releases and support. </p>"; break; case "license": $title = "License Configuration"; $help ="<p>A License is required to run In-Portal on a server connected to the Internet. You "; $help.="can run In-Portal on localhost, non-routable IP addresses, or other computers on your LAN. "; $help.="If Intechnic has provided you with a license file, upload it here. Otherwise select the first "; $help.="option to allow Install to download your license for you.</p>"; $help.="<p>If a valid license has been detected on your server, you can choose the <i>Use Existing License</i> "; $help.="and continue the installation process</p>"; break; case "domain_select": $title="Select Licensed Domain"; $help ="<p>Select the domain you wish to configure In-Portal for. The <i>Other</i> option "; $help.=" can be used to configure In-Portal for use on a local domain.</p>"; $help.="<p>For local domains, enter the hostname or LAN IP Address of the machine running In-Portal.</p>"; break; case "db_reconfig": case "dbinfo": $title="Database Configuration"; $help = "<p>In-Portal needs to connect to your Database Server. Please provide the database server type*, "; $help .="host name (<i>normally \"localhost\"</i>), Database user name, and database Password. "; $help .="These fields are required to connect to the database.</p><p>If you would like In-Portal "; $help .="to use a table prefix, enter it in the field provided. This prefix can be any "; $help .=" text which can be used in the names of tables on your system. The characters entered in this field "; $help .=" are placed <i>before</i> the names of the tables used by In-Portal. For example, if you enter \"inp_\""; $help .=" into the prefix field, the table named Category will be named inp_Category.</p>"; break; case "lang_select": $title="Language Pack Installation"; $help = "<p>Select the language packs you wish to install. Each language pack contains all the phrases "; $help .="used by the In-Portal administration and the default template set. Note that at least one "; $help .="pack <b>must</b> be installed.</p>"; break; case "lang_default": $title="Select Default Language"; $help = "<p>Select which language should be considered the \"default\" language. This is the language "; $help .="used by In-Portal when a language has not been selected by the user. This selection is applicable "; $help .="to both the administration and front-end.</p>"; break; case "lang_install": $title="Installing Language Packs"; $help = "<p>The language packs you have selected are being installed. You may install more languages at a "; $help.="later time from the Regional admin section.</p>"; break; case "postconfig_1": $help = "<P>These options define the general operation of In-Portal. Items listed here are "; $help .="required for In-Portal's operation.</p><p>When you have finished, click <i>save</i> to continue.</p>"; break; case "postconfig_2": $help = "<P>User Management configuration options determine how In-Portal manages your user base.</p>"; $help .="<p>The groups listed to the right are pre-defined by the installation process and may be changed "; $help .="through the Groups section of admin.</p>"; break; case "postconfig_3": $help = "<P>The options listed here are used to control the category list display functions of In-Portal. </p>"; break; case "theme_sel": $title="Select Default Theme"; $help = "<P>This theme will be used whenever a front-end session is started. "; $help .="If you intend to upload a new theme and use that as default, you can do so through the "; $help .="admin at a later date. A default theme is required for session management.</p>"; break; case "get_license": $title="Download License from Intechnic"; $help ="<p>A License is required to run In-Portal on a server connected to the Internet. You "; $help.="can run In-Portal on localhost, non-routable IP addresses, or other computers on your LAN.</p>"; $help.="<p>Here as you have selected download license from Intechnic you have to input your username and "; $help.="password of your In-Business account in order to download all your available licenses.</p>"; break; case "download_license": $title="Download License from Intechnic"; $help ="<p>A License is required to run In-Portal on a server connected to the Internet. You "; $help.="can run In-Portal on localhost, non-routable IP addresses, or other computers on your LAN.</p>"; $help.="<p>Please choose the license from the drop down for this site! </p> "; break; case "restore_select": $title="Select Restore File"; $help = "<P>Select the restore file to use to reinstall In-Portal. If your backups are not performed "; $help .= "in the default location, you can enter the location of the backup directory and click the "; $help .="<i>Update</i> button.</p>"; case "restore_run": $title= "Restore in Progress"; $help = "<P>Restoration of your system is in progress. When the restore has completed, the installation "; $help .="will continue as normal. Hitting the <i>Cancel</i> button will restart the entire installation process. "; break; case "warning": $title = "Restore in Progress"; $help = "<p>Please approve that you understand that you are restoring your In-Portal data base from other version of In-Portal.</p>"; break; case "update": $title = "Update In-Portal"; $help = "<p>Select modules from the list, you need to update to the last downloaded version of In-Portal</p>"; break; } if ($_POST['next_step']) { $tmp_step = $_POST['next_step']; } else if ($_GET['next_step']) { $tmp_step = $_GET['next_step']; } if (!$tmp_step) { $tmp_step = 1; } if ($got_license == 1) { $tmp_step++; } $next_step = $tmp_step + 1; if ($general_error != '') { $state = ''; $title = ''; $help = ''; $general_error = $general_error.'<br /><br />Installation cannot continue!'; } if ($include_file == '' && $general_error == '' && $state == '') { $state = ''; $title = ''; $help = ''; $filename = $pathtoroot.$admin."/install/inportal_remove.sql"; RunSQLFile($ado,$filename); $general_error = 'Unexpected installation error! <br /><br />Installation has been stopped!'; } if ($restore_error != '') { $next_step = 3; $tmp_step = 2; } if ($PassError != '') { $tmp_step = 4; $next_step = 5; } if ($DomainError != '') { $tmp_step--; $next_step = $tmp_step + 1; } if ($db_error != '') { $tmp_step--; $next_step = $tmp_step + 1; } if ($state == "warning") { $tmp_step--; $next_step = $tmp_step + 1; } ?> <tr height="100%"> <td valign="top"> <table cellpadding=10 cellspacing=0 border=0 width="100%" height="100%"> <tr valign="top"> <td style="width: 200px; background: #009ff0 url(images/bg_install_menu.gif) no-repeat bottom right; border-right: 1px solid #000"> <img src="images/spacer.gif" width="180" height="1" border="0" alt=""><br> <span class="admintitle-white">Installation</span> <!--<ol class="install"> <li class="current">Licence Verification <li>Configuration <li>File Permissions <li>Security <li>Integrity Check </ol> </td>--> <?php if ($general_error == '') { ?> <?php if ($install_type == 1) { ?> <ol class="install"> <li <?php if ($tmp_step == 1) { ?>class="current"<?php } ?>>Database Configuration <li <?php if ($tmp_step == 2 || $_POST['lic_opt'] == 1) { ?>class="current"<?php } ?>>Select License <li <?php if ($tmp_step == 3 && $_POST['lic_opt'] != 1) { ?>class="current"<?php } ?>>Select Domain <li <?php if ($tmp_step == 4 ) { ?>class="current"<?php } ?>>Set Root Password <li <?php if ($tmp_step == 5) { ?>class="current"<?php } ?>>Select Modules to Install <li <?php if ($tmp_step == 6) { ?>class="current"<?php } ?>>Install Language Packs <li <?php if ($tmp_step == 7) { ?>class="current"<?php } ?>>Post-Install Configuration <li <?php if ($tmp_step == 8) { ?>class="current"<?php } ?>>Finish </ol> <?php } else if ($install_type == 2) { ?> <ol class="install"> <li <?php if ($tmp_step == 1 || $login_error != '' || $inst_error != '') { ?>class="current"<?php } ?>>License Verification <!--<li <?php if (($tmp_step == 2 && $login_error == '' && $inst_error == '') || $_POST['lic_opt'] == 1) { ?>class="current"<?php } ?>>Select License <li <?php if ($tmp_step == 3 && $_POST['lic_opt'] != 1) { ?>class="current"<?php } ?>>Select Domain <li <?php if ($tmp_step == 4) { ?>class="current"<?php } ?>>Set Root Password <li <?php if ($tmp_step == 5) { ?>class="current"<?php } ?>>Select Modules to Install <li <?php if ($tmp_step == 6) { ?>class="current"<?php } ?>>Install Language Packs <li <?php if ($tmp_step == 7) { ?>class="current"<?php } ?>>Post-Install Configuration <li <?php if ($tmp_step == 8) { ?>class="current"<?php } ?>>Finish--> </ol> <?php } else if ($install_type == 3) { ?> <ol class="install"> <li>License Verification <li <?php if ($tmp_step == 2) { ?>class="current"<?php } ?>>Database Configuration <li <?php if ($tmp_step == 3 || $_POST['lic_opt'] == 1) { ?>class="current"<?php } ?>>Select License <li <?php if ($tmp_step == 4 && $_POST['lic_opt'] != 1) { ?>class="current"<?php } ?>>Select Domain <li <?php if ($tmp_step == 5) { ?>class="current"<?php } ?>>Set Root Password <li <?php if ($tmp_step == 6) { ?>class="current"<?php } ?>>Select Modules to Install <li <?php if ($tmp_step == 7) { ?>class="current"<?php } ?>>Install Language Packs <li <?php if ($tmp_step == 8) { ?>class="current"<?php } ?>>Post-Install Configuration <li <?php if ($tmp_step == 9) { ?>class="current"<?php } ?>>Finish </ol> <?php } else if ($install_type == 4) { ?> <ol class="install"> <li <?php if ($tmp_step == 1 || $login_error != '' || $inst_error != '') { ?>class="current"<?php } ?>>License Verification <li <?php if (($tmp_step == 2 && $login_error == '' && $inst_error == '') || $_POST['lic_opt'] == 1) { ?>class="current"<?php } ?>>Select License <li <?php if ($tmp_step == 3 && $_POST['lic_opt'] != 1) { ?>class="current"<?php } ?>>Select Domain <li <?php if ($tmp_step == 4) { ?>class="current"<?php } ?>>Set Root Password <li <?php if ($tmp_step == 5) { ?>class="current"<?php } ?>>Select Modules to Install <li <?php if ($tmp_step == 6) { ?>class="current"<?php } ?>>Install Language Packs <li <?php if ($tmp_step == 7) { ?>class="current"<?php } ?>>Post-Install Configuration <li <?php if ($tmp_step == 8) { ?>class="current"<?php } ?>>Finish </ol> <?php } else if ($install_type == 5) { ?> <ol class="install"> <li <?php if ($tmp_step == 1 || $login_error != '' || $inst_error != '') { ?>class="current"<?php } ?>>License Verification <li <?php if (($tmp_step == 2 && $login_error == '' && $inst_error == '') || $_POST['lic_opt'] == 1) { ?>class="current"<?php } ?>>Select License <li <?php if ($tmp_step == 3 && $_POST['lic_opt'] != 1) { ?>class="current"<?php } ?>>Select Domain <li <?php if ($tmp_step == 4) { ?>class="current"<?php } ?>>Finish </ol> <?php } else if ($install_type == 6) { ?> <ol class="install"> <li <?php if ($tmp_step == 1 || $login_error != '' || $inst_error != '') { ?>class="current"<?php } ?>>License Verification <li <?php if (($tmp_step == 2 && $login_error == '' && $inst_error == '') || $_GET['show_prev'] == 1 || $_POST['backupdir']) { ?>class="current"<?php } ?>>Select Backup File <li <?php if ($tmp_step == 3 && $_POST['lic_opt'] != 1 && $_GET['show_prev'] != 1 && !$_POST['backupdir']) { ?>class="current"<?php } ?>>Finish </ol> <?php } else if ($install_type == 7) { ?> <ol class="install"> <li <?php if ($tmp_step == 1 || $login_error != '' || $inst_error != '') { ?>class="current"<?php } ?>>License Verification <li <?php if ($tmp_step == 2 && $login_error == '' && $inst_error == '') { ?>class="current"<?php } ?>>Database Configuration <li <?php if ($tmp_step == 3) { ?>class="current"<?php } ?>>Finish </ol> <?php } else if ($install_type == 8) { ?> <ol class="install"> <li <?php if ($tmp_step == 1 || $login_error != '' || $inst_error != '') { ?>class="current"<?php } ?>>License Verification <li <?php if ($tmp_step == 2 && $login_error == '' && $inst_error == '') { ?>class="current"<?php } ?>>Select Modules to Upgrade <li <?php if ($tmp_step == 3) { ?>class="current"<?php } ?>>Language Pack Upgrade <li <?php if ($tmp_step == 4) { ?>class="current"<?php } ?>>Finish </ol> <?php } ?> <?php include($include_file); ?> <?php } else { ?> <?php include("install/general_error.php"); ?> <?php } ?> <td width="40%" style="border-left: 1px solid #000; background: #f0f0f0"> <table width="100%" border="0" cellspacing="0" cellpadding="4"> <tr> <td class="subsectiontitle" style="border-bottom: 1px solid #000000; background-color:#999"><?php echo $title;?></td> </tr> <tr> <td class="text"><?php echo $help;?></td> </tr> </table> </td> </tr> </table> <br> </td> </tr> </table> </td> </tr> <tr> <td id="footer"> Powered by In-portal © 1997-2004, Intechnic Corporation. All rights reserved. <br><img src="images/spacer.gif" width="1" height="10" alt=""> </td> </tr> </table> </form> </body> </html> \ No newline at end of file Property changes on: trunk/admin/install.php ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.38 \ No newline at end of property +1.39 \ No newline at end of property