Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sat, Feb 1, 11:50 PM

in-portal

This file is larger than 256 KB, so syntax highlighting was skipped.
Index: trunk/kernel/action.php
===================================================================
--- trunk/kernel/action.php (revision 401)
+++ trunk/kernel/action.php (revision 402)
@@ -1,2267 +1,2268 @@
<?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 = '&nbsp;';
$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><br>';
}
unset($script, $skip_debug);
}
switch($Action)
{
case "m_save_import_config":
// Set New Import Category
if( GetVar('categorylist', true) )
{
$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( GetVar('grouplist1', true) )
{
$group_id = $_POST['grouplist1'];
$group = $objGroups->GetItemByField('ResourceId',$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( GetVar('grouplist2', true) )
{
$group_id = $_POST['grouplist2'];
$group = $objGroups->GetItemByField('ResourceId', $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 = time();//DateCurrTimeTimstamp($_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());
+ //$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;
+ $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 {
+ $g->SetSystemPermission($PermList[$i], 0);
+ }
}
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":
$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();
$NewId = $ado->GetOne('SELECT MIN(RelationshipId) as MinValue FROM '.$RelList->SourceTable);
if($NewId > 0) $NewId = 0;
$NewId--;
$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 = GetVar('cat_pick', true);
$Status = (int)$_POST["status"];
$Hot = false; //(int)$_POST["itemhot"];
$Pop = false; //(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();
$NewId = $ado->GetOne('SELECT MIN(ImageId) as MinValue FROM '.$objImageList->SourceTable);
if($NewId > 0) $NewId = 0;
$NewId--;
$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_purge_email_log":
if($ro_perm) break;
$ado = GetADODBConnection();
$sql = "DELETE FROM ".GetTablePrefix()."EmailLog";
$ado->Execute($sql);
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 ParentId 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->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.36
\ No newline at end of property
+1.37
\ No newline at end of property
Index: trunk/kernel/include/searchitems.php
===================================================================
--- trunk/kernel/include/searchitems.php (revision 401)
+++ trunk/kernel/include/searchitems.php (revision 402)
@@ -1,657 +1,739 @@
<?php
/* search string syntax:
+<word> : <word> is required
-<word> : <word> cannot exist in the searched field
"word word" : contents between the quotes are treated as a single entity
+/-"word word" is supported
ignore words are not case sensitive
*/
class clsSearchLog extends clsItemDB
{
function clsSearchLog($id=NULL)
{
$this->clsItemDB();
$this->tablename = GetTablePrefix()."SearchLog";
$this->id_field = "SearchLogId";
$this->NoResourceId = 1;
if($id)
$this->LoadFromDatabase($id);
}
function LoadFromDatabase($Id)
{
global $Errors;
if(!isset($Id))
{
$Errors->AddError("error.AppError",NULL,'Internal error: LoadFromDatabase id',"",get_class($this),"LoadFromDatabase");
return false;
}
$sql = sprintf("SELECT * FROM ".$this->tablename." WHERE ".$this->IdField()." = '%s'",$Id);
$result = $this->adodbConnection->Execute($sql);
if ($result === false)
{
$Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"LoadFromDatabase");
return false;
}
$data = $result->fields;
$this->SetFromArray($data);
$this->Clean();
return true;
}
}
class clsSearchLogList extends clsItemCollection
{
var $Page;
var $PerPageVar;
function clsSearchLogList()
{
$this->clsItemCollection();
$this->SourceTable = GetTablePrefix()."SearchLog";
$this->classname = "clsSearchLog";
$this->Page=1;
$this->PerPageVar = "Perpage_SearchLog";
$this->AdminSearchFields = array("Keyword");
}
function UpdateKeyword($keyword,$SearchType)
{
$sql = "UPDATE ".$this->SourceTable." SET Indices = Indices+1 WHERE Keyword='$keyword' AND SearchType=$SearchType";
//echo $sql."<br>\n";
$this->adodbConnection->Execute($sql);
if($this->adodbConnection->Affected_Rows()==0)
{
//echo "Creating Keyword record..<br>\n";
$k = new clsSearchLog();
$k->Set("Keyword",$keyword);
$k->Set("Indices",1);
$k->Set("SearchType",$SearchType);
$k->Create();
}
}
function AddKeywords($Keywords)
{
if(is_array($Keywords))
{
for($i=0;$i<count($Keywords);$i++)
{
$this->UpdateKeyword($Keywords[$i]);
}
}
else
$this->UpdateKeyword($Keywords);
}
}
+class clsEmailLog extends clsItemDB
+{
+ function clsEmailLog($id=NULL)
+ {
+ $this->clsItemDB();
+ $this->tablename = GetTablePrefix()."SearchLog";
+ $this->id_field = "SearchLogId";
+ $this->NoResourceId = 1;
+ if($id)
+ $this->LoadFromDatabase($id);
+ }
+
+ function LoadFromDatabase($Id)
+ {
+ global $Errors;
+
+ if(!isset($Id))
+ {
+ $Errors->AddError("error.AppError",NULL,'Internal error: LoadFromDatabase id',"",get_class($this),"LoadFromDatabase");
+ return false;
+ }
+ $sql = sprintf("SELECT * FROM ".$this->tablename." WHERE ".$this->IdField()." = '%s'",$Id);
+ $result = $this->adodbConnection->Execute($sql);
+ if ($result === false)
+ {
+ $Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"LoadFromDatabase");
+ return false;
+ }
+
+ $data = $result->fields;
+
+ $this->SetFromArray($data);
+ $this->Clean();
+ return true;
+ }
+}
+
+class clsEmailLogList extends clsItemCollection
+{
+ var $Page;
+ var $PerPageVar;
+
+ function clsEmailLogList()
+ {
+ $this->clsItemCollection();
+ $this->SourceTable = GetTablePrefix()."SearchLog";
+ $this->classname = "clsEmailLog";
+ $this->Page=1;
+ $this->PerPageVar = "Perpage_EmailsL";
+ $this->AdminSearchFields = array("event", "fromuser", "addressto", "subject");
+ }
+
+ function UpdateKeyword($keyword,$SearchType)
+ {
+ $sql = "UPDATE ".$this->SourceTable." SET Indices = Indices+1 WHERE Keyword='$keyword' AND SearchType=$SearchType";
+ //echo $sql."<br>\n";
+ $this->adodbConnection->Execute($sql);
+ if($this->adodbConnection->Affected_Rows()==0)
+ {
+ //echo "Creating Keyword record..<br>\n";
+ $k = new clsSearchLog();
+ $k->Set("Keyword",$keyword);
+ $k->Set("Indices",1);
+ $k->Set("SearchType",$SearchType);
+ $k->Create();
+ }
+ }
+
+ function AddKeywords($Keywords)
+ {
+ if(is_array($Keywords))
+ {
+ for($i=0;$i<count($Keywords);$i++)
+ {
+ $this->UpdateKeyword($Keywords[$i]);
+ }
+ }
+ else
+ $this->UpdateKeyword($Keywords);
+ }
+}
+
class clsSearchResults extends clsItemCollection
{
var $ResultTable;
var $FieldList;
var $FieldWeight;
var $WhereClauses;
var $SourceTable;
var $Relationships;
var $Ignored_Words;
var $CatClause;
var $Keywords;
var $Phrase = "";
var $SearchType;
var $RequiredRelevance;
var $PctRelevance;
var $PctPop;
var $PctRating;
function clsSearchResults($SearchSource,$DataClass)
{
global $objConfig;
$this->clsItemCollection();
$this->SourceTable = $SearchSource;
$this->SetResultTable($SearchSource,$DataClass);
$this->FieldList = array();
$this->Relationships = array();
$this->Ignored_Words = array();
$this->WhereClauses = array();
$this->FieldWeight = array();
$this->Keywords = GetKeywords("");
$this->SearchType = 0; //simple
$this->RequiredRelevance=0;
$this->PctRelevance = $objConfig->Get("SearchRel_DefaultKeyword")/100;
$this->PctPop = $objConfig->Get("SearchRel_DefaultPop")/100;
$this->PctRating = $objConfig->Get("SearchRel_DefaultRating")/100;
}
function SetResultTable($SearchSource,$DataClass)
{
global $objSession;
$this->ResultTable = $objSession->GetSearchTable();
$this->classname= $DataClass;
}
function LoadSearchResults($Start=0,$PerPage=NULL)
{
if($PerPage)
{
$limit = "LIMIT $Start,$PerPage";
}
$sql = "SELECT * FROM ".$this->ResultTable." ".$limit;
$this->Clear();
$rs = $this->adodbConnection->Execute($sql);
return $this->Query_Item($sql);
}
function SetCategoryClause($whereclause)
{
$this->CatClause=$whereclause;
}
function AddRelationship($JoinTable,$JoinExpression=NULL)
{
$this->Relationships[$JoinTable]=$JoinExpression;
}
function SetKeywords($keywords)
{
$this->Phrase=$keywords;
$this->keywords = GetKeywords($keywords);
}
function AddSimpleCustomFields()
{
$sql = "SELECT * FROM ".GetTablePrefix()."SearchConfig WHERE TableName='".$this->SourceTable."' AND SimpleSearch=1 AND CustomFieldId>0";
//echo $sql;
foreach($this->Relationships as $Table=>$clause)
{
if(strlen($Table)>0 && $Table != "Category")
$sql .= " OR TableName='".$Table."'";
}
$ctable = GetTablePrefix()."CustomMetaData";
$rs = $this->adodbConnection->Execute($sql);
$CustomJoined = FALSE;
while($rs && !$rs->EOF)
{
$x = $rs->fields["CustomFieldId"];
$t = $ctable." as c".$x;
$join = "(c$x.ResourceId=".GetTablePrefix().$this->SourceTable.".ResourceId AND c$x.CustomFieldId=".$rs->fields["CustomFieldId"].")";
$this->AddRelationship($t,$join);
$f = "c".$x.".Value ";
$this->FieldList[] = $f;
$this->FieldWeight[$f] = $rs->fields["Priority"];
$rs->MoveNext();
}
}
function AddSimpleFields()
{
$sql = "SELECT * FROM ".GetTablePrefix()."SearchConfig WHERE TableName='".$this->SourceTable."' AND SimpleSearch=1 AND CustomFieldId=0";
//echo $sql;
foreach($this->Relationships as $Table=>$clause)
{
if(strlen($Table)>0 && $Table != "Category")
$sql .= " OR TableName='".$Table."'";
}
$rs = $this->adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$f = GetTablePrefix().$rs->fields["TableName"].".".$rs->fields["FieldName"];
$this->FieldList[] = $f;
$this->FieldWeight[$f] = $rs->fields["Priority"];
$rs->MoveNext();
}
$this->AddSimpleCustomFields();
}
function AddSearchWhereClause($FieldName)
{
$req_where = "";
/* build required keywords string */
if(count($this->keywords["required"])>0)
{
$required = $this->keywords["required"];
for($i=0;$i<count($required);$i++)
{
if(strlen($required[$i])>0)
{
if($i>0)
{
$or =" AND ";
}
else
$or = "";
$w .= $or." ".$FieldName." LIKE '%".$required[$i]."%'";
}
}
if(strlen($w)>0)
{
$req_where = "(". $w.")";
}
else
$req_where = "";
}
$w = "";
$not_where="";
if(count($this->keywords["notallowed"])>0)
{
$words = $this->keywords["notallowed"];
for($i=0;$i<count($words);$i++)
{
if(strlen($words[$i])>0)
{
if($i>0)
{
$or =" AND ";
}
else
$or = "";
$w .= $or." ".$FieldName." NOT LIKE '%".$words[$i]."%'";
}
}
if(strlen($w)>0)
{
$not_where = "(".$w.")";
}
else
$not_where = "";
}
$w="";
$normal = $this->keywords["normal"];
if(count($normal)>0)
{
for($i=0;$i<count($normal);$i++)
{
if (strlen($normal[$i])>0)
{
if($i>0)
{
$or =" OR ";
}
else
$or = "";
$w .= "$or $FieldName LIKE '%".$normal[$i]."%'";
}
}
if(count($required)>0)
$w .= " OR ";
for($i=0;$i<count($required);$i++)
{
if(strlen($required[$i])>0)
{
if($i>0)
{
$or = " OR ";
}
else
$or="";
$w .= "$or $FieldName LIKE '%".$required[$i]."%'";
}
}
if(strlen($w)>0)
{
$where = "(".$w.")";
}
else
$where = "";
}
$complete= BuildWhereClause($where,$req_where,$not_where);
$this->WhereClauses[$FieldName]="(".$complete.")";
$this->Ignored_Words=$this->keywords["ignored"];
}
function PerformSearch($ItemType,$OrderBy=NULL,$InitTable=FALSE, $idlist=NULL)
{
static $SelectSQL, $OldItemType;
global $objSession, $objItemTypes;
//echo "perfirming Simple Search<br>";
//echo "Old Item Type: $OldItemType New: $ItemType <br>\n";
if($ItemType != $OldItemType)
$SelectSQL = "";
$OldItemType = $ItemType;
$ctype = $objItemTypes->GetItem($ItemType);
$idField = $ctype->Get("SourceTable")."Id";
$this->SourceTable = GetTablePrefix().$ctype->Get("SourceTable");
$result=0;
$PopField = $ctype->Get("PopField");
$RateField = $ctype->Get("RateField");
//print_pre($this->keywords);
if(!strlen($SelectSQL))
{
$typestr = str_pad($ItemType,2,"0",STR_PAD_LEFT);
$SelectSQL = "SELECT ";
$ifs = array();
$weightsum = 0;
foreach($this->FieldWeight as $w)
$weightsum += $w;
$wordcount = count($this->keywords["normal"])+count($this->keywords["required"]);
$single = ($wordcount == 1);
foreach($this->FieldList as $f)
{
$weight = (int)$this->FieldWeight[$f];
$s = array();
if(!$single)
{
$full = trim(implode(" ",$this->keywords["normal"]));
$s[] = " (IF ($f LIKE '%$full%', ".$weightsum.", 0))";
}
foreach($this->keywords["normal"] as $k)
{
if($k != $full || $single)
{
$temp = " (IF ($f LIKE '%$k%', ".$weight.", 0))";
$s[] = $temp;
}
}
foreach($this->keywords["required"] as $k)
{
if($this->RequiredRelevance>0)
$weight = $this->FieldWeight[$f] + ($this->FieldWeight[$f]*($this->RequiredRelevance/100));
if($k != $full || $single)
{
$s[] = " (IF ($f LIKE '%$k%', ".$weight.", 0))";
}
}
// echo "<PRE>";print_r($s); echo "</PRE>";
$txt = implode("+",$s);
//echo $txt."<br>\n";
$ifs[] = $txt;
unset($s);
}
// echo "<PRE>";print_r($ifs); echo "</PRE>";
/* add relevance formula for weighting hits & popularity */
if($weightsum==0)
$weightsum=1;
if(strlen($PopField)>0 && $this->PctPop>0)
{
$popcalc = " + ((($PopField + 1) / (max($PopField)+1)*".$this->PctPop."))";
}
else
$popcalc = "";
if(strlen($RateField)>0 && $this->PctRating>0)
{
$ratecalc = " + ((($RateField + 1) / (max($RateField)+1)*".$this->PctRating."))";
}
else
$ratecalc = "";
if($this->PctRelevance>0)
{
$relcalc = "(((".implode("+",$ifs).")/$weightsum)*".$this->PctRelevance.")";
}
else
$relcalc = "0";
$SelectSQL .= $relcalc.$popcalc.$ratecalc." as Relevance, ";
$SelectSQL .= $this->SourceTable.".".$idField." as ItemId, ".$this->SourceTable.".ResourceId as ResourceId, CONCAT($typestr) as ItemType, EditorsPick as EdPick FROM ".$this->SourceTable." ";
foreach($this->Relationships as $JoinTable=>$OnClause)
{
$SelectSQL .= "LEFT JOIN $JoinTable ON $OnClause ";
}
$first=1;
$where=0;
foreach($this->FieldList as $field)
{
if(strpos($field,"as")>0)
{
$fparts = explode("as",$field,2);
$f = $fparts[1];
$this->AddSearchWhereClause($field);
}
else {
$this->AddSearchWhereClause($field);
}
}
$SelectSQL .= " WHERE ";
$SelectSQL .= implode(" or ",$this->WhereClauses);
if(is_array($idlist))
{
$SelectSQL .= " AND (ResourceId IN (".implode(",",$idlist)."))";
}
}
$SelectSQL .= "GROUP BY $idField ";
//echo $SelectSQL."<br><br>\n";
if($InitTable)
{
$this->adodbConnection->Execute("DROP TABLE IF EXISTS ".$this->ResultTable);
//$indexSQL = "(INDEX(Relevance), INDEX(ItemId), INDEX(ItemType), INDEX sorting (EdPick,Relevance)) ";
$full_sql = "CREATE TABLE ".$this->ResultTable." ".$indexSQL.$SelectSQL;
//echo $full_sql."<br>\n";
$this->adodbConnection->Execute($full_sql);
//echo $this->adodbConnection->ErrorMsg()."<br>\n";
$objSession->SetVariable("Search_Keywords",$this->Phrase);
}
else
{
$full_sql = "INSERT INTO ".$this->ResultTable." (Relevance,ItemId,ResourceId,ItemType,EdPick) ".$SelectSQL;
//echo "[<b>".htmlspecialchars($full_sql)."</b>]<br>\n";
$this->adodbConnection->Execute($full_sql);
//echo $this->adodbConnection->ErrorMsg()."<br>\n";
}
//Here we need to remove found items which was found by HTML tags matching keywords
//$this->adodbConnection->Execute("DELETE FROM ".$this->ResultTable." WHERE ItemId = 13 AND ItemType = 4");
}
function BuildIndexes()
{
$sql = "ALTER TABLE ".$this->ResultTable." ADD INDEX (Relevance), ";
$sql .="ADD INDEX (ItemId), ";
$sql .="ADD INDEX (ItemType), ";
$sql .=" ADD INDEX sorting (EdPick,Relevance)";
//echo $sql;
$this->adodbConnection->Execute($sql);
}
function Result_IdList()
{
/* returns an array contain a resource ID list */
$sql = "SELECT DISTINCT(ResourceId) FROM ".$this->ResultTable;
$rs = $this->adodbConnection->Execute($sql);
$result = array();
while($rs && !$rs->EOF)
{
$result[] = $rs->fields["ResourceId"];
$rs->MoveNext();
}
return $result;
}
}
function count_words($string)
{
// below line added to make contiguous spaces count as one space
if(strlen($string))
{
$string = eregi_replace(" +", " ", $string);
return substr_count($string," ")+1;
}
else
return 0;
}
function GetKeywords($phrase)
{
global $KeywordIgnore;
if(count($KeywordIgnore)==0)
GetIgnoreList();
$keywords["normal"]= array();
$keywords["required"]= array();
$keywords["notallowed"] = array();
$keywords["ignored"] = array();
if(!strlen($phrase))
return $keywords;
$w_array = array();
$phrase=trim($phrase);
//if(count_words($phrase)>1)
// $keywords["normal"][] = $phrase;
$t_len = strlen($phrase);
$ce=0;
for ($i=0; $i<$t_len; $i++)
{ #search for next special tag
switch ($phrase[$i])
{
case "\"":
$exact_match_close = strpos($phrase,"\"", $i+1);
if(!$exact_match_close)
break;
$exact_word=substr($phrase, $i+1, ($exact_match_close-$i)-1);
$i=$exact_match_close;
if($exact_word)
{
if(strlen($token)==0)
$token="|";
$w_array[$ce]=$token.addslashes($exact_word);
$token="";
$ce++;
$exact_word="";
}
break;
case "+":
if(strlen($exact_word)==0)
{
$token = "+";
}
else
$exact_word .= "+";
break;
case "-":
if(strlen($exact_word)==0)
{
$token = "-";
}
else
$exact_word .="-";
break;
case " ":
case ",":
if($exact_word)
{
if(strlen($token)==0)
$token="|";
if($token=="|")
{
if($KeywordIgnore[strtolower($exact_word)]==1)
{
$w_array[$ce]= "=".addslashes($exact_word);
$ce++;
}
else
{
$w_array[$ce]=$token.addslashes($exact_word);
$ce++;
}
}
else
{
$w_array[$ce]=$token.addslashes($exact_word);
$ce++;
}
$token="";
$exact_word="";
}
break;
default:
$exact_word.=$phrase[$i];
}
}
if($exact_word)
{
if(strlen($token)==0)
$token="|";
if($KeywordIgnore[strtolower($exact_word)]==1 && ($token =="|" || $token=="="))
{
$w_array[$ce]= "=".addslashes($exact_word);
$ce++;
}
else
{
$w_array[$ce]=$token.addslashes($exact_word);
$ce++;
}
}
for ($i=0;$i<count($w_array);$i++)
{
$keyword = $w_array[$i];
switch(substr($keyword,0,1))
{
case "|":
$keywords["normal"][]=substr($keyword,1);
break;
case "+":
$keywords["required"][] = substr($keyword,1);
break;
case "-":
$keywords["notallowed"][] = substr($keyword,1);
break;
case "=":
$keywords["ignored"][] = substr($keyword,1);
break;
}
}
return($keywords);
}
function BuildWhereClause($normal,$required,$notallowed)
{
$return="";
$return = $required;
if(strlen($return)>0 && strlen($notallowed)>0)
{
$return .= " AND ";
}
$return .= $notallowed;
if(strlen($return)>0 && strlen($normal)>0)
{
$return .= " AND ";
}
$return .= $normal;
return $return;
}
function GetIgnoreList()
{
global $KeywordIgnore;
$adodbConnection = GetADODBConnection();
$rs = $adodbConnection->Execute("SELECT * FROM IgnoreKeywords");
while($rs && !$rs->EOF)
{
$KeywordIgnore[strtolower($rs->fields["keyword"])]=1;
$rs->MoveNext();
}
// foreach($KeywordIgnore as $word=>$dummy)
// echo $word.",";
// echo "<br>\n";
}
?>
Property changes on: trunk/kernel/include/searchitems.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Index: trunk/kernel/include/modules.php
===================================================================
--- trunk/kernel/include/modules.php (revision 401)
+++ trunk/kernel/include/modules.php (revision 402)
@@ -1,906 +1,906 @@
<?php
/* List of installed modules and module-specific variables
Copyright 2002, Intechnic Corporation, All rights reserved
*/
setcookie("CookiesTest", "1");
// if branches that uses if($mod_prefix) or like that will never be executed
// due global variable $mod_prefix is never defined
$ExtraVars = array();
function ParseEnv()
{
global $env, $var_list, $mod_prefix,$objSession, $SessionQueryString;
/* parse individual sections */
$env = isset($_GET['env']) ? $_GET['env'] : '';
if ($env == "")
{
$var_list["t"] = "index";
if(is_array($mod_prefix))
{
foreach($mod_prefix as $key => $value)
{
if(strlen($key))
{
$parser_name = $key . "_ParseEnv";
if(function_exists($parser_name))
{
@$parser_name();
}
}
}
}
}
else
{
$envsections = explode(":", $env);
foreach($mod_prefix as $key => $value)
{
if(strlen($key))
{
$parsed=FALSE;
$parser_name = $key . "_ParseEnv";
for($i=1; $i<sizeof($envsections); $i++)
{
$pieces = explode("-", $envsections[$i]);
if(substr($pieces[0],0,strlen($key))==$key)
{
$parsed=TRUE;
if(function_exists($parser_name))
{
$parser_name($envsections[$i]);
}
}
}
if(!$parsed)
{
if(function_exists($parser_name))
{
@$parser_name();
}
}
}
}
$req_vars = explode("-", $envsections[0]);
$sid = $req_vars[0];
if(!$SessionQueryString)
{
if(!strlen($sid) || $sid=="_")
{
if($sid != "_")
$sid = $_COOKIE["sid"];
}
else
$SessionQueryString = TRUE;
}
$var_list["sid"] = $sid;
$var_list["t"] = $req_vars[1];
if( isset($_GET['dest']) )
$var_list['dest'] = $_GET['dest'];
}
}
function LoadEnv()
{
global $env, $var_list, $mod_prefix,$objSession;
$env = $_GET["env"];
// echo "Loading Variables..<br>\n";
if ($env != "")
{
$envsections = explode(":", $env);
foreach($mod_prefix as $key => $value)
{
if(strlen($key))
{
$parsed=FALSE;
for($i=1; $i<sizeof($envsections); $i++)
{
$pieces = explode("-", $envsections[$i]);
if(substr($pieces[0],0,strlen($key))==$key)
{
$parsed=TRUE;
break;
}
}
if(!$parsed)
{
$parser_name = $key . "_LoadEnv";
//echo $parser_name;
if(function_exists($parser_name))
{
$parser_name();
}
}
else
{
$parser_name = $key . "_SaveEnv";
//echo $parser_name;
if(function_exists($parser_name))
{
$parser_name($envsections[$i]);
}
}
}
}
}
}
function BuildEnv($mod_prefix = false)
{
global $var_list,$m_var_list, $var_list_update, $mod_prefix, $objSession, $objConfig,
$ExtraVars, $objThemes, $CurrentTheme, $SessionQueryString, $FrontEnd;
static $theme;
$env = "";
//echo "Query String: $SessionQueryString<br>\n";
if(($objConfig->Get("CookieSessions")==0 || !$FrontEnd || ($objConfig->Get("CookieSessions")==2 && $SessionQueryString==TRUE)))
{
if(!$objSession->UseTempKeys)
{
$sessionkey = $objSession->GetSessionKey();
}
else
$sessionkey = $objSession->Get("CurrentTempKey");
$env = $sessionkey;
}
$env .= "-";
if (isset($var_list_update["t"]))
{
if($var_list_update["t"]=="_referer_")
{
$var_list_update["t"] =$objSession->GetVariable("Template_Referer");
}
$t = $var_list_update["t"];
if(!is_numeric($t))
{
if(!is_object($theme))
$theme = $objThemes->GetItem($m_var_list["theme"]);
$id = $theme->GetTemplateId($t);
$var_list_update["t"] = $id;
}
$env .= $var_list_update["t"];
}
else
{
$t = isset($var_list['t']) ? $var_list['t'] : '';
if(!is_numeric($t))
{
if(!is_object($theme))
$theme = $objThemes->GetItem($m_var_list["theme"]);
$id = $theme->GetTemplateId($t);
$t = $id;
}
$env .= $t;
}
if(is_array($mod_prefix))
{
foreach($mod_prefix as $key => $value)
{
$builder_name = $key . "_BuildEnv";
if(function_exists($builder_name))
{
$GLOBALS[$key.'_var_list_update']['test'] = 'test';
$env .= $builder_name();
}
}
}
$extra = "";
$keys = array_keys($ExtraVars);
if(is_array($keys))
{
for($i=0;$i<count($keys);$i++)
{
$key = $keys[$i];
$e = "&".$key."=".$ExtraVars[$key];
$extra .= $e;
$e = "";
}
}
$env .= $extra;
return $env;
}
function CategoryActionFunc($basename,$CatList)
{
global $mod_prefix;
foreach($mod_prefix as $key => $value)
{
$function_name = $key."_".$basename;
if(function_exists($function_name))
{
$function_name($CatList);
}
}
}
function RegisterEnv($Var,$Value)
{
global $ExtraVars;
$ExtraVars[$Var] = $Value;
}
function UnregisterEnv($Var)
{
global $ExtraVars;
unset($ExtraVars[$Var]);
}
function ModuleTagPrefix($name)
{
global $modules_loaded;
$ret = "";
foreach($modules_loaded as $prefix=>$mod_name)
{
if($name==$mod_name)
{
$ret = $prefix;
break;
}
}
return $ret;
}
function ModuleEnabled($name)
{
global $template_path;
$a = array_keys($template_path);
if(in_array($name,$a))
return TRUE;
return FALSE;
}
function GetModuleArray($array_name="mod_prefix")
{
switch($array_name)
{
case "mod_prefix":
global $mod_prefix;
return $mod_prefix;
break;
case "admin":
global $mod_prefix, $modules_loaded;
$mod = array();
if(is_array($mod_prefix) && is_array($modules_loaded))
{
foreach ($mod_prefix as $key=>$value)
{
if(_ModuleLicensed($modules_loaded[$key]) || $key=="m")
{
$mod[$key] = $value;
}
}
}
return $mod;
break;
case "loaded":
global $modules_loaded;
return $modules_loaded;
break;
case "template":
global $template_path;
return $template_path;
case "rootcat":
global $mod_root_cats;
return $mod_root_cats;
break;
}
}
function admin_login()
{
global $objSession,$login_error, $objConfig,$g_Allow,$g_Deny;
//echo "<pre>"; print_r($objSession); echo "</pre>";
if( GetVar('help_usage') == 'install' ) return true;
$env_arr = explode('-', $_GET['env']);
$get_session_key = $env_arr[0];
$admin_login = isset($_POST['adminlogin']) && $_POST['adminlogin']; // $_POST['adminlogin'] != 1
if(!$objSession->ValidSession() || ($objSession->GetSessionKey() != $get_session_key && !$admin_login)) {
if( isset($_GET['expired']) && ($_GET['expired'] == 1) )
$login_error = admin_language("la_text_sess_expired");
return FALSE;
//echo "Expired<br>";
}
if ($objSession->HasSystemPermission("ADMIN") == 1)
return TRUE;
if(count($_POST)==0 || $_POST["adminlogin"]!=1)
return FALSE;
$login=$_POST["login"];
$password = $_POST["password"];
if (strlen($login) && strlen($password))
{
if(!_IpAccess($_SERVER['REMOTE_ADDR'],$g_Allow,$g_Deny))
{
$login_error = admin_language("la_text_address_denied");
return FALSE;
}
$valid = $objSession->Login($login, md5($password));
$hasperm = ($objSession->HasSystemPermission("ADMIN") == 1);
if (($login=="root" || $hasperm) && $valid)
{
if(_ValidateModules())
{
return TRUE;
}
else
$login_error = "Missing or invalid In-Portal License";
}
else
{
if(!$hasperm && $valid)
{
$login_error = admin_language("la_text_nopermissions");
}
else
{
$login_error = admin_language("la_Text_Access_Denied");
}
return FALSE;
}
}
else
{
if(!strlen($login))
{
$login_error = admin_language("la_Text_Missing_Username");
}
else
if(!strlen($password))
$login_error = admin_language("la_Text_Missing_Password");
return FALSE;
}
}
#---------------------------------------------------------------------------
function _EnableCookieSID()
{
global $var_list, $objConfig;
if((!$_COOKIE["sid"] && $objConfig->Get("CookieSessions")>0 && strlen($var_list["sid"])<2 && !headers_sent())
|| strlen($_COOKIE["sid"])>0)
{
return TRUE;
}
else
return FALSE;
}
function _IsSpider($UserAgent)
{
global $robots, $pathtoroot;
$lines = file($pathtoroot."robots_list.txt");
if(!is_array($robots))
{
$robots = array();
for($i=0;$i<count($lines);$i++)
{
$l = $lines[$i];
$p = explode("\t",$l,3);
$robots[] = $p[2];
}
}
return in_array($UserAgent,$robots);
}
function _StripDomainHost($d)
{
$dotcount = substr_count($d,".");
if($dotcount==3)
{
$IsIp = TRUE;
for($x=0;$x<strlen($d);$x++)
{
if(!is_numeric(substr($d,$x,1)) && substr($d,$x,1)!=".")
{
$IsIp = FALSE;
break;
}
}
}
if($dotcount>1 && !$IsIp)
{
$p = explode(".",$d);
$ret = $p[count($p)-2].".".$p[count($p)-1];
}
else
$ret = $d;
return $ret;
}
function _MatchIp($ip1,$ip2)
{
$matched = TRUE;
$ip = explode(".",$ip1);
$MatchIp = explode(".",$ip2);
for($i=0;$i<count($ip);$i++)
{
if($i==count($MatchIp))
break;
if(trim($ip[$i]) != trim($MatchIp[$i]) || trim($ip[$i])=="*")
{
$matched=FALSE;
break;
}
}
return $matched;
}
function _IpAccess($IpAddress,$AllowList,$DenyList)
{
$allowed = explode(",",$AllowList);
$denied = explode(",",$DenyList);
$MatchAllowed = FALSE;
for($x=0;$x<count($allowed);$x++)
{
$ip = explode(".",$allowed[$x]);
$MatchAllowed = _MatchIp($IpAddress,$allowed[$x]);
if($MatchAllowed)
break;
}
$MatchDenied = FALSE;
for($x=0;$x<count($denied);$x++)
{
$ip = explode(".",$denied[$x]);
$MatchDenied = _MatchIp($IpAddress,$denied[$x]);
if($MatchDenied)
break;
}
$Result = (($MatchAllowed && !$MatchDenied) || (!$MatchAllowed && !$MatchDenied) ||
($MatchAllowed && $MatchDenied));
return $Result;
}
function _ValidateModules()
{
global $i_Keys, $objConfig, $g_License;
$lic = base64_decode($g_License);
_ParseLicense($lic);
$modules = array();
//echo "License: ".$lic."<br>";
$domain = _GetDomain();
//echo "Domain: ".$domain."<br>";
if(!_IsLocalSite($domain))
{
$domain = _StripDomainHost($domain);
//echo "New domain: $domain<br>";
// echo "<pre>"; print_r($i_Keys); echo "</pre>";
for($x=0;$x<count($i_Keys);$x++)
{
$key = $i_Keys[$x];
if(strlen(stristr($key["domain"],$domain)))
{
$modules = explode(",",$key["mod"]);
//echo "Modules: $modules";
}
}
if(count($modules)>0)
{
return TRUE;
}
}
else
return TRUE;
return FALSE;
}
function _ModuleLicensed($name)
{
global $i_Keys, $objConfig, $pathtoroot;
$vars = parse_portal_ini($pathtoroot."config.php");
// globalize vars from config
while($key = key($vars))
{
$GLOBALS["g_".$key] = current($vars);
next($vars);
}
$lic = base64_decode($GLOBALS['g_License']); // this works in all cases
_ParseLicense($lic);
$modules = array();
if(!_IsLocalSite(_GetDomain()))
{
for($x=0;$x<count($i_Keys);$x++)
{
$key = $i_Keys[$x];
if(strlen(stristr(_GetDomain(),$key["domain"])))
{
//echo "ok<br>";
$modules = explode(",",$key["mod"]);
}
}
if(in_array($name,$modules)) {
//echo "ok<br>";
return TRUE;
}
}
else {
return TRUE;
}
return FALSE;
}
function _GetDomain()
{
global $objConfig, $g_Domain;
if($objConfig->Get("DomainDetect"))
{
$d = $_SERVER['HTTP_HOST'];
}
else
$d = $g_Domain;
return $d;
}
function _keyED($txt,$encrypt_key)
{
$encrypt_key = md5($encrypt_key);
$ctr=0;
$tmp = "";
for ($i=0;$i<strlen($txt);$i++)
{
if ($ctr==strlen($encrypt_key)) $ctr=0;
$tmp.= substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1);
$ctr++;
}
return $tmp;
}
function _decrypt($txt,$key)
{
$txt = _keyED($txt,$key);
$tmp = "";
for ($i=0;$i<strlen($txt);$i++)
{
$md5 = substr($txt,$i,1);
$i++;
$tmp.= (substr($txt,$i,1) ^ $md5);
}
return $tmp;
}
function LoadFromRemote()
{
return "";
}
function DLid()
{
global $lid;
echo $lid."\n";
die();
}
function _LoadLicense($LoadRemote=FALSE)
{
global $pathtoroot, $objConfig;
$f = $pathtoroot."intechnic.php";
if(file_exists($f))
{
$contents = file($f);
$data = base64_decode($contents[1]);
}
else
if($LoadRemote)
return $LoadFromRemote;
return $data;
}
function _VerifyKey($domain,$k)
{
$key = md5($domain);
$lkey = substr($key,0,strlen($key)/2);
$rkey = substr($key,strlen($key)/2);
$r = $rkey.$lkey;
if($k==$r)
return TRUE;
return FALSE;
}
function _ParseLicense($txt)
{
global $i_User, $i_Pswd, $i_Keys;
$data = _decrypt($txt,"beagle");
$i_Keys = array();
$lines = explode("\n",$data);
for($x=0;$x<count($lines);$x++)
{
$l = $lines[$x];
$p = explode("=",$l,2);
switch($p[0])
{
case "Username":
$i_User = $p[1];
break;
case "UserPass":
$i_Pswd = $p[1];
break;
default:
if(substr($p[0],0,3)=="key")
{
$parts = explode("|",$p[1]);
if(_VerifyKey($parts[0],$parts[1]))
{
unset($K);
$k["domain"]=$parts[0];
$k["key"]=$parts[1];
$k["desc"]=$parts[2];
$k["mod"]=$parts[3];
$i_Keys[] = $k;
}
}
break;
}
}
}
function _IsLocalSite($domain)
{
$localb = FALSE;
if(substr($domain,0,3)=="172")
{
$b = substr($domain,0,6);
$p = explode(".",$domain);
$subnet = $p[1];
if($p[1]>15 && $p[1]<32)
$localb=TRUE;
}
if($domain=="localhost" || $domain=="127.0.0.1" || substr($domain,0,7)=="192.168" ||
substr($domain,0,3)=="10." || $localb || strpos($domain,".")==0)
{
return TRUE;
}
return FALSE;
}
//echo "Before Stuff<br>";
LogEntry("Loading Modules\n");
/* get the module list from the database */
$adodbConnection = GetADODBConnection();
$sql = "SELECT Name, Path, Var,TemplatePath, RootCat from ".GetTablePrefix()."Modules where Loaded=1 ORDER BY LoadOrder";
$rs = $adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$key = $rs->fields["Var"];
$mod_prefix[$key] = $rs->fields["Path"];
$modules_loaded[$key] = $rs->fields["Name"];
$name = $rs->fields["Name"];
$template_path[$name] = $rs->fields["TemplatePath"];
$mod_root_cats[$name] = $rs->fields["RootCat"];
// echo $key . "=". $modules_loaded[$key]."<br>\n";
$rs->MoveNext();
}
LogEntry("Loading Module Parser scripts\n");
/* for each module enabled, load up parser.php */
//foreach($mod_prefix as $key => $value)
$LogLevel++;
if(is_array($mod_prefix))
{
foreach($mod_prefix as $key => $value)
{
$mod = $pathtoroot . $value . "parser.php";
// LogEntry("Loading parser $mod \n");
require_once($mod);
}
}
$LogLevel--;
LogEntry("Finished Loading Module Parser scripts\n");
/*now each module gets a look at the environment string */
$SessionQueryString = FALSE;
if(!isset($FrontEnd)) $FrontEnd = false;
if($FrontEnd != 1)
$SessionQueryString = TRUE;
if(is_array($mod_prefix))
ParseEnv();
/* create the session object */
$ip = $_SERVER["REMOTE_ADDR"];
if ( !isset($var_list['sid']) ) $var_list['sid'] = '';
if ( !isset($_GET['env']) ) $_GET['env'] = '';
if(strlen($var_list["sid"])==0 && strlen($_GET["env"])>0 && $objConfig->Get("CookieSessions")==2)
{
if(_IsSpider($_SERVER["HTTP_USER_AGENT"]))
{
$UseSession = FALSE;
}
else
{
/* switch user to GET session var */
if (!$_COOKIE['sid']) {
$SessionQueryString = TRUE;
}
//else {
//$SessionQueryString = FALSE;
//}
$UseSession = TRUE;
}
}
else {
$UseSession = TRUE;
}
if($var_list["sid"]=="_")
$var_list["sid"]="";
/*setup action variable*/
$Action = isset($_REQUEST['Action']) ? $_REQUEST['Action'] : '';
if($Action=="m_logout")
{
$u = new clsUserSession($var_list["sid"] ,($SessionQueryString && $FrontEnd==1));
$u->Logout();
unset($u);
$var_list_update["t"] = "index";
$var_list["t"] = "";
$var_list["sid"]="";
setcookie("login","",time()-3600);
setcookie("sid","",time()-3600);
}
$CookieTest = isset($_COOKIE["CookiesTest"]) ? $_COOKIE["CookiesTest"] : '';
$HTTP_REFERER = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
-if ( ($CookieTest == 1) || !strstr($HTTP_REFERER, $_SERVER['SERVER_NAME'].$objConfig->Get("Site_Path"))) {
+if ( ($CookieTest == 1) || !strstr($HTTP_REFERER, $_SERVER['HTTP_HOST'].$objConfig->Get("Site_Path"))) {
$SessionQueryString = FALSE;
}
if ($FrontEnd != 1) {
$SessionQueryString = TRUE;
}
$objSession = new clsUserSession($var_list["sid"],($SessionQueryString && $FrontEnd==1));
if($UseSession)
{
if(!$objSession->ValidSession())
{
/* Get rid of Invalid Session and make a brand new one*/
// echo "Dumping Session ".$var_list["sid"]."<br>";
unset($var_list["sid"]);
$objSession->GetNewSession();
$var_list["sid"] = $objSession->GetSessionKey();
$var_list_update["sid"]=$objSession->GetSessionKey();
if(is_numeric($m_var_list["theme"]))
$objSession->SetThemeName($m_var_list["theme"]);
if($objConfig->Get("CookieSessions")>0 && !$SessionQueryString && !headers_sent())
setcookie("sid",$var_list["sid"]);
//echo "New Session: ".$objSession->GetSessionKey()."<br>\n";
if(isset($_COOKIE["login"]) && $Action != "m_logout" && $FrontEnd==1)
{
$parts = explode("|",$_COOKIE["login"]);
$username = $parts[0];
$pass = $parts[1];
$objSession->Login($username,$pass);
}
}
else
{ //echo "Update Session<br>";
if($objSession->Get("Language")!=$m_var_list["lang"])
{
$objSession->Set("Language",$m_var_list["lang"]);
}
$objSession->LoadSessionData();
$objSession->UpdateAccessTime();
$objSession->Update();
LoadEnv();
}
}
if( isset($var_list['t']) && is_numeric($var_list['t']))
{
if( !isset($CurrentTheme) ) $CurrentTheme = null;
if(!is_object($CurrentTheme))
$CurrentTheme = $objThemes->GetItem($m_var_list["theme"]);
$var_list["t"] = $CurrentTheme->GetTemplateById($var_list["t"]);
$objSession->Set("Theme",$CurrentTheme->Get("Name"));
}
/*create the global current user object */
$UserID=$objSession->Get("PortalUserId");
$objCurrentUser = new clsPortalUser($UserID);
$objLanguageCache = new clsLanguageCache($m_var_list["lang"]);
/* include each module's action.php script */
LogEntry("Loading Module action scripts\n");
## Global Referer Template
$_local_t = isset($var_list['t']) ? $var_list['t'] : '';
if(is_array($mod_prefix))
{
foreach($mod_prefix as $key => $folder_name)
{
if($FrontEnd==0 || !is_numeric($FrontEnd) || $FrontEnd==2)
{
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if( !strlen($admin) ) $admin = "admin";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
if(_ModuleLicensed($modules_loaded[$key]))
{
$mod = $pathtoroot.$folder_name."module_init.php";
if( file_exists($mod) ) require_once($mod);
$mod = $pathtoroot.$folder_name."action.php";
if( file_exists($mod) ) require_once($mod);
$mod = $pathtoroot.$folder_name."searchaction.php";
if( file_exists($mod) ) require_once($mod);
}
}
if($FrontEnd==1 || $FrontEnd==2)
{
$mod = $pathtoroot.$folder_name."module_init.php";
if(file_exists($mod))
require_once($mod);
$mod = $pathtoroot.$folder_name."frontaction.php";
if(file_exists($mod))
require_once($mod);
}
}
}
if (strstr($_SERVER['SCRIPT_NAME'], 'install') && $objSession->Get("PortalUserId") == 0) {
$objSession->Delete();
}
if( !isset($SearchPerformed) ) $SearchPerformed = false;
if($SearchPerformed == true) $objSearch->BuildIndexes();
LogEntry("Finished Loading Module action scripts\n");
-?>
+?>
\ No newline at end of file
Property changes on: trunk/kernel/include/modules.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.14
\ No newline at end of property
+1.15
\ No newline at end of property
Index: trunk/kernel/include/portaluser.php
===================================================================
--- trunk/kernel/include/portaluser.php (revision 401)
+++ trunk/kernel/include/portaluser.php (revision 402)
@@ -1,1000 +1,1001 @@
<?php
RegisterPrefix("clsPortalUser","user","kernel/include/portaluser.php");
class clsPortalUser extends clsItem
{
var $Vars; //contains the PersistantSessionData for the user
var $VarsLoaded;
var $PrimeGroup;
function clsPortalUser($UserId=NULL)
{
$this->clsParsedItem();
$this->tablename=GetTablePrefix()."PortalUser";
$this->type=6;
$this->BasePermission="USER";
$this->id_field = "PortalUserId";
$this->TagPrefix="user";
$this->Vars = array();
$VarsLoaded = FALSE;
$this->debuglevel = 0;
if(isset($UserId))
$this->LoadFromDatabase($UserId);
}
function Delete()
{
global $objGroups, $objFavorites;
$g = $objGroups->GetPersonalGroup($this->Get("Login"));
if(is_object($g))
$g->Delete();
$objFavorites->DeleteUser($this->Get("PortalUserId")); //delete favorites
parent::Delete();
}
function RemoveFromAllGroups()
{
$sql = "DELETE FROM ".GetTablePrefix()."UserGroup WHERE PortaluserId=".$this->Get("PortalUserId");
$this->adodbConnection->Execute($sql);
}
function RemoveFromGroup($GroupId)
{
$sql = "DELETE FROM ".GetTablePrefix()."UserGroup WHERE PortaluserId=".$this->Get("PortalUserId");
$sql .= " AND GroupId=$GroupId";
$this->adodbConnection->Execute($sql);
}
function PrimaryGroup($ReturnField = "GroupId")
{
global $objGroups;
$ret = "";
if(!is_object($this->PrimeGroup))
{
if((int)$this->Get("GroupId")>0)
{
$this->PrimeGroup =& $objGroups->GetItem($this->Get("GroupId"));
}
else
{
$this->PrimeGroup = new clsPortalGroup();
$sql = "SELECT * FROM ".GetTablePrefix()."UserGroup INNER JOIN ".GetTablePrefix()."PortalGroup ON (".GetTablePrefix()."UserGroup.GroupId=".GetTablePrefix()."PortalGroup.GroupId) WHERE PrimaryGroup = 1 AND PortalUserId=".$this->Get("PortalUserId");
//echo $sql;
$rs = $this->adodbConnection->Execute($sql);
if($rs && !$rs->EOF)
$this->PrimeGroup->SetFromArray($rs->fields);
}
}
$ret = $this->PrimeGroup->Get($ReturnField);
return $ret;
}
function SetPrimaryGroup($GroupId)
{
if($this->IsInGroup($GroupId))
{
$sql = "UPDATE ".GetTablePrefix()."UserGroup SET PrimaryGroup=0 WHERE PortalUserId=".$this->Get("PortalUserId");
$this->adodbConnection->Execute($sql);
$sql = "UPDATE ".GetTablePrefix()."UserGroup SET PrimaryGroup=1 WHERE GroupId=$GroupId AND PortalUserId=".$this->Get("PortalUserId");
$this->adodbConnection->Execute($sql);
}
}
function GetGroupList()
{
$ret = array();
$sql = "SELECT GroupId FROM %sUserGroup WHERE PortalUserId = %s ORDER BY PrimaryGroup";
$sql = sprintf($sql, GetTablePrefix(), $this->Get("PortalUserId"));
$ret = $this->adodbConnection->GetCol($sql);
return $ret;
}
function IsInGroup($GroupId)
{
$groups = $this->GetGroupList();
if( $groups === false ) return false;
return in_array($GroupId, $groups) ? true : false;
}
function GetPersonalGroup($CreateIfMissing = FALSE)
{
global $objGroups;
$n = "_".$this->Get("Login");
$g = $objGroups->GetItemByField("Name",$n);
if(!is_object($g) && $CreateIfMissing)
$g = $this->CreatePersonalGroup();
return $g;
}
function CreatePersonalGroup()
{
global $objGroups;
$Description = $this->Get("FirstName")." ".$this->Get("LastName");
$CreatedOn=time();
$n = "_".$this->Get("Login");
$g = $objGroups->Add_Group($n, $Description, $CreatedOn, 1, 0);
$g->Set("Personal",1);
$g->Set("System",0);
$g->Set("Enabled",1);
$g->Update();
if(is_object($g))
$g->AddUser($this->Get("PortalUserId"));
return $g;
}
function Validate()
{
global $Errors;
$dataValid = true;
if(!strlen($this->Get("Login")))
{
$Errors->AddError("error.fieldIsRequired",'Login',"","",get_class($this),"Validate");
$dataValid = false;
}
if(!strlen($this->Get("Email")))
{
$Errors->AddError("error.fieldIsRequired",'Email',"","",get_class($this),"Validate");
$dataValid = false;
}
return $dataValid;
}
function Approve()
{
$this->Set("Status", 1);
$this->Update();
$this->SendUserEventMail("USER.APPROVE",$this->Get("PortalUserId"));
$this->SendAdminEventMail("USER.APPROVE");
}
function Deny($IsBanned = 0)
{
$this->Set( Array('Status','IsBanned'), Array(0,$IsBanned) );
$this->Update();
$this->SendUserEventMail("USER.DENY",$this->Get("PortalUserId"));
$this->SendAdminEventMail("USER.DENY");
}
function HasSystemPermission($PermissionName)
{
global $objGroups;
$GroupList = $this->GetGroupList();
for($i=0;$i<count($GroupList);$i++)
{
$g = $objGroups->GetItem($GroupList[$i]);
$value = $g->HasSystemPermission($PermissionName);
if($value != -1)
break;
}
return $value;
}
function LoadPersistantVars()
{
global $objConfig;
unset($this->Vars);
$this->Vars = array();
$user_id = $this->HasField('PortalUserId') ? $this->Get('PortalUserId') : 0;
$sql = "SELECT VariableName, VariableValue FROM ".GetTablePrefix()."PersistantSessionData WHERE PortalUserId = 0 OR PortalUserId = ".$user_id." ORDER BY PortalUserId ASC";
$result = $this->adodbConnection->Execute($sql);
while ($result && !$result->EOF)
{
$data = $result->fields;
$this->Vars[$data["VariableName"]] = $data["VariableValue"];
$objConfig->Set($data["VariableName"], $data["VariableValue"], 1, 1);
$result->MoveNext();
}
$this->VarsLoaded=TRUE;
}
function SetPersistantVariable($variableName, $variableValue)
{
global $objConfig;
if(!$this->VarsLoaded)
$this->LoadPersistantVars();
$userid = $this->Get("PortalUserId");
$objConfig->Set($variableName,$variableValue,1);
$fields = array_keys($this->Vars);
if(strlen($variableValue)>0)
{
if(in_array($variableName,$fields))
{
$sql = "UPDATE ".GetTablePrefix()."PersistantSessionData SET VariableValue='$variableValue' WHERE VariableName='$variableName' AND PortalUserId=$userid";
}
else
$sql = "INSERT INTO ".GetTablePrefix()."PersistantSessionData (VariableName,VariableValue,PortalUserId) VALUES ('$variableName','$variableValue',$userid)";
}
else
$sql = "DELETE FROM ".GetTablePrefix()."PersistantSessionData WHERE VariableName='$variableName' AND PortalUserId=$userid";
$this->Vars[$variableName] = $variableValue;
// echo "<BR>SQL: $sql<BR>";
$this->adodbConnection->Execute($sql);
}
function GetPersistantVariable($variableName)
{
global $objConfig;
if(!$this->VarsLoaded)
$this->LoadPersistantVars();
$fields = array_keys($this->Vars);
if(in_array($variableName,$fields))
{
$val = $this->Vars[$variableName];
}
else
$val = $objConfig->Get($variableName);
return $val;
}
function GetAllPersistantVars()
{
if(!$this->VarsLoaded)
$this->LoadPersistantVars();
return $this->Vars;
}
function GetIcon()
{
}
function StatusIcon()
{
global $imagesURL;
$url = $imagesURL."/itemicons/icon16_user";
if($this->Get("Status")==0)
{
$url .= "_disabled";
}
else
if($this->Get("Status")==2)
{
$url .= "_pending";
}
$url .= ".gif";
return $url;
}
function IsFriend($UserId)
{
$ftable = GetTablePrefix()."Favorites";
$sql = "SELECT count(*) as FriendCount FROM $ftable WHERE PortalUserId=$UserId AND ResourceId=";
$sql .=$this->Get("ResourceId")." AND ItemTypeId=6";
$rs = $this->adodbConnection->Execute($sql);
if($rs && !$rs->EOF)
return ($rs->fields["FriendCount"]>0);
return FALSE;
}
function GetUserTime($timestamp)
{
if(is_numeric($this->Get("tz")))
{
return GetLocalTime($timestamp,$this->Get("tz"));
}
else
return GetLocalTime($timestamp);
}
function ParseObject($element)
{
global $objConfig, $objUsers, $objCatList,$objSession, $var_list_update, $var_list, $m_var_list_update;
//echo "<PRE>"; print_r($element); echo "</pre>";
if (strtolower($element->name) == 'touser') {
$this->TagPrefix = "touser";
}
$extra_attribs = ExtraAttributes($element->attributes);
if(strtolower($element->name)==$this->TagPrefix)
{
$field = strtolower($element->attributes["_field"]);
if(substr($field,0,3)=="pp_")
{
$perm = $objSession->GetPersistantVariable($field);
if($perm)
{
$field = substr($field,3);
}
else
$field = "";
}
switch($field)
{
/*
@field:user.login
@description:User's login name
*/
case "username":
case "login":
$ret = $this->Get("Login");
break;
case "firstname":
$ret = $this->Get("FirstName");
break;
case "lastname":
$ret = $this->Get("LastName");
break;
case "password":
/*
@field:user.password
@description:User password
*/
- $ret = $this->Get("Password");
+ $ret = $objSession->Get("password");
+ $objSession->Set("password", '');
break;
case "email":
$ret = $this->Get("Email");
break;
case "street":
$ret = $this->Get("Street");
break;
case "city":
$ret = $this->Get("City");
break;
case "state":
$ret = $this->Get("State");
break;
case "zip":
$ret = $this->Get("Zip");
break;
case "phone":
$ret = $this->Get("Phone");
break;
case "country":
$ret = $this->Get("Country");
break;
case "primarygroup":
/*
@field:user.primarygroup
@description:Parses a field from the user's primary group
@attrib:_groupfield::group field name to parse, defaults to group name
*/
$groupfield = $element->attributes["_groupfield"];
if(!strlen($groupfield))
$groupfield="Name";
$ret = $this->PrimaryGroup($groupfield);
break;
case "date":
/*
@field:user.date
@description:Returns the date/time the user was created
@attrib:_tz:bool:Convert the date to the user's local time
@attrib:_part::Returns part of the date. The following options are available: month,day,year,time_24hr,time_12hr
*/
$d = $this->Get("CreatedOn");
if($element->attributes["_tz"])
{
$d = GetLocalTime($d,$objSession->Get("tz"));
}
$part = strtolower($element->attributes["_part"]);
if(strlen($part))
{
$ret = ExtractDatePart($part,$d);
}
else
{
if($d<=0)
{
$ret = "";
}
else
$ret = LangDate($d);
}
break;
case "dob":
/*
@field:user.dob
@description:Returns the date/time of the users date of birth
@attrib:_tz:bool:Convert the date to the user's local time
@attrib:_part::Returns part of the date. The following options are available: month,day,year,time_24hr,time_12hr
*/
$d = $this->Get("dob");
if($element->attributes["_tz"])
{
$d = GetLocalTime($d,$objSession->Get("tz"));
}
$part = strtolower($element->attributes["_part"]);
if(strlen($part))
{
$ret = ExtractDatePart($part,$d);
}
else
{
if($d<=0)
{
$ret = "";
}
else
$ret = LangDate($d);
}
break;
case "modified":
/*
@field:user.modified
@description:Returns the date/time the user was last modified
@attrib:_tz:bool:Convert the date to the user's local time
@attrib:_part::Returns part of the date. The following options are available: month,day,year,time_24hr,time_12hr
*/
$d = $this->Get("Modified");
if($d<=0)
$d = $this->Get("CreatedOn");
if($element->attributes["_tz"])
{
$d = GetLocalTime($d,$objSession->Get("tz"));
}
$part = strtolower($element->attributes["_part"]);
if(strlen($part))
{
$ret = ExtractDatePart($part,$d);
}
else
{
if($d<=0)
{
$ret = "";
}
else
$ret = LangDate($d);
}
break;
case "profile_link":
/*
@field:user.profile_link
@description:Create a link to the user's profile
@attrib:_template:tpl:template the link should point to
*/
$t = $element->attributes["_template"];
if(strlen($t))
{
$var_list_update["t"] = $t;
}
else
$var_list_update["t"] = $var_list["t"];
$ret = GetIndexURL()."?env=" . BuildEnv()."&UserId=".$this->Get("PortalUserId");
break;
case "add_friend_link":
/*
@field:user.add_friend_link
@description:link to add a user to the friends list
@attrib:_template:tpl:Template link shoukd point to
*/
if($element->attributes["_force"] || !$this->IsFriend($objSession->Get("PortalUserId")) &&
$this->Get("PortalUserId") != $objSession->Get("PortalUserId"))
{
$t = $element->attributes["_template"];
if(strlen($t))
{
$var_list_update["t"] = $t;
}
else
$var_list_update["t"] = $var_list["t"];
$action = "m_add_friend";
$ret = GetIndexURL()."?env=" . BuildEnv()."&Action=".$action."&UserId=".$this->Get("PortalUserId");
}
else
$ret = "";
break;
case "del_friend_link":
/*
@field:user.del_friend_link
@description:link to remove a user from the friends list
@attrib:_template:tpl:Template link shoukd point to
*/
if($element->attributes["_force"] || $this->IsFriend($objSession->Get("PortalUserId")) &&
$this->Get("PortalUserId") != $objSession->Get("PortalUserId"))
{
$t = $element->attributes["_template"];
if(strlen($t))
{
$var_list_update["t"] = $t;
}
else
$var_list_update["t"] = $var_list["t"];
$action = "m_del_friend";
$ret = GetIndexURL()."?env=" . BuildEnv()."&Action=".$action."&UserId=".$this->Get("PortalUserId");
}
else
$ret = "";
break;
case "icon":
$ret = $this->GetIcon();
break;
case "image":
/*
@field:user.image
@description:Return an image associated with the user
@attrib:_default:bool:If true, will return the default image if the requested image does not exist
@attrib:_name::Return the image with this name
@attrib:_thumbnail:bool:If true, return the thumbnail version of the image
@attrib:_imagetag:bool:If true, returns a complete image tag. exta html attributes are passed to the image tag
*/
$default = $element->attributes["_primary"];
$name = $element->attributes["_name"];
if(strlen($name))
{
$img = $this->GetImageByName($name);
// echo "<PRE>";print_r($img); echo "</PRE>";
}
else
{
if($default)
$img = $this->GetDefaultImage();
}
if($img)
{
if($element->attributes["_thumbnail"])
{
$url = $img->parsetag("thumb_url");
}
else
$url = $img->parsetag("image_url");
}
else
{
$url = $element->attributes["_defaulturl"];
}
if($element->attributes["_imagetag"])
{
if(strlen($url))
{
$ret = "<IMG src=\"$url\" $extra_attribs >";
}
else
$ret = "";
}
else
$ret = $url;
break;
case "custom":
/*
@field:cat.custom
@description:Returns a custom field
@attrib:_customfield::field name to return
@attrib:_default::default value
*/
$field = $element->attributes["_customfield"];
$default = $element->attributes["
"];
$ret = $this->GetPersistantVariable($field);
if(!strlen($ret))
$ret = $this->GetCustomFieldValue($field,$default);
break;
}
}
else
{
$ret = $this->parsetag($element->name);
}
return $ret;
}
function parsetag($tag)
{
global $m_var_list_update, $var_list_update, $var_list, $objConfig;
if(is_object($tag))
{
$tagname = $tag->name;
}
else
$tagname = $tag;
switch($tagname)
{
case "user_id":
return $this->Get("ResourceId");
break;
case "user_login":
return $this->Get("Login");
break;
case "user_group":
return $this->Get("PrimaryGroupName");
break;
case "user_firstname":
return $this->Get("FirstName");
break;
case "user_lastname":
return $this->Get("LastName");
break;
case "user_email":
return $this->Get("Email");
break;
case "user_date":
return LangDate($this->Get("CreatedOn"));
break;
case "user_datetime":
return LangDate($this->Get("CreatedOn"))." ".LangTime($this->Get("CreatedOn"));
break;
case "user_dob":
return LangDate($this->Get("dob"));
break;
case "user_password":
return $this->Get("Password");
break;
case "user_phone":
return $this->Get("Phone");
break;
case "user_street":
return $this->Get("Street");
break;
case "user_city":
return $this->Get("City");
break;
case "user_state":
return $this->Get("State");
break;
case "user_zip":
return $this->Get("Zip");
break;
case "user_country":
return $this->Get("Country");
break;
case "user_resourceid":
return $this->Get("ResourceId");
break;
case "user_icon":
return $this->GetIcon();
break;
case "user_profile_link":
$var_list_update["t"] = "user_profile";
$m_var_list_update["action"] = $this->Get("UserId");
$ret = GetIndexURL()."?env=" . BuildEnv();
unset($m_var_list_update["action"], $var_list_update["t"]);
return $ret;
break;
case "user_messages":
return $this->NewMessages();
break;
case "user_messages_link":
$var_list_update["t"] = "inbulletin/bb_private_msg_list";
return GetIndexURL()."?env=" . BuildEnv();
unset($var_list_update);
break;
default:
return "Undefined:$tagname";
break;
}
}
} /* class clsPortalUser*/
class clsUserManager extends clsItemList //clsItemCollection
{
/*this class wraps common user-related functions */
// var $Page;
function clsUserManager()
{
$this->clsItemCollection(); // clsItemList() // need to use this, but double limit clause being created (normal+default 0,100)
$this->classname = "clsPortalUser";
$this->SetTable('live', GetTablePrefix().'PortalUser');
$this->Page = isset($_GET['lpn']) ? $_GET['lpn'] : 1;
$this->EnablePaging = true;
$this->PerPageVar = "Perpage_User";
$this->AdminSearchFields = array("Login","FirstName","LastName","Email","Street","City", "State","Zip","Country","Phone");
}
function GetPageLinkList($dest_template=NULL,$link_template=NULL,$page = "")
{
global $objConfig, $m_var_list_update, $var_list_update, $var_list;
if(!strlen($page))
$page = GetIndexURL();
$NumPages = $this->GetNumPages($objConfig->Get("Perpage_Topics"));
if(strlen($dest_template)>0)
{
$var_list_update["t"]=$dest_template;
}
else
{
$var_list_update["t"] = $var_list["t"];
}
$o = "";
if($this->Page>1)
{
$m_var_list_update["p"]=$this->Page-1;
$prev_url = $page."?env=".BuildEnv();
}
if($this->Page<$NumPages)
{
$m_var_list_update["p"]=$this->Page+1;
$next_url = $page."?env=".BuildEnv();
}
for($p=1;$p<=$NumPages;$p++)
{
$t = template($link_template);
if($p!=$this->Page)
{
$m_var_list_update["p"]=$p;
$href = $page."?env=".BuildEnv();
$t = str_replace("<%page_link%>", $href, $t);
$t = str_replace("<%page_number%>",$p,$t);
$t = str_replace("<%prev_url%>",$prev_url,$t);
$t = str_replace("<%next_url%>",$next_url,$t);
$o .= $t;
}
else
{
$o .= "<SPAN class=\"CURRENT_PAGE\">$p</SPAN>";
}
}
return $o;
}
function GetUser($ID)
{
$u = $this->GetItem($ID);
return $u;
}
function GetUserName($Id)
{
$rs = $this->adodbConnection->Execute("SELECT Login from ".$this->SourceTable." where PortalUserId=$Id");
return $rs->fields["Login"];
}
function GetUserId($Login)
{
$rs = $this->adodbConnection->Execute("SELECT PortalUserId from ".$this->SourceTable." where Login LIKE '$Login'");
return $rs->fields["PortalUserId"];
}
function GetTotalUsers()
{
return $this->UserCount("1");
}
function GetLatestUser()
{
global $Errors;
$sql = "SELECT max(CreatedOn) as LastDate FROM ".$this->SourceTable;
$result = $this->adodbConnection->Execute($sql);
if ($result === false || !is_object($result))
{
$Errors->AddError("error.DatabaseError",NULL,$adodbConnection->ErrorMsg(),"",get_class($this),"GetLatestUser");
return false;
}
$sql = "SELECT PortalUserId FROM ".$this->SourceTable." WHERE CreatedOn >= ".$result->fields["LastDate"];
$result = $this->adodbConnection->Execute($sql);
if (!rs || $rs->EOF)
{
$Errors->AddError("error.DatabaseError",NULL,$adodbConnection->ErrorMsg(),"",get_class($this),"GetLatestUser");
return false;
}
$u = $this->GetUser($result->fields["PortalUserId"]);
return $u;
}
function &Add_User($Login, $Password, $Email, $CreatedOn, $FirstName="", $LastName="", $Status=2,
$Phone="", $Street="", $City="", $State="", $Zip="", $Country="", $dob=0, $ip="", $CheckBanned=FALSE)
{
$u = new clsPortalUser(NULL);
$u->tablename = $this->SourceTable;
//echo "Creating User..<br>\n";
$u->Set(array("Login", "Password", "FirstName", "LastName", "Email", "Status",
"Phone","Street", "City", "State", "Zip", "Country", "CreatedOn","dob"),
array($Login, $Password, $FirstName, $LastName, $Email, $Status,
$Phone, $Street, $City, $State, $Zip, $Country, $CreatedOn, $dob));
$BrokenRule = $CheckBanned ? $u->CheckBanned() : false;
if(!$BrokenRule)
{
$u->Create();
return $u;
}
return $BrokenRule;
/*md5($Password)*/
}
function &Edit_User($UserId, $Login, $Password, $Email, $CreatedOn, $FirstName="", $LastName="",
$Status=2, $Phone="", $Street="", $City="", $State="", $Zip="", $Country="", $dob=0)
{
//echo "<font color=\"red\">Editing User: [$UserId]</font><br>";
$u =& $this->GetItem($UserId);
if(!$CreatedOn)
$CreatedOn = $u->Get("CreatedOn");
// $u->debuglevel=1;
if (is_object($u))
{
$IsBanned = $u->Get('IsBanned');
if($Status == 1) $IsBanned = 0;
$u->Set(array("Login", "FirstName", "LastName", "Email", "Status",
"Phone", "Street", "City", "State", "Zip", "Country", "CreatedOn","dob","IsBanned"),
array($Login, $FirstName, $LastName, $Email, $Status,
$Phone, $Street, $City, $State, $Zip, $Country, $CreatedOn,$dob,$IsBanned));
if(strlen($Password))
$u->Set("Password",$Password);
$u->Update();
}
return $u;
}
function Delete_User($UserId)
{
$u = $this->GetItemByField("ResourceId",$UserId);
if(is_object($u))
{
$u->RemoveFromAllGroups();
$u->Delete();
}
}
function LoadUsers($where = "",$orderBy = "")
{
global $objConfig;
$this->Clear();
if($this->Page<1)
$this->Page=1;
if(is_numeric($objConfig->Get("Perpage_Users")))
{
$Start = ($this->Page-1)*$objConfig->Get("Perpage_Users");
$limit = "LIMIT ".$Start.",".$objConfig->Get("Perpage_Users");
}
else
$limit = NULL;
$where = trim($where);
$orderBy = trim($orderBy);
if(!strlen($where))
$where = "1";
$this->QueryItemCount=TableCount($this->SourceTable,$where,0);
if($this->QueryItemCount>0)
{
if ($orderBy!="")
{
$this->Query_PortalUser($where,$orderBy,$limit);
}
else
{
$this->Query_PortalUser($where,"Login DESC",$limit);
}
}
}
function Query_PortalUser($whereClause,$orderByClause="", $limitClause="")
{
global $m_var_list,$Errors, $objSession;
$resultSet = array();
$utable = $this->SourceTable;
$gtable = GetTablePrefix()."UserGroup";
$sql = "SELECT * FROM $utable LEFT JOIN $gtable ON ($utable.PortalUserId=$gtable.PortalUserId)";
if(isset($whereClause))
$sql = sprintf('%s WHERE %s',$sql,$whereClause);
if(isset($orderByClause))
if(strlen(trim($orderByClause))>0)
$sql = sprintf('%s ORDER BY %s',$sql,$orderByClause);
if(isset($limitClause))
$sql = sprintf('%s %s',$sql,$limitClause);
return $this->Query_Item($sql);
}
function Query_GroupPortalUser($whereClause,$orderByClause)
{
global $m_var_list,$objSession,$Errors;
$resultSet = array();
$table = $this->SourceTable;
$sql = "SELECT * FROM $table LEFT JOIN ".GetTablePrefix()."UserGroup USING (PortalUserId) ";
if(isset($whereClause))
$sql = sprintf('%s WHERE %s',$sql,$whereClause);
if(isset($orderByClause))
$sql = sprintf('%s ORDER BY %s',$sql,$orderByClause);
return $this->query_item($sql);
}
function UserCount($whereClause)
{
$count = TableCount($this->SourceTable,$whereClause,0);
return $count;
}
function CountActive()
{
return $this->UserCount("Status=1");
}
function CountPending()
{
return $this->UserCount("Status=2");
}
function CountDisabled()
{
return $this->UserCount("Status=0");
}
function CopyFromEditTable($idfield)
{
global $objSession;
$edit_table = $objSession->GetEditTable($this->SourceTable);
$sql = "SELECT * FROM $edit_table";
$rs = $this->adodbConnection->Execute($sql);
// echo $sql."<BR>";
while($rs && !$rs->EOF)
{
$data = $rs->fields;
$c = new $this->classname;
$c->SetFromArray($data);
$c->idfield = $idfield;
$c->Dirty();
if($c->Get($idfield)<1)
{
$old_id = $c->Get($idfield);
$c->UnsetIdField();
$c->Create();
$sql = "UPDATE ".GetTablePrefix()."UserGroup SET PortalUserId=".$c->Get("PortalUserId");
$sql .=" WHERE PortalUserId=0";
$this->adodbConnection->Execute($sql);
}
else
$c->Update();
unset($c);
$rs->MoveNext();
}
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
}
function PurgeEditTable()
{
parent::PurgeEditTable();
$sql = "DELETE FROM ".GetTablePrefix()."UserGroup WHERE PortalUserId=0";
$this->adodbConnection->Execute($sql);
}
} /*clsUserManager*/
?>
Property changes on: trunk/kernel/include/portaluser.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.10
\ No newline at end of property
+1.11
\ No newline at end of property
Index: trunk/kernel/include/portalgroup.php
===================================================================
--- trunk/kernel/include/portalgroup.php (revision 401)
+++ trunk/kernel/include/portalgroup.php (revision 402)
@@ -1,497 +1,500 @@
<?php
class clsPortalGroup extends clsParsedItem
{
var $UserCount;
function clsPortalGroup($GroupId=NULL)
{
$this->clsParsedItem($GroupId);
$this->tablename=GetTablePrefix()."PortalGroup";
$this->type=7;
$this->BasePermission="GROUP";
$this->id_field = "GroupId";
if($GroupId)
$this->LoadFromDatabase($GroupId);
}
function Validate()
{
global $objSession, $Errors;
$dataValid = true;
if(!isset($this->m_Name) || $this->m_Name == "")
{
$Errors->AddError("error.fieldIsRequired",'Login',"","",get_class($this),"Validate");
$dataValid = false;
}
return $dataValid;
}
function HasSystemPermission($PermissionName)
{
$GroupId = $this->Get("GroupId");
$sql = "SELECT * FROM ".GetTablePrefix()."Permissions WHERE GroupId=$GroupId AND Permission='$PermissionName' AND type=1";
$result = $this->adodbConnection->Execute($sql);
if($result && !$result->EOF)
{
$this->SysPermCache[$PermissionName] = (int)$result->fields["PermissionValue"];
return (int)$result->fields["PermissionValue"];
}
else
return -1;
}
/* set $Value to -1 to delete the permission row from the DB */
function SetSystemPermission($PermName,$Value)
{
//echo "Setting $PermName to $Value<br>\n";
$oldval = $this->HasSystemPermission($PermName);
if($Value != $oldval)
{
if($Value>-1)
{
if($oldval>-1)
{
$sql = "UPDATE ".GetTablePrefix()."Permissions SET PermissionValue=$Value ";
$sql .=" WHERE Type=1 AND Permission='$PermName' AND GroupId=".$this->Get("GroupId");
+
+ //echo "UPDATE SQL: $sql<br>";
}
else
{
$sql = "INSERT INTO ".GetTablePrefix()."Permissions (Permission, GroupId, PermissionValue, Type, CatId) ";
$sql .="VALUES ('$PermName',".$this->Get("GroupId").",$Value,1,0)";
+ //echo "INSERT SQL: $sql<br>";
}
$this->adodbConnection->Execute($sql);
//echo $sql."<br>\n";
}
else
{
$sql = "DELETE FROM ".GetTablePrefix()."Permissions ";
$sql .=" WHERE Type=1 AND Permission='$PermName' AND GroupId=".$this->Get("GroupId");
+ //echo "DELETE SQL: $sql<br>";
$this->adodbConnection->Execute($sql);
- //echo $sql."<br>\n";
}
}
}
function CheckPermission($permissionName)
{
//Check permission and if needs approval set approval
global $objSession, $Errors;
if(!$objSession->HasSystemPermission($permissionName))
{
//$Errors->AddError("error.AccessDenied","","","",get_class($this),"CheckPermission");
return false;
}
return true;
}
function LoadFromDatabase($Id)
{
global $Errors;
if(!isset($Id))
{
$Errors->AddError("error.AppError",NULL,'Internal error: LoadFromDatabase id',"",get_class($this),"LoadFromDatabase");
return false;
}
$sql = "SELECT * FROM ".$this->tablename." WHERE GroupId = $Id";
$result = $this->adodbConnection->Execute($sql);
if ($result === false)
{
$Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"LoadFromDatabase");
return false;
}
$data = $result->fields;
$this->SetFromArray($data);
$this->Clean();
return true;
}
function AddUser($UserId,$PrimaryGroup=0)
{
// add user to group OR just updates it's status there
$db =& $this->adodbConnection;
$table = GetTablePrefix().'UserGroup';
$group_id = $this->Get('GroupId');
$sql_patterns['check'] = 'SELECT PortalUserId FROM %s WHERE GroupId = %s AND PortalUserId = %s';
$sql_patterns['reset_primary'] = 'UPDATE %s SET PrimaryGroup = 0 WHERE PortalUserId = %s';
$sql_patterns['set_primary'] = 'UPDATE %s SET PrimaryGroup = 1 WHERE GroupId = %s AND PortalUserId = %s';
$sql_patterns['add_to_group'] = 'INSERT INTO %s (PortalUserId,GroupId,PrimaryGroup) VALUES (%s, %s, %s)';
$tmp_sql = sprintf($sql_patterns['check'], $table, $group_id, $UserId);
$check_result = $db->GetOne($tmp_sql);
if(!$check_result)
{
// user is not a memeber of this group
$GroupCount = TableCount($table,"PortalUserId = $UserId", 0);
if(!$PrimaryGroup) $PrimaryGroup = ($GroupCount == 0) ? 1 : 0; // reset primary status if not already
$tmp_sql = sprintf($sql_patterns['add_to_group'], $table, $UserId, $group_id, $PrimaryGroup);
$db->Execute($tmp_sql);
}
if($PrimaryGroup)
{
$tmp_sql = sprintf($sql_patterns['reset_primary'], $table, $UserId);
$db->Execute($tmp_sql);
$tmp_sql = sprintf($sql_patterns['set_primary'], $table, $group_id, $UserId);
$db->Execute($tmp_sql);
}
}
function DeleteUser($UserId)
{
$sql = "DELETE FROM ".GetTablePrefix()."UserGroup WHERE PortalUserId=$UserId AND GroupId=".$this->Get("GroupId");
$this->adodbConnection->Execute($sql);
}
function GetCustomField( $fieldName)
{
global $Errors;
if(!isset($this->m_UserId))
{
$Errors->AddError("error.AppError",NULL,"Get field is required in order to set custom field values","","clsPortalGroup","GetCustomField");
return false;
}
return GetCustomFieldValue($this->m_UserId,"portaluser",$fieldName);
}
function SetCustomField( $fieldName, $value)
{
global $Errors;
if(!isset($this->m_UserId))
{
$Errors->AddError("error.AppError",NULL,"Set field is required in order to set custom field values","","clsPortalGroup","SetCustomField");
return false;
}
return SetCustomFieldValue($this->m_UserId,"portaluser",$fieldName,$value);
}
function GetUserCount()
{
if(!is_numeric($this->UserCount))
{
$sql = "SELECT count(*) as UserCount FROM ".GetTablePrefix()."UserGroup WHERE GroupId=".$this->Get("GroupId");
$rs = $this->adodbConnection->Execute($sql);
if($rs && !$rs->EOF)
$users = $rs->fields["UserCount"];
$this->UserCount = (int)$users;
}
return $this->UserCount;
}
function GetUserList()
{
$sql = "SELECT * FROM ".GetTablePrefix()."UserGroup WHERE GroupId=".$this->Get("GroupId");
$rs = $this->adodbConnection->Execute($sql);
$res = array();
while($rs && !$rs->EOF)
{
$res[] = $rs->fields["PortalUserId"];
$rs->MoveNext();
}
return $res;
}
function parsetag($tag)
{
global $var_list_update, $objConfig;
if(is_object($tag))
{
$tagname = $tag->name;
}
else
$tagname = $tag;
switch($tagname)
{
case "group_id":
return $this->Get("GroupId");
break;
case "group_name":
return $this->Get("Name");
break;
case "group_desc":
return $this->Get("Description");
break;
case "group_date":
return LangDate($this->Get("CreatedOn"));
break;
case "group_name":
return $this->Get("Name");
break;
case "group_enabled":
return $this->Get("Enabled");
break;
case "group_date_month":
return adodb_date("m", $this->Get("CreatedOn"));
break;
case "group_date_day":
return adodb_date("d", $this->Get("CreatedOn"));
break;
case "group_date_year":
return adodb_date("Y", $this->Get("CreatedOn"));
break;
case "group_system":
if ($this->Get("System") == 1)
return "System";
else
return "User Defined";
break;
case "group_status":
if ($this->Get("Enabled") == 1)
return "Enabled";
else
return "Disabled";
break;
default:
if (substr($tag, 0, 6) == "custom")
return Users_Custom($this->Get("ResourceId"), $tag);
else
return "Undefined:$tagname";
break;
}
}
}
class clsGroupList extends clsItemCollection
{
var $Page;
function clsGroupList()
{
$this->clsItemCollection();
$this->classname = "clsPortalGroup";
$this->SetTable('live', GetTablePrefix()."PortalGroup");
$this->AdminSearchFields = array("name");
$this->id_field = "GroupId";
}
function NumGroups()
{
return $this->NumItems();
}
function GetGroup($GroupID)
{
return $this->GetItem($GroupID);
}
function GetPersonalGroup($UserLogin)
{
$n = "_".$UserLogin;
$g = $this->GetItemByField("Name",$n);
return $g;
}
function LoadGroups($where = "",$orderBy = "")
{
global $objConfig;
$this->Clear();
if($this->Page<1)
$this->Page=1;
if(is_numeric($objConfig->Get("Perpage_Groups")))
{
$Start = ($this->Page-1)*$objConfig->Get("Perpage_Groups");
$limit = "LIMIT ".$Start.",".$objConfig->Get("Perpage_Groups");
}
else
$limit = NULL;
if(strlen($where) == 0) $where = '1';
$this->QueryItemCount=TableCount($this->SourceTable, $where, 0);
//echo $this->QueryItemCount."<br>\n";
if ($orderBy!="")
{
$this->Query_PortalGroup($where,$orderBy,$limit);
}
else
{
$this->Query_PortalGroup($where,"Name DESC",$limit);
}
}
function Query_PortalGroup($whereClause=NULL,$orderByClause=NULL,$limit=null)
{
global $m_var_list,$objSession,$Errors;
$sql = "SELECT * FROM ".$this->SourceTable." ";
if(strlen($whereClause))
$sql = sprintf('%s WHERE %s',$sql,$whereClause);
if(strlen($orderByClause))
if(strlen(trim($orderByClause)))
$sql = sprintf('%s ORDER BY %s',$sql,$orderByClause);
if( isset($limit) ) $sql .= ' '.$limit;
return $this->Query_Item($sql);
}
function Query_UserPortalGroup($whereClause,$orderByClause)
{
global $m_var_list,$objSession,$Errors;
if ($m_var_list["action"] == "m_group_search")
$table = $userSession->Get("SessionKey") . "_search";
else
$table = $this->SourceTable;
$sql = "SELECT * FROM $table LEFT JOIN UserGroup USING (GroupId) ";
if(isset($whereClause))
$sql = sprintf('%s WHERE %s',$sql,$whereClause);
if(isset($orderByClause))
if (strlen(trim($orderByClause)))
{
$sql = sprintf('%s ORDER BY %s',$sql,$orderByClause);
}
$result = $this->adodbConnection->Execute($sql);
return $this->Query_Item($sql);
}
function GetAllGroupList()
{
static $GroupListCache;
if(!is_array($GroupListCache))
{
$GroupListCache = array();
$sql = "SELECT GroupId FROM ".$this->SourceTable." WHERE Enabled=1";
$rs = $this->adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$GroupListCache[] = $rs->fields["GroupId"];
$rs->MoveNext();
}
}
return $GroupListCache;
}
function Group_Custom($ResourceId, $tag)
{
$fieldname= substr($tag, 7);
$sql = "SELECT Value FROM ".GetTablePrefix()."CustomMetaData LEFT JOIN ".GetTablePrefix()."CustomField USING (CustomFieldId) where ".GetTablePrefix()."CustomMetaData.ResourceId=$ResourceId AND ".GetTablePrefix()."CustomField.FieldName='$fieldname'";
$result = $this->adodbConnection->Execute($sql);
if ($result->EOF)
return "";
else
return $result->fields["Value"];
}
function Add_Users_To_Group($groupid)
{
global $g_usergroup_status;
$userids = explode("-", $g_usergroup_status);
$g = $this->GetItem($groupid);
foreach($userids as $userid)
$g->AddUser($userid);
}
function Delete_Group($GroupId)
{
$g = $this->GetItem($GroupId);
if(is_object($g))
{
$g->Delete();
}
}
function Edit_Group($GroupId, $Name, $Description)
{
$g = $this->GetItem($GroupId);
$g->Set(array("Name", "Description"), array($Name, $Description));
$g->Update();
return $g;
}
function Add_Group($Name, $Description, $System=1)
{
$g = new clsPortalGroup(NULL);
$g->tablename = $this->SourceTable;
$g->Set(array("Name", "Description", "System"),array($Name, $Description,$System));
$g->Set("CreatedOn",adodb_date("U"));
$g->Create();
return $g;
}
function CopyFromEditTable($idfield)
{
global $objSession;
$edit_table = $objSession->GetEditTable($this->SourceTable);
$sql = "SELECT * FROM $edit_table";
$rs = $this->adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$data = $rs->fields;
$c = new $this->classname;
$c->SetFromArray($data);
$c->idfield = $idfield;
$c->Dirty();
if($c->Get($idfield)<1)
{
$old_id = $c->Get($idfield);
$c->UnsetIdField();
if(!is_numeric($c->Get("OrgId")))
$c->Clean(array("OrgId"));
$c->Create();
$sql = "UPDATE ".GetTablePrefix()."UserGroup SET GroupId=".$c->Get("GroupId")." WHERE GroupId=$old_id";
$this->adodbConnection->Execute($sql);
$sql = "UPDATE ".GetTablePrefix()."Permissions SET GroupId=".$c->Get("GroupId")." WHERE GroupId=$old_id";
$this->adodbConnection->Execute($sql);
}
$c->Update();
unset($c);
unset($r);
$rs->MoveNext();
}
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
}
function PurgeEditTable($idfield)
{
global $objSession;
$edit_table = $objSession->GetEditTable($this->SourceTable);
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
$sql = "DELETE FROM ".GetTablePrefix()."UserGroup WHERE GroupId<1";
$this->adodbConnection->Execute($sql);
$sql = "DELETE FROM ".GetTablePrefix()."Permissions WHERE GroupId<1";
$this->adodbConnection->Execute($sql);
}
}
/*
class clsUserGroupList extends clsItemCollection
{
function clsUserGroupList()
{
$this->clsItemCollection();
$this->classname = "clsPortalGroup";
$this->SetTable('live', GetTablePrefix()."UserGroup");
$this->id_field = "PortalUserId"; // don't try to insert by this ID :)
}
}
*/
?>
Property changes on: trunk/kernel/include/portalgroup.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Index: trunk/kernel/include/usersession.php
===================================================================
--- trunk/kernel/include/usersession.php (revision 401)
+++ trunk/kernel/include/usersession.php (revision 402)
@@ -1,1130 +1,1130 @@
<?php
class clsUserSession
{
//Common DB operation class variables
var $m_dirtyFieldsMap = array();
//Identity
var $m_SessionKey;
var $m_CurrentTempKey;
var $m_PrevTempKey;
//Required attributes
var $m_LastAccessed;
var $m_PortalUserId;
var $m_Language;
var $m_Theme;
var $m_GroupId;
var $adodbConnection;
var $m_Errors;
var $m_GroupList;
var $PermCache;
var $SysPermCache;
var $PermCacheGroups;
var $CurrentUser;
var $UseTempKeys;
function clsUserSession($id=NULL, $TempKeys=FALSE)
{
global $objConfig, $objLanguages, $objThemes, $m_var_list;
$this->m_Errors = new clsErrorManager();
$this->adodbConnection = GetADODBConnection();
$this->PermCache = array();
$this->PermCacheGroups ="";
$this->UseTempKeys = $TempKeys;
if( GetVar('help_usage') == 'install' ) return;
if(!$this->UseTempKeys || strlen($id)==0)
{
//echo "with cookies";
if( !isset($_SERVER['HTTP_REFERER']) ) $_SERVER['HTTP_REFERER'] = '';
if(!isset($_GET['destform'])) $_GET['destform'] = null;
if(!isset($_GET['continue_sess'])) $_GET['continue_sess'] = null;
- if( strlen($id) && (strstr($_SERVER['HTTP_REFERER'], $_SERVER['SERVER_NAME'].$objConfig->Get("Site_Path")) || $_GET['destform'] == 'popup' || $_GET['continue_sess'] == 1))
+ if( strlen($id) && (strstr($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'].$objConfig->Get("Site_Path")) || $_GET['destform'] == 'popup' || $_GET['continue_sess'] == 1))
{
$this->Set("SessionKey",$id);
return $this->LoadFromDatabase($id);
}
else
{
$this->Set("PortalUserId", 0);
$this->Set("Language", $objLanguages->GetPrimary());
$ThemeId = $m_var_list["theme"];
$this->SetThemeName($ThemeId);
//$this->Set("Theme", $objConfig->Get("Default_Theme"));
$this->Set("GroupList",0);
$this->Set("SessionKey","");
$this->Set("GroupList",$objConfig->Get("User_GuestGroup"));
}
}
else
{
//echo "without cookies";
return $this->LoadFromTempKey($id);
}
}
function CopyToNewSession()
{
$OldKey = $this->GetSessionKey();
$this->GetNewSession();
if($OldKey != $this->GetSessionKey())
{
$this->Set("PortalUserId",$this->Get("PortalUserId"));
$this->Set("GroupId",$this->Get("GroupId"));
$this->Set("GroupList",$this->Get("GroupList"));
$this->Set("Language",$this->Get("Language"));
$this->Set("tz",$this->Get("tz"));
$this->Set("LastAccessed",date("U"));
$this->Update();
}
}
function Get($name)
{
$var = "m_" . $name;
return isset($this->$var) ? $this->$var : '';
}
function Set($name, $value)
{
if (is_array($name))
{
for ($i=0; $i<sizeof($name); $i++)
{ $var = "m_" . $name[$i];
$this->$var = $value[$i];
$this->m_dirtyFieldsMap[$name[$i]] = $value[$i];
}
}
else
{
$var = "m_" . $name;
$this->$var = $value;
$this->m_dirtyFieldsMap[$name] = $value;
//echo "Set: $var = $value <br>\n";
}
}
function Validate()
{
$dataValid = true;
if(!isset($this->m_LastAccessed))
{
$this->m_Errors->AddError("error.fieldIsRequired",'LastAccessed',"","",get_class($this),"Validate");
$dataValid = false;
}
if(!isset($this->m_PortalUserId))
{
$this->m_Errors->AddError("error.fieldIsRequired",'PortalUserId',"","",get_class($this),"Validate");
$dataValid = false;
}
if(!isset($this->m_Language))
{
$this->m_Errors->AddError("error.fieldIsRequired",'Language',"","",get_class($this),"Validate");
$dataValid = false;
}
if(!isset($this->m_Theme))
{
$this->m_Errors->AddError("error.fieldIsRequired",'Theme',"","",get_class($this),"Validate");
$dataValid = false;
}
return $dataValid;
}
function Delete()
{
if(!isset($this->m_SessionKey))
{
$this->m_Errors->AddError("error.AppError",NULL,'Internal error: Delete requires set id',"",get_class($this),"Delete");
return false;
}
//Delete associated adata first
$sql = sprintf("DELETE FROM ".GetTablePrefix()."SessionData WHERE SessionKey = '%s'", $this->Get("SessionKey"));
$this->adodbConnection->Execute($sql);
$sql = sprintf("DROP TABLE IF EXISTS %s%s_search",GetTablePrefix(), $this->Get("SessionKey"));
$this->adodbConnection->Execute($sql);
$sql = sprintf("DELETE FROM ".GetTablePrefix()."UserSession WHERE SessionKey = '%s'", $this->Get("SessionKey"));
$this->adodbConnection->Execute($sql);
if ($this->adodbConnection->Execute($sql) === false)
{
$this->m_Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"Delete");
return false;
}
$this->Set("SessionKey","");
$this->Set("SessionDataLoaded",false);
return true;
}
function Update()
{
global $objConfig;
//$this->Set("LastAccessed",date("U"));
$this->Set("IpAddress",$_SERVER["REMOTE_ADDR"]);
if(!isset($this->m_SessionKey))
{
$this->m_Errors->AddError("error.AppError",NULL,'Internal error: Update requires set id',"",get_class($this),"Update");
return false;
}
if(!is_numeric($this->Get("PortalUserId")))
{
$this->Set("PortalUserId",0);
}
if(!strlen($this->Get("GroupList")))
{
$this->Set("GroupList",$objConfig->Get("User_GuestGroup"));
}
if(count($this->m_dirtyFieldsMap) == 0)
return true;
$sql = "UPDATE ".GetTablePrefix()."UserSession SET ";
$first = 1;
foreach ($this->m_dirtyFieldsMap as $key => $value)
{
if($first)
{
$sql = sprintf("%s %s=%s",$sql,$key,$this->adodbConnection->qstr($value));
$first = 0;
}
else
{
$sql = sprintf("%s, %s=%s",$sql,$key,$this->adodbConnection->qstr($value));
}
}
$sql = sprintf("%s WHERE SessionKey = '%s'",$sql, $this->Get("SessionKey"));
//echo $sql;
if ($this->adodbConnection->Execute($sql) === false)
{
$this->m_Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"Update");
return false;
}
return true;
}
function Create()
{
global $objConfig;
$this->Set("LastAccessed", time());
if(!is_numeric($this->Get("PortalUserId")))
{
$this->Set("PortalUserId",0);
}
if(!strlen($this->Get("GroupList")))
{
$this->Set("GroupList",$objConfig->Get("User_GuestGroup"));
}
$sql = "INSERT INTO ".GetTablePrefix()."UserSession (";
$first = 1;
foreach ($this->m_dirtyFieldsMap as $key => $value)
{
if($first)
{
$sql = sprintf("%s %s",$sql,$key);
$first = 0;
}
else
{
$sql = sprintf("%s, %s",$sql,$key);
}
}
$sql = sprintf('%s ) VALUES (',$sql);
$first = 1;
foreach ($this->m_dirtyFieldsMap as $key => $value)
{
if($first)
{
$sql = sprintf("%s %s",$sql,$this->adodbConnection->qstr($value));
$first = 0;
}
else
{
$sql = sprintf("%s, %s",$sql,$this->adodbConnection->qstr($value));
}
}
$sql = sprintf('%s)',$sql);
//echo $sql."<br>\n";
if ($this->adodbConnection->Execute($sql) === false)
{
$this->m_Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"Create");
return false;
}
return true;
}
function LoadFromTempKey($id=NULL)
{
global $objLanguages, $objConfig,$m_var_list;
$referer = $_SERVER["HTTP_REFERER"];
//echo "Referer: $referer <br>\n";
if(strlen($referer) && strpos($referer,"env="))
{
$keystart = strpos($referer,"env=")+4;
$referer = substr($referer,$keystart);
$keyend = strpos($referer,"-");
$LastKey = substr($referer,0,$keyend);
if(strlen($LastKey))
{
$sql = "SELECT * FROM ".GetTablePrefix()."UserSession WHERE (CurrentTempKey = '$id' OR PrevTempKey='$id' OR CurrentTempKey='$LastKey' OR PrevTempKey='$LastKey') ";
}
else
$sql = "SELECT * FROM ".GetTablePrefix()."UserSession WHERE CurrentTempKey = '$id' AND PrevTempKey IS NULL";
}
else
$sql = "SELECT * FROM ".GetTablePrefix()."UserSession WHERE CurrentTempKey = '$id' AND PrevTempKey IS NULL";
$result = $this->adodbConnection->Execute($sql);
if ($result === false)
{
$this->m_Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"LoadFromDatabase");
return false;
}
$data = $result->fields;
if (is_array($data))
{
foreach($data as $field => $value)
{
$mname = "m_" . $field;
$this->$mname = $data[$field];
}
if($this->Get("CurrentTempKey")) {
$this->Set("PrevTempKey",$this->Get("CurrentTempKey"));
$this->UseTempKeys=TRUE;
}
- if (!$this->Get("CurrentTempKey") || !strstr($_SERVER['HTTP_REFERER'], $_SERVER['SERVER_NAME'].$objConfig->Get("Site_Path"))) {
+ if (!$this->Get("CurrentTempKey") || !strstr($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'].$objConfig->Get("Site_Path"))) {
//$this->Set("PrevTempKey",$this->Get("CurrentTempKey"));
//$this->Set("CurrentTempKey",$this->GetUniqueKey());
$this->UseTempKeys=FALSE;
$this->Set("PortalUserId", 0);
$this->Set("Language", $objLanguages->GetPrimary());
$ThemeId = $m_var_list["theme"];
$this->SetThemeName($ThemeId);
//$this->Set("Theme", $objConfig->Get("Default_Theme"));
$this->Set("GroupList",0);
$this->Set("SessionKey","");
$this->Set("GroupList",$objConfig->Get("User_GuestGroup"));
}
//$this->UseTempKeys=TRUE;
$this->Update();
return true;
}
else
{
$this->Set("PortalUserId", 0);
$this->Set("Language", $objLanguages->GetPrimary());
$ThemeId = $m_var_list["theme"];
$this->SetThemeName($ThemeId);
//$this->Set("Theme", $objConfig->Get("Default_Theme"));
$this->Set("GroupList",0);
$this->Set("SessionKey","");
$this->Set("GroupList",$objConfig->Get("User_GuestGroup"));
$this->Set("CurrentTempKey",$this->GetUniqueKey());
return false;
}
}
function LoadFromDatabase($id)
{
if(!isset($id))
{
$this->m_Errors->AddError("error.AppError",NULL,'Internal error: LoadFromDatabase id',"",get_class($this),"LoadFromDatabase");
return false;
}
$sql = sprintf("SELECT * FROM ".GetTablePrefix()."UserSession WHERE SessionKey = '%s'",$id);
$result = $this->adodbConnection->Execute($sql);
if ($result === false)
{
$this->m_Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"LoadFromDatabase");
return false;
}
$data = $result->fields;
if (is_array($data))
{
foreach($data as $field => $value)
{
$mname = "m_" . $field;
$this->$mname = $data[$field];
}
return true;
}
else
{
return false;
}
}
function Login($userLogin, $userPassword)
{
global $expired, $objConfig;
if($userLogin == "root")
{
// logging in "root" (admin only)
$rootpass = $objConfig->Get("RootPass");
if($rootpass!=$userPassword)
{
return FALSE;
}
else
{
if(!strlen($this->GetSessionKey()))
$this->GetNewSession();
$this->Set("PortalUserId",-1);
$this->Update();
return TRUE;
}
}
else
{
// logging in any user (admin & front)
$pre = GetTablePrefix();
$sql = "SELECT *,MD5(".$pre."PortalUser.Password) as md5pw FROM ".$pre."PortalUser LEFT JOIN ".$pre."UserGroup USING (PortalUserId) "
."LEFT JOIN ".$pre."PortalGroup ON (".$pre."UserGroup.GroupId=".$pre."PortalGroup.GroupId)
WHERE
".$pre."PortalUser.Login='$userLogin' AND ".$pre."PortalUser.Status=1
AND (".$pre."PortalUser.Password='$userPassword' OR MD5(".$pre."PortalUser.Password)='$userPassword' OR ".$pre."PortalUser.Password='".md5($userPassword)."')
ORDER BY ".$pre."UserGroup.PrimaryGroup DESC, ".$pre."PortalGroup.Personal DESC";
//echo $sql."<br>\n";
$result = $this->adodbConnection->Execute($sql);
if ($result === false)
{
$this->m_Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"Login");
return false;
}
if($result->EOF)
return false;
}
if(!strlen($this->GetSessionKey()))
{
$this->GetNewSession();
}
$this->Set("PortalUserId", $result->fields["PortalUserId"]);
if(strlen($result->fields["tz"])>0)
$this->Set("tz",$result->fields["tz"]);
$PrimaryGroup=0;
$PersonalGroup=0;
$GroupList = array();
while($result && !$result->EOF)
{
$skipadd=0;
$g = $result->fields["GroupId"];
if($result->fields["PrimaryGroup"]==1)
{
$PrimaryGroup = $g;
$skipadd=1;
}
if($result->fields["Personal"]==1)
{
$PersonalGroup=$g;
$skipadd=0;
}
if(!$skipadd)
$GroupList[] = $g;
$result->MoveNext();
}
$extra_groups = implode(",",$GroupList);
if($PrimaryGroup)
$extra_groups = $PrimaryGroup.",".$extra_groups;
if($PersonalGroup)
{
$this->Set("GroupId",$PersonalGroup);
//$extra_groups .= ",".$PersonalGroup;
}
else
{
$this->Set("GroupId",$PrimaryGroup);
}
$this->Set("GroupList", $extra_groups);
$this->Set("LastAccessed",date("U"));
$this_login = $this->GetPersistantVariable("ThisLogin");
$this->SetPersistantVariable("LastLogin", $this_login);
$this->SetPersistantVariable("ThisLogin", time());
$this->ResetSysPermCache();
$this->PermCache = array();
$this->Update();
if($userLogin != 'root')
{
if( ! $this->HasSystemPermission('LOGIN') )
{
$this->Logout();
return false;
}
}
return true;
}
function Logout()
{
global $objConfig;
$this->Set("PortalUserId", 0);
$this->Set("GroupId", $objConfig->Get("User_GuestGroup"));
#$this->SetPersistantVariable("LastLogin", time());
$this->Set("GroupList",$objConfig->Get("User_GuestGroup"));
$this->Set("IpAddress",$_SERVER['REMOTE_ADDR']);
$this->DeleteSessionData($this->GetSessionKey());
$this->Update();
$this->Delete();
$this->ResetSysPermCache();
$this->PermCache = array();
}
function SetVariable( $variableName, $variableValue)
{
global $objConfig, $FrontEnd;
$objConfig->Set($variableName,$variableValue,2);
//if(!(int)$FrontEnd==1)
//{
$sessionkey = $this->GetSessionKey();
$sql = "SELECT * FROM ".GetTablePrefix()."SessionData WHERE VariableName='$variableName' AND SessionKey='$sessionkey'";
$rs = $this->adodbConnection->Execute($sql);
if($rs && !$rs->EOF)
{
$sql = "UPDATE ".GetTablePrefix()."SessionData SET VariableValue='$variableValue' WHERE VariableName='$variableName' AND SessionKey='$sessionkey'";
}
else
$sql = "INSERT INTO ".GetTablePrefix()."SessionData (VariableName,VariableValue,SessionKey) VALUES ('$variableName','$variableValue','$sessionkey')";
$this->adodbConnection->Execute($sql);
// echo "<BR>UPDATE: $sql<BR>";
//}
}
function SetPersistantVariable($variableName, $variableValue)
{
global $objConfig, $objUsers;
$userid = (int)$this->Get("PortalUserId");
if($userid > 0)
{
if(!is_object($this->CurrentUser))
$this->CurrentUser = $objUsers->GetItem($this->Get("PortalUserId"));
if(!$this->CurrentUser->VarsLoaded)
$this->CurrentUser->LoadPersistantVars();
//echo "setting current user' $variableName, $variableValue<br>";
$this->CurrentUser->SetPersistantVariable($variableName, $variableValue);
//$this->SetVariable($variableName,$variableValue);
}
else
$this->SetVariable($variableName,$variableValue);
}
function GetPersistantVariable($variableName)
{
global $objConfig, $objUsers;
if(is_numeric($this->Get("PortalUserId")))
{
if(!is_object($this->CurrentUser))
$this->CurrentUser = $objUsers->GetItem($this->Get("PortalUserId"));
if(!$this->CurrentUser->VarsLoaded)
$this->CurrentUser->LoadPersistantVars();
$val = $this->CurrentUser->GetPersistantVariable($variableName);
}
if(!strlen($val))
$val = $objConfig->Get($variableName);
return $val;
}
function GetVariable($variableName)
{
global $objConfig;
return $objConfig->Get($variableName);
}
function LoadSessionData()
{
global $objConfig, $objUsers;
if(is_numeric($this->Get("PortalUserId")))
{
$sql = "SELECT VariableName, VariableValue FROM ".GetTablePrefix()."SessionData where SessionKey='" . $this->Get("SessionKey") . "'";
//echo $sql."<br>\n";
$result = $this->adodbConnection->Execute($sql);
while ($result && !$result->EOF)
{
$data = $result->fields;
//echo "<PRE>"; print_r($data); echo "</PRE>";
$objConfig->Set($data["VariableName"],$data["VariableValue"],FALSE);
$result->MoveNext();
}
if(!is_object($this->CurrentUser))
$this->CurrentUser = $objUsers->GetItem($this->Get("PortalUserId"));
if(!$this->CurrentUser->VarsLoaded)
$this->CurrentUser->LoadPersistantVars();
}
if((int)$this->GetPersistantVariable("Language"))
$this->Set("Language",$objConfig->Get("Language"));
$this->DeleteExpiredSessions();
return true;
}
function DeleteSessionData($key)
{
$sql = "DELETE FROM ".GetTablePrefix()."SessionData WHERE SessionKey='$key'";
$this->adodbConnection->Execute($sql);
}
function SaveSessionData()
{
global $objConfig;
//echo "Saving Session Data..<br>\n";
if($this->SessionEnabled())
{
$data = $objConfig->GetDirtySessionValues(2); //session data
//echo "<PRE>"; print_r($data); echo "</PRE>";
$sessionkey = $this->GetSessionKey();
foreach($data as $field=>$value)
{
$sql = "UPDATE ".GetTablePrefix()."SessionData SET VariableValue='$value' WHERE VariableName='$field' AND SessionKey='$sessionkey'";
$this->adodbConnection->Execute($sql);
//echo $sql."<br>\n";
if($this->adodbConnection->Affected_Rows()==0)
{
$sql = "INSERT INTO ".GetTablePrefix()."SessionData (VariableName,VariableValue,SessionKey) VALUES ('$field','$value','$sessionkey')";
$this->adodbConnection->Execute($sql);
}
// echo $sql."<br>\n";
}
}
}
function DeleteEditTables()
{
$tables = $this->adodbConnection->MetaTables();
$sql = "SHOW TABLES";
//echo "<PRE>";print_r($tables); echo "</PRE>";
for($i=0;$i<count($tables);$i++)
{
$t = strtoupper($tables[$i]);
$p = strtoupper(GetTablePrefix()."ses_ad");
$k = substr($t,0,strlen($p));
if($k == $p && strpos($t,"FD_")>0)
{
$key = "AD".strtoupper(substr($t,strlen($p),strpos($t,"FD_")-strlen($p)))."FD";
$sql = "SELECT * FROM ".GetTablePrefix()."UserSession WHERE SessionKey='$key'";
//echo $sql."<br>\n";
$rs = $this->adodbConnection->Execute($sql);
if(!$rs || $rs->EOF)
{
//echo "Dropping Table $tables[$i] <br>\n";
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS ".$tables[$i]);
}
}
}
}
function DeleteExpiredSessions()
{
global $objConfig;
$cutoff = time()-$objConfig->Get("SessionTimeout");
$thiskey = $this->GetSessionKey();
$sql = "SELECT SessionKey from ".GetTablePrefix()."UserSession WHERE LastAccessed<$cutoff AND SessionKey != '$thiskey'";
$result = $this->adodbConnection->Execute($sql);
$keys = array();
while ($result && !$result->EOF)
{
$keys[] = "SessionKey='" . $result->fields["SessionKey"] . "'";
$result->MoveNext();
}
if(count($keys)>0)
{
$keywhere = implode(" OR ", $keys);
$sql = "DELETE FROM ".GetTablePrefix()."SessionData WHERE $keywhere";
//echo $sql;
$this->adodbConnection->Execute($sql);
$this->adodbConnection->Execute("DELETE FROM ".GetTablePrefix()."UserSession WHERE LastAccessed<$cutoff");
$this->DeleteEditTables();
}
}
function SetSysPermCache()
{
unset($this->SysPermCache);
$GroupList = $this->Get("GroupList");
if(strlen($GroupList) && $GroupList !="0")
{
$this->SysPermCache = array();
$sql = "SELECT * FROM ".GetTablePrefix()."Permissions WHERE Type=1 AND PermissionValue=1 AND GroupId IN (".$GroupList.")";
//echo $sql."<br>\n";
$rs = $this->adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$val = $rs->fields["PermissionValue"];
if($val==1)
$this->SysPermCache[$rs->fields["Permission"]] = 1;
$PermList[] = $rs->fields["Permission"];
$rs->MoveNext();
}
if( isset($PermList) && count($PermList) > 0) // I think this is never issued (comment by Alex)
$this->SetVariable("SysPerm",implode(",",$PermList));
}
}
function GetSysPermCache()
{
$perms = trim($this->GetVariable("SysPerm"));
if(!strlen($perms))
{
$this->SetSysPermCache();
}
else
{
$p = explode(",",$perms);
$this->SysPermCache = array();
for($i=0;$i<count($p);$i++)
{
$n = $p[$i];
$this->SysPermCache[$n]=1;
}
}
}
function SysPermCacheLoaded()
{
return (isset($this->SysPermCache));
}
function ResetSysPermCache()
{
// echo "Resetting Perm Cache<br>\n";
$this->SetVariable("SysPerm","");
unset($this->SysPermCache);
//$this->SysPermCache=array();
}
function HasSystemPermission($PermissionName)
{
global $objGroups;
if($this->Get("PortalUserId")==-1 && ($PermissionName=="ADMIN" || $PermissionName=="LOGIN"))
return TRUE;
//echo "Looking up $PermissionName:".$this->Get("GroupList")."<br>\n";
//echo $this->Get("GroupList")." - ".$this->PermCacheGroups;
$GroupList = $this->Get("GroupList");
if(substr($GroupList,-1)==",")
{
$GroupList = substr($GroupList,0,-1);
$this->Set("GroupList",$GroupList);
}
//print_pre( $GroupList);
if($this->Get("GroupList")!=$this->PermCacheGroups)
$this->ResetSysPermCache();
if(!$this->SysPermCacheLoaded())
{
//echo "Loading Perm Cache<br>\n";
$this->GetSysPermCache();
$this->PermCacheGroups = $this->Get("GroupList");
}
//echo "SysPerm $PermissionName: [". $this->SysPermCache[$PermissionName]."]<br>\n";
return isset($this->SysPermCache[$PermissionName]) ? $this->SysPermCache[$PermissionName] == 1 : false;
}
function HasCatPermission($PermissionName,$CatId=NULL)
{
global $objCatList, $objUsers;
$PermSet =FALSE;
$Value = 0;
if($this->Get("PortalUserId")==-1)
return TRUE;
if(!strlen($PermissionName))
return FALSE;
$GroupList = $this->Get("GroupList");
if(substr($GroupList,-1)==",")
{
$GroupList = substr($GroupList,0,-1);
$this->Set("GroupList",$GroupList);
}
if(!strlen($this->Get("SessionKey")))
$this->Set("GroupId",0);
if(strlen(trim($GroupList)))
{
if(strlen($this->Get("GroupId")))
{
$GroupList = $this->Get("GroupId").",".$GroupList;
}
}
else
{
$GroupList = $this->Get("GroupId");
}
if($CatId == NULL)
{
$CatId = $objCatList->CurrentCategoryID();
}
$Cat = &$objCatList->GetCategory($CatId);
$Value="";
for($p=0;$p<count($this->PermCache);$p++)
{
$pItem = $this->PermCache[$p];
if($pItem["perm"]==$PermissionName && $pItem["cat"]==$CatId)
{
$Value=$pItem["value"];
break;
}
}
if(is_object($Cat) && !is_numeric($Value))
{
$Value = 0;
$CatList = $Cat->Get("ParentPath");
$CatList = substr($CatList,1,-1);
$CatList = str_replace("|",",",$CatList);
if(strlen($CatList))
{
$CatList ="0,".$CatList;
}
else
$CatList = "0";
$sql = "SELECT * FROM ".GetTablePrefix()."Permissions WHERE Permission LIKE '$PermissionName' AND CatId IN ($CatList) AND GroupId IN ($GroupList)";
// echo $sql."<br>\n";
$rs = $this->adodbConnection->Execute($sql);
$PermValue = array();
while($rs && !$rs->EOF)
{
$index = $rs->fields["CatId"];
if(!is_numeric($PermValue[$index]))
$PermValue[$index] = $rs->fields["PermissionValue"];
$rs->MoveNext();
}
$cats = array_reverse(explode(",",$CatList));
for($c=0;$c<count($cats);$c++)
{
$index = $cats[$c];
if( isset($PermValue[$index]) && is_numeric($PermValue[$index]) )
{
$Value = $PermValue[$index];
break;
}
}
$perm = array();
$perm["perm"] = $PermissionName;
$perm["cat"] = $CatId;
$perm["value"] = $Value;
array_push($this->PermCache, $perm);
}
//echo $GroupList." Has Permission $PermissionName = $Value<br>\n";
return $Value;
}
function HasCatPermInList($PermList,$CatId=NULL, $System=FALSE)
{
$value = 0;
if(strlen($PermList))
{
$plist = explode(",",$PermList);
$value=0;
for($p=0;$p<count($plist);$p++)
{
if($this->HasCatPermission($plist[$p]))
{
$value = 1;
break;
}
else
{
if($System)
{
if($this->HasSystemPermission($plist[$p]))
{
$value = 1;
break;
}
}
}
}
}
return $value;
}
function GetACLClause()
{
$GroupList = $this->Get("GroupList");
if(strlen($GroupList))
$Groups = explode(",",$GroupList);
$acl_where = "";
if(@count($Groups)>0 && is_array($Groups))
{
$acl_where = array();
for($i=0;$i<count($Groups);$i++)
{
$g = $Groups[$i];
if(strlen($g)>0)
$acl_where[] = "(FIND_IN_SET($g,acl) OR ((NOT FIND_IN_SET($g,dacl)) AND acl='')) ";
}
if(count($acl_where))
{
$acl_where = "(".implode(" OR ",$acl_where).")";
}
else
$acl_where = "(FIND_IN_SET(0,acl))";
}
else
$acl_where = "(FIND_IN_SET(0,acl))";
return $acl_where;
}
function GetEditTable($base_table)
{
$prefix = GetTablePrefix();
if(strlen($prefix))
{
if(substr($base_table,0,strlen($prefix))!=$prefix)
$base_table = $prefix.$base_table;
}
$table = $prefix."ses_".$this->GetSessionKey()."_edit_".$base_table;
//echo "Table: $table <br>\n";
return $table;
}
function GetSessionTable($base_table,$name)
{
$prefix = GetTablePrefix();
if(strlen($prefix))
{
if(substr($base_table,0,strlen($prefix))!=$prefix)
$base_table = $prefix.$base_table;
}
$table = $prefix."ses_".$this->GetSessionKey()."_".$name.$base_table;
//echo "Table: $table <br>\n";
return $table;
}
function GetSearchTable($base_table="")
{
$prefix = GetTablePrefix();
if(strlen($base_table))
{
if(strlen($prefix))
{
if(substr($base_table,0,strlen($prefix))!=$prefix)
$base_table = $prefix.$base_table;
}
$table = $prefix."ses_".$this->GetSessionKey()."_search_".$base_table;
}
else
$table = $this->GetSessionTable('Search',''); //$prefix."ses_".$this->GetSessionKey()."_search";
return $table;
}
function GetTotalSessions()
{
# $time = time() - 900;
$sql = "SELECT count(*) as SesCount FROM ".GetTablePrefix()."UserSession";
$result = $this->adodbConnection->Execute($sql);
if ($result === false)
{
$this->m_Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"GetTotalSessions");
return false;
}
return $result->fields["SesCount"];
}
function Query_UserSession($whereClause,$orderByClause)
{
$resultSet = array();
$sql = "SELECT ".GetTablePrefix()."* FROM ".GetTablePrefix()."UserSession ";
if(isset($whereClause))
$sql = sprintf('%s WHERE %s',$sql,$whereClause);
if(isset($orderByClause))
$sql = sprintf('%s ORDER BY %s',$sql,$orderByClause);
$result = $this->adodbConnection->Execute($sql);
if ($result === false)
{
$this->m_Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"Query_UserSession");
return false;
}
while (!$result->EOF)
{
$item = new clsUserSession(NULL);
$item->Set("SessionKey",$result->fields["SessionKey"]);
$item->Set("LastAccessed", $result->fields["LastAccessed"]);
$item->Set("PortalUserId", $result->fields["PortalUserId"]);
$item->Set("Language", $result->fields["Language"]);
$item->Set("Theme" , $result->fields["Theme"]);
array_push($resultSet,$item);
$result->MoveNext();
}
return $resultSet;
}
function GetUniqueKey()
{
while(true)
{
/* create the new session key here */
mt_srand(100000000*(double)microtime());
$sessionId=strtoupper(sprintf("AD%xFD",mt_rand(100000000,999999999))); //9 digit hex session id
$query = "select SessionKey from ".GetTablePrefix()."UserSession ";
$query .= "where SessionKey='$sessionId' OR CurrentTempKey='$sessionId' OR PrevTempKey='$sessionId'";
$rs = $this->adodbConnection->Execute($query);
if($rs->EOF)
break;
if($i>100)
{
return "";
}
$i++;
}
//echo "Getting Unique Key: $sessionId<br>";
return $sessionId;
}
function GetNewSession()
{
global $sessionId, $objConfig, $objLanguages, $m_var_list;
$i=0;
if($this->Get("PortalUserId")>0 || $objConfig->Get("GuestSessions")==1)
{
//echo "Creating Session<br>\n";
$sessionId = $this->GetUniqueKey();
$this->Set("SessionKey", $sessionId);
$this->Set("CurrentTempKey",$sessionId);
if($m_var_list["lang"])
{
$this->Set("Language",$m_var_list["lang"]);
}
else
$this->Set("Language", $objLanguages->GetPrimary());
$this->SetThemeName();
//$this->Set("Theme", $objConfig->Get("Default_Theme"));
$this->UpdateAccessTime();
$this->Set("IpAddress", $_SERVER['REMOTE_ADDR'] );
$this->Create();
}
else
$this->Set("SessionKey","");
}
function SessionEnabled()
{
//trace();
$res = FALSE;
$key = $this->GetSessionKey();
if(strlen($key)>0)
$res = TRUE;
return $res;
}
function GetSessionKey()
{
return $this->Get("SessionKey");
}
function SetThemeName($id=0)
{
global $objThemes;
if($id==0)
$id = $objThemes->GetPrimaryTheme();
$Theme = $objThemes->GetItem($id);
$name = $Theme->Get("Name");
$this->Set("Theme",$name);
//$this->Update();
}
function ValidSession($SessionKey=NULL)
{
global $objConfig;
$a = $this->Get("LastAccessed");
$cutoff = time()-$objConfig->Get("SessionTimeout");
//echo $a." ".$cutoff."<br>";
//$ip = ($_SERVER['REMOTE_ADDR'] == $this->Get("IpAddress"));
//echo $this->Get("IpAddress");
//$ip = TRUE;
if ($a < $cutoff) {
//$this->UpdateAccessTime();
}
return ($a >= $cutoff);
}
function UpdateAccessTime()
{
$now = time();
$this->Set("LastAccessed",$now);
}
function InSpamControl($ResourceId,$DataType=NULL)
{
static $ClearStat;
if(!$ClearStat)
$this->PurgeSpamControl();
$ClearStat=1;
if(strlen($DataType))
$DataType="'".$DataType."'";
$sql = "SELECT count(*) as SpamCount FROM ".GetTablePrefix()."SpamControl WHERE ItemResourceId=$ResourceId AND DataType=$DataType";
if($this->Get("PortalUserId")==0)
{
$sql .= " AND PortalUserId=0 AND IPaddress='".$_SERVER["REMOTE_ADDR"]."'";
}
else
{
$sql .= " AND PortalUserId=".$this->Get("PortalUserId");
}
$rs = $this->adodbConnection->Execute($sql);
$value = (int)$rs->fields["SpamCount"];
if($value>0)
{
return TRUE;
}
else
return FALSE;
}
function AddToSpamControl($ResourceId,$secstoexpire,$DataType=NULL)
{
$expire = adodb_date("U") + $secstoexpire;
if(strlen($DataType))
$DataType = "'".$DataType."'";
$sql = "INSERT INTO ".GetTablePrefix()."SpamControl (ItemResourceId,IPaddress,Expire,PortalUserId,DataType) VALUES (";
$sql .= $ResourceId.",'".$_SERVER["REMOTE_ADDR"]."',$expire,".$this->Get("PortalUserId").",$DataType)";
//echo $sql;
$this->adodbConnection->Execute($sql);
}
function PurgeSpamControl()
{
$sql = "DELETE FROM ".GetTablePrefix()."SpamControl WHERE Expire<".adodb_date("U");
$this->adodbConnection->Execute($sql);
}
}/* clsUserSession */
?>
Property changes on: trunk/kernel/include/usersession.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.12
\ No newline at end of property
+1.13
\ No newline at end of property
Index: trunk/kernel/startup.php
===================================================================
--- trunk/kernel/startup.php (revision 401)
+++ trunk/kernel/startup.php (revision 402)
@@ -1,147 +1,147 @@
<?php
/*
startup.php: this is the primary startup sequence for in-portal services
*/
if( file_exists($pathtoroot.'debug.php') && !defined('DEBUG_MODE') ) include_once($pathtoroot.'debug.php');
if( !defined('DEBUG_MODE') ) error_reporting(0);
ini_set('memory_limit', '16M');
$kernel_version = "1.0.0";
$FormError = array();
$FormValues = array();
/* include PHP version compatibility functions */
require_once($pathtoroot."compat.php");
/* set global variables and module lists */
require_once($pathtoroot."globals.php");
LogEntry("Initalizing System..\n");
/* for 64 bit timestamps */
require_once($pathtoroot."kernel/include/adodb/adodb-time.inc.php");
require_once($pathtoroot."kernel/include/dates.php");
/* create the global error object */
require_once($pathtoroot."kernel/include/error.php");
$Errors = new clsErrorManager();
require_once($pathtoroot."kernel/include/itemdb.php");
require_once($pathtoroot."kernel/include/config.php");
/* create the global configuration object */
LogEntry("Creating Config Object..\n");
$objConfig = new clsConfig();
$objConfig->Load(); /* Populate our configuration data */
LogEntry("Done Loading Configuration\n");
if( defined('ADODB_EXTENSION') && constant('ADODB_EXTENSION') > 0 )
LogEntry("ADO Extension: ".ADODB_EXTENSION."\n");
require_once($pathtoroot."kernel/include/parseditem.php");
require_once($pathtoroot."kernel/include/item.php");
require_once($pathtoroot."kernel/include/syscache.php");
require_once($pathtoroot."kernel/include/modlist.php");
require_once($pathtoroot."kernel/include/searchconfig.php");
require_once($pathtoroot."kernel/include/banrules.php");
$objModules = new clsModList();
$objSystemCache = new clsSysCacheList();
$objSystemCache->PurgeExpired();
$objBanList = new clsBanRuleList();
require_once($pathtoroot."kernel/include/image.php");
require_once($pathtoroot."kernel/include/itemtypes.php");
$objItemTypes = new clsItemTypeList();
require_once($pathtoroot."kernel/include/theme.php");
$objThemes = new clsThemeList();
require_once($pathtoroot."kernel/include/language.php");
$objLanguages = new clsLanguageList();
$objImageList = new clsImageList();
/* Load session and user class definitions */
//require_once("include/customfield.php");
//require_once("include/custommetadata.php");
require_once($pathtoroot."kernel/include/usersession.php");
require_once($pathtoroot."kernel/include/favorites.php");
require_once($pathtoroot."kernel/include/portaluser.php");
require_once($pathtoroot."kernel/include/portalgroup.php");
/* create the user management class */
$objFavorites = new clsFavoriteList();
$objUsers = new clsUserManager();
$objGroups = new clsGroupList();
require_once($pathtoroot."kernel/include/cachecount.php");
require_once($pathtoroot."kernel/include/customfield.php");
require_once($pathtoroot."kernel/include/custommetadata.php");
require_once($pathtoroot."kernel/include/permissions.php");
require_once($pathtoroot."kernel/include/relationship.php");
require_once($pathtoroot."kernel/include/category.php");
require_once($pathtoroot."kernel/include/statitem.php");
/* category base class, used by all the modules at some point */
$objPermissions = new clsPermList();
$objPermCache = new clsPermCacheList();
$objCatList = new clsCatList();
$objCustomFieldList = new clsCustomFieldList();
$objCustomDataList = new clsCustomDataList();
$objCountCache = new clsCacheCountList();
require_once($pathtoroot."kernel/include/smtp.php");
require_once($pathtoroot."kernel/include/emailmessage.php");
require_once($pathtoroot."kernel/include/events.php");
LogEntry("Creating Mail Queue..\n");
$objMessageList = new clsEmailMessageList();
$objEmailQueue = new clsEmailQueue();
LogEntry("Done creating Mail Queue Objects\n");
require_once($pathtoroot."kernel/include/searchitems.php");
require_once($pathtoroot."kernel/include/advsearch.php");
require_once($pathtoroot."kernel/include/parse.php");
require_once($pathtoroot."kernel/include/socket.php");
/* responsible for including module code as required
This script also creates an instance of the user session onject and
handles all session management. The global session object is created
and populated, then the global user object is created and populated
each module's parser functions and action code is included here
*/
LogEntry("Startup complete\n");
include_once("include/modules.php");
if( defined('DEBUG_MODE') && constant('DEBUG_MODE') == 1 && function_exists('DebugByFile') ) DebugByFile();
/* startup is complete, so now check the mail queue to see if there's anything that needs to be sent*/
$objEmailQueue->SendMailQeue();
$ado=GetADODBConnection();
$rs = $ado->Execute("SELECT * FROM ".GetTablePrefix()."Modules WHERE LoadOrder = 0");
$kernel_version = $rs->fields['Version'];
$adminDir = $objConfig->Get("AdminDirectory");
if ($adminDir == '') {
$adminDir = 'admin';
}
if (strstr($_SERVER['SCRIPT_FILENAME'], $adminDir) && !GetVar('logout') && !strstr($_SERVER['SCRIPT_FILENAME'], "install") && !strstr($_SERVER['SCRIPT_FILENAME'], "index")) {
//echo "testz [".admin_login()."]<br>";
if (!admin_login())
{
if( !headers_sent() ) setcookie("sid"," ",time()-3600);
$objSession->Logout();
$url_add = isset($_GET['expired']) && $_GET['expired'] ? '?expired=1' : '';
header("Location: ".$adminURL.'/login.php'.$url_add);
die();
//require_once($pathtoroot."admin/login.php");
}
}
-?>
+?>
\ No newline at end of file
Property changes on: trunk/kernel/startup.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.9
\ No newline at end of property
+1.10
\ No newline at end of property
Index: trunk/kernel/searchaction.php
===================================================================
--- trunk/kernel/searchaction.php (revision 401)
+++ trunk/kernel/searchaction.php (revision 402)
@@ -1,199 +1,211 @@
<?php
/* action handlers for listview searches */
//echo "in search action (global)<br>";
//print_pre($_REQUEST);
switch($Action)
{
case "m_SearchWord": /* browse and modify*/
$searchlist = trim($objSession->GetVariable("SearchWord"));
if($_POST["NewSearch"]==1)
$searchlist = "";
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["SearchWord"];
$objSession->SetVariable("SearchWord",$searchlist);
$objSession->SetVariable("SearchType",$_POST["SearchType"]);
$objSession->SetVariable("SearchScope",(int)$_POST["SearchScope"]);
break;
case "m_ClearSearch": /* browse and modify*/
$objSession->SetVariable("SearchWord","");
break;
case "m_user_search": /* user list */
$searchlist = trim($objSession->GetVariable("UserSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("UserSearchWord",$searchlist);
$objSession->SetVariable("Page_Userlist",1);
break;
case "m_user_search_reset": /*user list */
$objSession->SetVariable("UserSearchWord","");
$objSession->SetVariable("Page_Userlist",1);
break;
case "m_summary_search": /* summary list */
$searchlist = trim($objSession->GetVariable("UserSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("SummarySearchWord",$searchlist);
$objSession->SetVariable("Page_Summary",1);
break;
case "m_summary_search_reset": /* summary list */
$objSession->SetVariable("SummarySearchWord","");
$objSession->SetVariable("Page_Summary",1);
break;
case "m_userselect_search": /* popup user list */
$searchlist = trim($objSession->GetVariable("UserSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("UserSelectSearchWord",$searchlist);
$objSession->SetVariable("Page_UserSelect",1);
break;
case "m_userselect_search_reset": /* popup user list */
$objSession->SetVariable("UserSelectSearchWord","");
$objSession->SetVariable("Page_UserSelect",1);
break;
case "m_group_search": /* group list */
$searchlist = trim($objSession->GetVariable("GroupSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("GroupSearchWord",$searchlist);
$objSession->SetVariable("Page_Grouplist",1);
break;
case "m_group_search_reset": /*group list */
$objSession->SetVariable("GroupSearchWord","");
break;
case "m_rel_search": /* category relations list */
$searchlist = trim($objSession->GetVariable("CatRelSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("CatRelSearchWord",$searchlist);
$objSession->SetVariable("Page_Relations",1);
break;
case "m_rel_search_reset": /* category relations list */
$objSession->SetVariable("CatRelSearchWord","");
break;
case "m_group_search": /* group list */
$searchlist = trim($objSession->GetVariable("GroupSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("GroupSearchWord",$searchlist);
$objSession->SetVariable("Page_Grouplist",1);
break;
case "m_group_search_reset": /*group list */
$objSession->SetVariable("GroupSearchWord","");
break;
case "m_phrase_search": /* category relations list */
$searchlist = trim($objSession->GetVariable("PhraseSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("PhraseSearchWord",$searchlist);
$objSession->SetVariable("Page_Phrase",1);
break;
case "m_phrase_search_reset": /* category relations list */
$objSession->SetVariable("PhraseSearchWord","");
$objSession->SetVariable("Page_Phrase",1);
break;
case "m_template_file_search": /* theme template file list */
$searchlist = trim($objSession->GetVariable("TemplateSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("TemplateSearchWord",$searchlist);
$objSession->SetVariable("Page_Template",1);
break;
case "m_template_file_search_reset": /* theme template file list */
$objSession->SetVariable("TemplateSearchWord","");
$objSession->SetVariable("Page_Template",1);
break;
case "m_lang_search": /* language package list */
$searchlist = trim($objSession->GetVariable("LangSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("LangSearchWord",$searchlist);
$objSession->SetVariable("Page_LV_Lang",1);
break;
case "m_lang_search_reset": /* language package list */
$objSession->SetVariable("LangSearchWord","");
$objSession->SetVariable("Page_LV_Lang",1);
break;
case "m_emailevent_search": /* Email event list */
$searchlist = trim($objSession->GetVariable("EmailEventSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("EmailEventSearchWord",$searchlist);
$objSession->SetVariable("Page_Email",1);
break;
case "m_emailevent_search_reset":
$objSession->SetVariable("EmailEventSearchWord","");
$objSession->SetVariable("Page_Email",1);
break;
case "m_langemailevent_search": /* Email event list */
$searchlist = trim($objSession->GetVariable("LangEmailEventSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("LangEmailEventSearchWord",$searchlist);
$objSession->SetVariable("Page_LangEmail",1);
break;
case "m_langemailevent_search_reset":
$objSession->SetVariable("LangEmailEventSearchWord","");
$objSession->SetVariable("Page_LangEmail",1);
break;
case "m_rule_search": /* Email event list */
$searchlist = trim($objSession->GetVariable("RuleSearchWord"));
if(strlen($searchlist)>0)
$searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("RuleSearchWord",$searchlist);
$objSession->SetVariable("Page_BanRules",1);
break;
case "m_rule_search_reset":
$objSession->SetVariable("RuleSearchWord","");
$objSession->SetVariable("Page_BanRules",1);
break;
// Theme List Search
case 'm_theme_search':
$searchlist = trim( $objSession->GetVariable("ThemeSearchWord") );
if(strlen($searchlist) > 0) $searchlist = ",";
$searchlist = $_POST["list_search"];
$objSession->SetVariable("ThemeSearchWord",$searchlist);
$objSession->SetVariable("Page_LV_Themes",1);
break;
case 'm_theme_search_reset':
$objSession->SetVariable("ThemeSearchWord","");
$objSession->SetVariable("Page_LV_Themes",1);
break;
// Advanced View Search Actions
case 'm_adv_view_search':
SaveAdvView_SearchWord('m');
break;
case 'm_adv_view_search_reset':
ResetAdvView_SearchWord('m');
break;
+
+ case 'm_emaillog_search':
+ $searchlist = trim( $objSession->GetVariable("EmailsLSearchWord") );
+ if(strlen($searchlist) > 0) $searchlist = ",";
+ $searchlist = $_POST["list_search"];
+ $objSession->SetVariable("EmailsLSearchWord",$searchlist);
+ $objSession->SetVariable("Page_EmailsL",1);
+ break;
+ case 'm_emaillog_search_reset':
+ $objSession->SetVariable("EmailsLSearchWord","");
+ $objSession->SetVariable("Page_EmailsL",1);
+ break;
}
?>
Property changes on: trunk/kernel/searchaction.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Index: trunk/kernel/frontaction.php
===================================================================
--- trunk/kernel/frontaction.php (revision 401)
+++ trunk/kernel/frontaction.php (revision 402)
@@ -1,855 +1,856 @@
<?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 = '&nbsp;';
$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");
}
}
$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();
+ $objSession->Set("password", $password);
}
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.12
\ No newline at end of property
+1.13
\ No newline at end of property
Index: trunk/admin/users/user_addpermission.php
===================================================================
--- trunk/admin/users/user_addpermission.php (revision 401)
+++ trunk/admin/users/user_addpermission.php (revision 402)
@@ -1,265 +1,270 @@
<?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(__FILE__));
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");
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot. $value."admin/include/parser.php";
if(file_exists($path))
{
include_once($path);
}
}
unset($objEditItems);
$objEditItems = new clsUserManager();
$objEditItems->SourceTable = $objSession->GetEditTable("PortalUser");
$objEditItems->EnablePaging = FALSE;
//Multiedit init
$en = (int)$_GET["en"];
$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable);
$itemcount=$objEditItems->NumItems();
$c = $objEditItems->GetItemByIndex($en);
if($itemcount>1)
{
if ($en+1 == $itemcount)
$en_next = -1;
else
$en_next = $en+1;
if ($en == 0)
$en_prev = -1;
else
$en_prev = $en-1;
}
$action = "m_user_sysperm";
$envar = "env=" . BuildEnv() . "&en=$en";
$section = 'in-portal:edituser_permission';
$PermModule = $_GET["module"];
$title = prompt_language("la_Text_Editing")." ".prompt_language("la_Text_User")." '".$c->Get("Login")."' - ".prompt_language("la_tab_Permissions");
//$formaction = $adminURL."/user/adduser_custom.php?".$envar;
//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('edituser','UserEditStatus','".$admin."/users/adduser_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('edituser','UserEditStatus','".$admin."/users/adduser_permissions.php',-1);","tool_cancel.gif");
if ( isset($en_prev) || isset($en_next) )
{
$url = $RootUrl.$admin."/users/user_addpermission.php";
$StatusField = "UserEditStatus";
$form = "edituser";
MultiEditButtons($objCatToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'&module='.$_REQUEST['module'],'la_PrevUser','la_NextUser');
}
//echo "<pre>"; print_r($objCatToolBar); echo "</pre>";
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('edituser','UserEditStatus','<?php echo $admin; ?>/users/adduser_permissions.php',0);"><?php echo prompt_language("la_Prompt_GeneralPermissions"); ?></A>&gt;<?php echo prompt_language("la_PermType_$PermModule"); ?></span>
</td>
</TR>
</TBODY>
</TABLE>
<TABLE CELLPADDING=0 CELLSPACING=0 class="tableborder" width="100%">
<FORM NAME="edituser" ID="edituser" method="POST" ACTION="">
<TBODY>
<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";
?>
</TR>
<?php
$UserGroup = $c->GetPersonalGroup();
$UserGroupExists = is_object($UserGroup);
$permlist = array();
$ado = GetADODBConnection();
$sql = "SELECT * FROM ".GetTablePrefix()."PermissionConfig AS pc LEFT JOIN ".GetTablePrefix()."Phrase AS p ON pc.Description = p.Phrase WHERE pc.ModuleId='$PermModule' AND p.LanguageId = ".$objSession->Get("Language")." ORDER BY p.Translation ASC";
-//echo $sql;
+
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."<br>\n";
$rs = $ado->Execute($sql);
while($rs && !$rs->EOF)
{
$desc = $rs->fields["Description"];
$Permission = $rs->fields["PermissionName"];
echo "<TR ".int_table_color_ret().">";
echo "<TD><IMG src=\"".$imagesURL."/itemicons/icon16_permission.gif\"> ";
echo prompt_language($desc)."</TD>";
$checked = "";
+
if($UserGroupExists)
{
+ //echo "GroupPermission on $Permission: ".$UserGroup->HasSystemPermission($Permission)."<br>";
+ //echo "UserPermission on $Permission: ".$c->HasSystemPermission($Permission)."<br>";
$Inherit = ($UserGroup->HasSystemPermission($Permission)==-1);
}
- else
+ else {
$Inherit =TRUE;
+ }
+
if($Inherit)
{
$checked = " CHECKED";
$value = $c->HasSystemPermission($Permission);
}
else
$value = $UserGroup->HasSystemPermission($Permission);
echo " <TD><INPUT access=\"chk".$Permission."\" ONCLICK=\"SetAccessEnabled(this); \" TYPE=CHECKBOX name=\"inherit[]\" VALUE=\"".$Permission."\" $checked></TD>\n";
$checked = "";
$imgsrc="red";
if($value==1)
{
$checked = " CHECKED";
$imgsrc = "green";
$current = "true";
}
else
{
$imgsrc = "red";
$current = "false";
}
$disabled = "";
if($Inherit)
{
$InheritValue = $current;
$UnInheritValue = "false";
$disabled = "DISABLED=\"true\"";
}
else
{
$disabled = "";
$InheritValue = ($Value==1);
$UnInheritValue = ($Value !=1);
}
echo " <TD><INPUT $disabled InheritValue=\"$InheritValue\" UnInheritValue=\"$UnInheritValue\" 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\">";
echo "</TD></TR>";
$permlist[]=$Permission;
$rs->MoveNext();
}
?>
</TBODY>
</TABLE>
<input type="hidden" name="ItemId" value="<?php echo $c->Get("ResourceId"); ?>">
<input type="hidden" name="Action" value="m_user_sysperm">
<input type="hidden" name="UserEditStatus" VALUE="0">
<input type="hidden" name="PermList" value="<?php echo implode(",",$permlist); ?>">
</FORM>
<FORM method="POST" NAME="save_edit" ID="save_edit">
<tr <?php int_table_color(); ?>>
<td colspan="3">
</td>
</tr>
</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>
//initSelectiorContainers();
<?php // echo $objCatToolBar->Get("CheckClass").".setImages();"; ?>
</script>
<?php int_footer(); ?>
Property changes on: trunk/admin/users/user_addpermission.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/users/user_list.php
===================================================================
--- trunk/admin/users/user_list.php (revision 401)
+++ trunk/admin/users/user_list.php (revision 402)
@@ -1,363 +1,363 @@
<?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(__FILE__));
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");
if (!admin_login())
{
if(!headers_sent())
setcookie("sid"," ",time()-3600);
$objSession->Logout();
header("Location: ".$adminURL."/login.php");
die();
//require_once($pathtoroot."admin/login.php");
}
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
$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");
require_once($pathtoroot.$admin."/listview/listview.php");
$pathtolocal = $pathtoroot;
/* -------------------------------------- Section configuration ------------------------------------------- */
$section = 'in-portal:user_list';
$envar = "env=" . BuildEnv();
$SortFieldVar = "User_SortField";
$SortOrderVar = "User_SortOrder";
$DefaultSortField = "Login";
$PerPageVar = "Perpage_User";
$CurrentPageVar = "Page_UserList";
$CurrentFilterVar = "User_View";
$ListForm = "userlistform";
$CheckClass = "UserChecks";
/* ------------------------------------- Configure the toolbar ------------------------------------------- */
$objListToolBar = new clsToolBar();
$objListToolBar->Set("section",$section);
$objListToolBar->Set("load_menu_func","");
$objListToolBar->Set("CheckClass",$CheckClass);
$objListToolBar->Set("CheckForm",$ListForm);
$listImages = array();
//$img, $alt, $link, $onMouseOver, $onMouseOut, $onClick
$objListToolBar->Add("new_user", "la_ToolTip_New_User",$adminURL."/users/adduser.php?$envar&new=1","swap('new_user','toolbar/tool_new_user_f2.gif');",
"swap('new_user', 'toolbar/tool_new_user.gif');","");
$objListToolBar->Add("user_edit","la_ToolTip_Edit","#", "if (UserChecks.itemChecked()) swap('user_edit','toolbar/tool_edit_f2.gif');",
"if (UserChecks.itemChecked()) swap('user_edit', 'toolbar/tool_edit.gif');","if (UserChecks.itemChecked()) UserChecks.check_submit('adduser', '');",
"tool_edit.gif",TRUE,TRUE);
$listImages[] = "UserChecks.addImage('user_edit','$imagesURL/toolbar/tool_edit.gif','$imagesURL/toolbar/tool_edit_f3.gif',1); ";
$objListToolBar->Add("user_del","la_ToolTip_Delete","#", "if (UserChecks.itemChecked()) swap('user_del','toolbar/tool_delete_f2.gif');",
"if (UserChecks.itemChecked()) swap('user_del', 'toolbar/tool_delete.gif');","if (UserChecks.itemChecked()) UserChecks.check_submit('user_list', 'm_delete_user');",
"tool_delete.gif",FALSE,TRUE);
$listImages[] = "UserChecks.addImage('user_del','$imagesURL/toolbar/tool_delete.gif','$imagesURL/toolbar/tool_delete_f3.gif',1); ";
$objListToolBar->Add("user_primary","la_ToolTip_PrimaryGroup","#", "if (UserChecks.itemChecked()) swap('user_primary','toolbar/tool_primary_user_group_f2.gif');",
"if (UserChecks.itemChecked()) swap('user_primary', 'toolbar/tool_primary_user_group.gif');","if (UserChecks.itemChecked()) SelectPrimaryGroup();",
"tool_primary_user_group.gif",FALSE,TRUE);
$listImages[] = "UserChecks.addImage('user_primary','$imagesURL/toolbar/tool_primary_user_group.gif','$imagesURL/toolbar/tool_primary_user_group_f3.gif',1); ";
$objListToolBar->Add("divider");
$objListToolBar->Add("user_app","la_ToolTip_Approve","#","if (UserChecks.itemChecked()) swap('user_app','toolbar/tool_approve_f2.gif');",
"if (UserChecks.itemChecked()) swap('user_app', 'toolbar/tool_approve.gif');","if (UserChecks.itemChecked()) UserChecks.check_submit('user_list', 'm_approve_user');",
"tool_approve.gif",FALSE,TRUE);
$listImages[] = "UserChecks.addImage('user_app','$imagesURL/toolbar/tool_approve.gif','$imagesURL/toolbar/tool_approve_f3.gif',1); ";
$objListToolBar->Add("user_deny","la_ToolTip_Deny","#","if (UserChecks.itemChecked()) swap('user_deny','toolbar/tool_decline_f2.gif');",
"if (UserChecks.itemChecked()) swap('user_deny', 'toolbar/tool_decline.gif');","if (UserChecks.itemChecked()) UserChecks.check_submit('user_list', 'm_deny_user');",
"tool_deny.gif",FALSE,TRUE);
$listImages[] = "UserChecks.addImage('user_deny','$imagesURL/toolbar/tool_decline.gif','$imagesURL/toolbar/tool_decline_f3.gif',1); ";
$objListToolBar->Add("user_ban","la_ToolTip_Ban","#","if (UserChecks.itemChecked()) swap('user_ban','toolbar/tool_ban_user_f2.gif');",
"if (UserChecks.itemChecked()) swap('user_ban', 'toolbar/tool_ban_user.gif');","if (UserChecks.itemChecked()) UserChecks.check_submit('banuser', '');",
"tool_deny.gif",FALSE,TRUE);
$listImages[] = "UserChecks.addImage('user_ban','$imagesURL/toolbar/tool_ban_user.gif','$imagesURL/toolbar/tool_ban_user_f3.gif',1); ";
$objListToolBar->Add("divider");
$objListToolBar->Add("user_mail","la_ToolTip_SendMail","#", "if (UserChecks.itemChecked()) swap('user_mail','toolbar/tool_e-mail_f2.gif');",
"if (UserChecks.itemChecked()) swap('user_mail', 'toolbar/tool_e-mail.gif');","if (UserChecks.itemChecked()) openEmailPopup('','sendmail',$CheckClass);",
"tool_e-mail.gif",FALSE,TRUE);
$listImages[] = "UserChecks.addImage('user_mail','$imagesURL/toolbar/tool_e-mail.gif','$imagesURL/toolbar/tool_e-mail_f3.gif',1); ";
$objListToolBar->Add("user_print", "la_ToolTip_Print","#","swap('user_print','toolbar/tool_print_f2.gif');",
"swap('user_print', 'toolbar/tool_print.gif');","window.print();","tool_print.gif");
$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 ---------------------------------------- */
/* bit place holders for category view menu */
$Bit_Pending=4;
$Bit_Disabled=2;
$Bit_Valid=1;
$Bit_All = 7;
$FilterLabels = array();
$FilterLabels[0] = admin_language("la_Text_Enabled");
$FilterLabels[1] = admin_language("la_Text_Disabled");
$FilterLabels[2] = admin_language("la_Text_Pending");
/* determine current view menu settings */
$UserView = $objConfig->Get("User_View");
if(!is_numeric($UserView))
{
$UserView = $Bit_All; //Set all bits ON
$UserFilter = "";
}
if($UserView & $Bit_Valid)
$Status[] = 1;
if($UserView & $Bit_Disabled)
$Status[] = 0;
if($UserView & $Bit_Pending)
$Status[] = 2;
if(count($Status)>0)
{
$UserFilter = "Status IN (".implode(",",$Status).")";
}
else
$UserFilter = "Status = -1";
$order = $objConfig->Get($SortOrderVar);
$SearchWords = $objSession->GetVariable("UserSearchWord");
$where = "(ug.PrimaryGroup!=0 OR ug.PrimaryGroup IS NULL)";
$SearchWhere = $SearchWords ? $objUsers->AdminSearchWhereClause($SearchWords) : '';
if(strlen($SearchWhere))
{
$where .= " AND (".$SearchWhere.")";
}
if(strlen($UserFilter))
$where .= " AND (".$UserFilter.")";
/* ------------------------------------ Build the SQL statement to populate the list ---------------------------*/
$sql = "SELECT u.*,g.Name as GroupName,ELT(u.status+1,'".admin_language("la_Text_Disabled")." ','".admin_language("la_Text_Enabled")." ','".admin_language("la_Text_Pending")."') as UserStatus, ";
$sql .="FROM_UNIXTIME(u.CreatedOn,'%m-%d-%Y %H:%i:%s') as DateCreated FROM ".GetTablePrefix()."PortalUser as u ";
$sql .="LEFT JOIN ".GetTablePrefix()."UserGroup as ug ON (u.PortalUserId=ug.PortalUserId) ";
$sql .="LEFT JOIN ".GetTablePrefix()."PortalGroup as g ON (ug.GroupId=g.GroupId) WHERE $where";
if(!strlen($objConfig->Get($SortFieldVar)))
$objConfig->Set($SortFieldVar,$DefaultSortField);
$orderBy = trim($objConfig->Get($SortFieldVar)." ".$objConfig->Get($SortOrderVar));
if(strlen($orderBy))
$sql .=" ORDER BY ".$orderBy;
if( GetVar('resetpage') )
{
$page = 1;
$objSession->SetVariable($CurrentPageVar,1);
}
else
{
if( GetVar('lpn') )
{
$page = GetVar('lpn');
$objSession->SetVariable($CurrentPageVar, $page);
}
else
{
$page = $objSession->GetVariable($CurrentPageVar);
}
}
//$sql .=" ".GetLimitSQL($page,(int)$objConfig->Get($PerPageVar));
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."<br>\n";
$objListView = new clsListView($objListToolBar);
$objListView->CurrentPageVar = $CurrentPageVar;
$objListView->PerPageVar = $PerPageVar;
- //echo "SQL: $sql<br>";
+ //echo "SQL: $sql<br>";
$objUsers->Query_Item($sql, false, 'set_first');
$objSession->SetVariable($CurrentPageVar, 1);
$itemcount = QueryCount($sql);
//$title = prompt_language("la_Text_ShowingUsers")." (".$objUsers->NumItems().")";
//removed by PSK 2004-10-21
if(strlen($SearchWords))
{
$title = prompt_language("la_Text_Search_Results")." (".$itemcount.")";
}
else
$title = prompt_language("la_Text_ShowingUsers")." (".$itemcount.")";
$objListView->SetListItems($objUsers);
/* ---------------------------------------- Configure the list view ---------------------------------------- */
$objListView->IdField = "ResourceId";
$objListView->PageLinkTemplate = $pathtoroot.$admin."/templates/user_page_link.tpl";
$objListView->ColumnHeaders->Add("Login",admin_language("la_prompt_Username"),1,0,$order,"width=\"15%\"",$SortFieldVar,$SortOrderVar,"Login");
$objListView->ColumnHeaders->Add("LastName",admin_language("la_prompt_Last_Name"),1,0,$order,"width=\"15%\"",$SortFieldVar,$SortOrderVar,"LastName");
$objListView->ColumnHeaders->Add("FirstName",admin_language("la_prompt_First_Name"),1,0,$order,"width=\"15%\"",$SortFieldVar,$SortOrderVar,"FirstName");
$objListView->ColumnHeaders->Add("Email",admin_language("la_prompt_Email"),1,0,$order,"width=\"20%\"",$SortFieldVar,$SortOrderVar,"Email");
$objListView->ColumnHeaders->Add("GroupName",admin_language("la_prompt_PrimaryGroup"),1,0,$order,"width=\"20%\"",$SortFieldVar,$SortOrderVar,"GroupName");
-$objListView->ColumnHeaders->Add("DateCreated",admin_language("la_prompt_CreatedOn"),1,0,$order,"width=\"15%\"",$SortFieldVar,$SortOrderVar,"u.DateCreated");
+$objListView->ColumnHeaders->Add("DateCreated",admin_language("la_prompt_CreatedOn"),1,0,$order,"width=\"15%\"",$SortFieldVar,$SortOrderVar,"u.CreatedOn");
$objListView->ColumnHeaders->SetSort($objConfig->Get($SortFieldVar), $objConfig->Get($SortOrderVar));
$objListView->PrintToolBar = FALSE;
$objListView->SearchBar = TRUE;
$objListView->SearchKeywords = $SearchWords;
$objListView->SearchAction="m_user_search";
$objListView->CheckboxName = "itemlist[]";
$objListView->TotalItemCount = $itemcount;
$objListView->ConfigureViewMenu($SortFieldVar,$SortOrderVar,$DefaultSortField,
$CurrentFilterVar,$UserView,$Bit_All);
foreach($FilterLabels as $Bit=>$Label)
{
$objListView->AddViewMenuFilter($Label,$Bit);
}
for($i=0;$i<count($objUsers->Items);$i++)
{
$u =& $objUsers->GetItemRefByIndex($i);
$objListView->RowIcons[] = $u->StatusIcon();
}
$objListToolBar->AddToInitScript("fwLoadMenus();");
$h = "\n\n<SCRIPT Language=\"JavaScript1.2\">\n".$objListView->GetViewMenu($imagesURL)."\n</SCRIPT>\n";
int_header($objListToolBar,NULL, $title,NULL,$h);
?>
<FORM method="POST" ACTION="" NAME="userlistform" ID="userlistform">
<?php
print $objListView->PrintList();
?>
<input type="hidden" name="Action" value="">
</FORM>
<FORM method=POST NAME="sendmail" ID="sendmail" target="sendmail" ACTION="<?php echo $adminURL."/email/sendmail.php?env=".BuildEnv(); ?>">
<INPUT TYPE="HIDDEN" NAME="idlist" ID="idlist" VALUE="">
<INPUT TYPE="hidden" NAME="idtype" ID="idtype" VALUE="user">
</FORM>
<!-- CODE FOR VIEW MENU -->
<form ID="viewmenu" method="post" action="user_list.php?env=<?php echo BuildEnv(); ?>" 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>
<form ID="popup" method="post" action="user_list.php?env=<?php echo BuildEnv(); ?>" name="popup">
<INPUT TYPE="hidden" NAME="grouplist">
<input TYPE="hidden" NAME="Action" VALUE="m_user_primarygroup">
<input type="hidden" NAME="userlist">
</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>
<script src="<?php echo $adminURL; ?>/listview/listview.js"></script>
<script>
initSelectiorContainers();
<?php echo $objListToolBar->Get("CheckClass").".setImages();"; ?>
</script>
<!-- END CODE-->
<?php int_footer(); ?>
Property changes on: trunk/admin/users/user_list.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.8
\ No newline at end of property
+1.9
\ No newline at end of property
Index: trunk/admin/users/adduser.php
===================================================================
--- trunk/admin/users/adduser.php (revision 401)
+++ trunk/admin/users/adduser.php (revision 402)
@@ -1,376 +1,376 @@
<?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(__FILE__));
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");
unset($objEditItems);
$objEditItems = new clsUserManager();
$objEditItems->SourceTable = $objSession->GetEditTable("PortalUser");
$objEditItems->EnablePaging = FALSE;
$objCustomFields = new clsCustomFieldList(6);
$objRelList = new clsRelationshipList();
$objImages = new clsImageList();
//$objUserGroupsList = new clsUserGroupList();
//Multiedit init
if ( GetVar('new') == 1)
{
$c = new clsPortalUser(NULL);
$c->Set("CreatedOn", time());
$c->Set("Status", 2);
$en = 0;
$action = "m_add_user";
$objUsers->CreateEmptyEditTable("PortalUserId");
$objRelList->CreateEmptyEditTable("RelationshipId");
$objCustomDataList->CreateEmptyEditTable("CustomDataId");
$objImages->CreateEmptyEditTable("ResourceId");
//$objUserGroupsList->CreateEmptyEditTable("PortalUserId");
}
else
{
$en = GetVar('en');
if (isset($_POST["itemlist"]))
{
$objUsers->CopyToEditTable("ResourceId",$_POST["itemlist"]);
}
$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable);
$first=1;
foreach($objEditItems->Items as $u)
{
$objItemTypes->BuildUserItemTable($u->Get("PortalUserId"),$first);
$first=0;
}
if(isset($_POST["itemlist"]))
{
/* make a copy of the relationship records */
$ids = $objEditItems->GetResourceIDList();
$objRelList->CopyToEditTable("SourceId",$ids);
$objCustomDataList->CopyToEditTable("ResourceId",$ids);
$objImages->CopyToEditTable("ResourceId",$ids);
//$objUserGroupsList->CopyToEditTable("PortalUserId", $ids);
}
$itemcount=$objEditItems->NumItems();
$c = $objEditItems->GetItemByIndex($en);
if($itemcount>1)
{
if ($en+1 == $itemcount)
$en_next = -1;
else
$en_next = $en+1;
if ($en == 0)
$en_prev = -1;
else
$en_prev = $en-1;
}
$action = "m_edit_user";
}
$envar = "env=" . BuildEnv() . "&en=$en";
$section = 'in-portal:edituser_general';
if (strlen($c->Get("Login")))
$editing_title = "'".$c->Get("Login")."' ";
else
$editing_title = "";
$title = prompt_language("la_Text_Editing")." ".prompt_language("la_Text_User")." $editing_title- ".prompt_language("la_tab_General");
//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('edituser','UserEditStatus','".$admin."/users/user_list.php',1);","tool_select.gif");
$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('edituser','UserEditStatus','".$admin."/users/user_list.php',2);","tool_cancel.gif");
if ( isset($en_prev) || isset($en_next) )
{
$url = $RootUrl.$admin."/users/adduser.php";
$StatusField = "UserEditStatus";
$form = "edituser";
MultiEditButtons($objCatToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'','la_PrevUser','la_NextUser');
}
int_header($objCatToolBar,NULL,$title);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
<form ID="edituser" name="edituser" action="" method=POST>
<?php int_subsection_title(prompt_language("la_Text_User")); ?>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_user_login" class="text"><?php echo prompt_language("la_prompt_Usermame"); ?></span></td>
<td>
<input type="text" tabindex="1" name="user_login" ID="user_login" class="text" ValidationType="exists" size="20" value="<?php echo isset($dupe_user) && $dupe_user ? $dupe_user : $c->parsetag("user_login"); ?>">
<span class="validation_error"><?php if( isset($dupe_user) && $dupe_user ) echo admin_language($lvErrorString); ?></span>
</td>
<td></td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span ID="prompt_password" class="text"><?php echo prompt_language("la_prompt_Password"); ?></span></td>
<td>
<input type="password" id="password" tabindex="2" name="password" class="text" ValidationType="password" size="20" value="">
<?php if( !GetVar('new') ) echo prompt_language("la_password_info"); ?>
</td>
<td></td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span ID="prompt_password_verify" class="text"><?php echo prompt_language("la_prompt_PasswordRepeat"); ?></span></td>
<td>
<input type="password" id="password_verify" tabindex="4" name="password_verify" class="text" size="20" value="">
</td>
<td></td>
</tr>
<?php int_subsection_title(prompt_language("la_prompt_PersonalInfo")); ?>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_user_firstname" class="text"><?php echo prompt_language("la_prompt_FirstName"); ?></span></td>
<td>
<input type="text" name="user_firstname" class="text" tabindex="5" size="30" value="<?php echo $c->parsetag("user_firstname"); ?>">
</td>
<td></td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_user_lastname" class="text"><?php echo prompt_language("la_prompt_LastName"); ?></span></td>
<td>
<input type="text" name="user_lastname" class="text" tabindex="6" size="30" value="<?php echo $c->parsetag("user_lastname"); ?>">
</td>
<td></td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span ID="prompt_user_email" class="text"><?php echo prompt_language("la_prompt_Email"); ?></span></td>
<td>
<input type="text" ValidationType="exists" name="user_email" tabindex="7" ID="user_email" class="text" size="30" value="<?php echo $c->parsetag("user_email"); ?>">
</td>
<td><span class="text">&nbsp;</span></td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><SPAN id="prompt_user_dob" class="text"><?php echo prompt_language("la_prompt_birthday"); ?></SPAN></td>
<td>
<input type="text" ValidationType="date,exists" tabindex="8" name="user_dob" id="user_dob_selector" datepickerIcon="<?php echo $adminURL; ?>/images/ddarrow.gif" class="text" size="20" value="<?php echo $c->parsetag("user_dob"); ?>">
<span class="small"><?php echo prompt_language("la_prompt_DateFormat"); ?></span></td>
<td></td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_user_phone" class="text"><?php echo prompt_language("la_prompt_Phone"); ?></span></td>
<td>
<input type="text" name="user_phone" tabindex="9" class="text" size="30" value="<?php echo $c->parsetag("user_phone"); ?>">
</td>
<td><span class="text">&nbsp;</span></td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_user_street" class="text"><?php echo prompt_language("la_prompt_Street"); ?></span></td>
<td>
<input type="text" name="user_street" tabindex="10" class="text" size="40" value="<?php echo $c->parsetag("user_street"); ?>">
</td>
<td><span class="text">&nbsp;</span></td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_user_city" class="text"><?php echo prompt_language("la_prompt_City"); ?></span></td>
<td>
<input type="text" name="user_city" class="text" tabindex="11" size="30" value="<?php echo $c->parsetag("user_city"); ?>">
</td>
<td><span class="text">&nbsp;</span></td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_user_state" class="text"><?php echo prompt_language("la_prompt_State"); ?></span></td>
<td>
<input type="text" name="user_state" class="text" tabindex="12" size="20" value="<?php echo $c->parsetag("user_state"); ?>">
</td>
<td><span class="text">&nbsp;</span></td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_user_zip" class="text"><?php echo prompt_language("la_prompt_Zip"); ?></span></td>
<td>
<input type="text" name="user_zip" class="text" size="15" tabindex="13" value="<?php echo $c->parsetag("user_zip"); ?>">
</td>
<td><span class="text">&nbsp;</span></td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_user_country" class="text"><?php echo prompt_language("la_prompt_Country"); ?></span></td>
<td>
<input type="text" name="user_country" class="text" tabindex="14" size="30" value="<?php echo $c->parsetag("user_country"); ?>">
</td>
<td><span class="text">&nbsp;</span></td>
</tr>
<?php int_subsection_title(prompt_language("la_prompt_Properties")); ?>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_status" class="text"><?php echo prompt_language("la_prompt_Status"); ?></span></td>
<td>
<input type="radio" name="status" class="text" tabindex="15" value="1" <?php if($c->Get("Status") == 1) echo "checked"; ?>><?php echo prompt_language("la_val_Active"); ?>
<input type="radio" name="status" class="text" tabindex="15" value="2" <?php if($c->Get("Status") == 2) echo "checked"; ?>><?php echo prompt_language("la_val_Pending"); ?>
<input type="radio" name="status" class="text" tabindex="15" value="0" <?php if($c->Get("Status") == 0) echo "checked"; ?>><?php echo prompt_language("la_val_Disabled"); ?>
</td>
<td class="text">&nbsp;</td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><SPAN id="prompt_user_date" class="text"><?php echo prompt_language("la_prompt_CreatedOn"); ?></SPAN></td>
<td>
- <input type="text" name="user_date" id="user_date_selector" tabindex="16" datepickerIcon="<?php echo $adminURL; ?>/images/ddarrow.gif" class="text" size="20" value="<?php echo $c->parsetag("user_date"); ?>">
+ <input type="text" name="user_date" id="user_date_selector" tabindex="16" datepickerIcon="<?php echo $adminURL; ?>/images/ddarrow.gif" class="text" size="20" value="<?php echo $c->parsetag("user_datetime"); ?>">
<span class="small"><?php echo prompt_language("la_prompt_DateFormat"); ?></span></td>
<td></td>
</tr>
<?php
$CustomFieldUI = $objCustomFields->GetFieldUIList(TRUE);
if($CustomFieldUI->NumItems()>0)
{
$objCustomDataList->SetTable('edit');
if((int)$c->Get("ResourceId")>0)
$objCustomDataList->LoadResource($c->Get("ResourceId"));
$headings = $CustomFieldUI->GetHeadingList();
//echo "<PRE>";print_r($objCustomFields); echo "</PRE>";
for($i=0;$i<=count($headings);$i++)
{
$h = $headings[$i];
if(strlen($h))
{
int_subsection_title(prompt_language($h));
$Items = $CustomFieldUI->GetHeadingItems($h);
foreach($Items as $f)
{
if ($f->TabIndex)
$n = substr($f->name,1);
$cfield = $objCustomFields->GetItemByField("FieldName",$n,FALSE);
if(is_object($cfield))
{
$cv = $objCustomDataList->GetDataItem($cfield->Get("CustomFieldId"));
if(is_object($cv))
{
$f->default_value = $cv->Get("Value");
}
}
print "<tr ".int_table_color_ret().">\n";
print " <td valign=\"top\"><span class=\"text\">".$f->GetPrompt()."</span></td>\n";
print " <td nowrap>".$f->ItemFormElement(17)."</TD>";
if(is_object($f->NextItem))
{
$n = $f->NextItem;
print " <td>".$n->ItemFormElement(17)."</TD>";
}
else
print " <td><span class=\"text\">&nbsp;</span></td>\n";
print "</tr>\n";
}
}
}
$objCustomDataList->SetTable('live');
}
?>
<tr <?php int_table_color(); ?>>
<td colspan="3">
<input type="hidden" name="Action" value="<?php echo $action; ?>">
<input type="hidden" name="user_id" value="<?php echo $c->Get("PortalUserId"); ?>">
<input type="hidden" name="UserEditStatus" VALUE="0">
</td>
</tr>
</td>
</tr>
</table>
</form>
<script src="<?php echo $adminURL; ?>/include/calendar.js"></script>
<SCRIPT language="JavaScript">
initCalendar("user_date_selector", CalDateFormat);
initCalendar("user_dob_selector", CalDateFormat);
</SCRIPT>
<?php
MarkFields('edituser');
int_footer();
?>
\ No newline at end of file
Property changes on: trunk/admin/users/adduser.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.8
\ No newline at end of property
+1.9
\ No newline at end of property
Index: trunk/admin/logs/email_log.php
===================================================================
--- trunk/admin/logs/email_log.php (revision 401)
+++ trunk/admin/logs/email_log.php (revision 402)
@@ -1,244 +1,245 @@
<?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(__FILE__));
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");
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$adminURL = $rootURL.$admin;
$localURL=$rootURL."kernel/";
$imagesURL = $adminURL."/images";
//admin only includes
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");
$pathtolocal = $pathtoroot;
/* -------------------------------------- Section configuration ------------------------------------------- */
$section = 'in-portal:emaillog';
$envar = "env=" . BuildEnv();
$SortFieldVar = "EmailsL_SortField";
$SortOrderVar = "EmailsL_SortOrder";
$DefaultSortField = "UserName";
$PerPageVar = "Perpage_EmailsL";
$CurrentPageVar = "Page_EmailsL";
$CurrentFilterVar = "EmailsL_View";
$ListForm = "emaillistform";
$CheckClass = "UserChecks";
/* ------------------------------------- Configure the toolbar ------------------------------------------- */
$objListToolBar = new clsToolBar();
$objListToolBar->Set("section",$section);
$objListToolBar->Set("load_menu_func","");
$objListToolBar->Set("CheckClass",$CheckClass);
$objListToolBar->Set("CheckForm",$ListForm);
$listImages = array();
//$img, $alt, $link, $onMouseOver, $onMouseOut, $onClick
$objListToolBar->Add("log_refresh", "la_ToolTip_Refresh","#","swap('log_refresh','toolbar/tool_refresh_f2.gif');",
"swap('log_refresh', 'toolbar/tool_refresh.gif');","window.location.reload(true);",
"tool_refresh.gif");
$objListToolBar->Add("log_reset","la_ToolTip_Reset","#", "swap('log_reset','toolbar/tool_reset_f2.gif');",
"swap('log_reset', 'toolbar/tool_reset.gif');","$CheckClass.check_submit('email_log', 'm_purge_email_log');",
"tool_reset.gif",TRUE,TRUE);
//$listImages[] = "$CheckClass.addImage('log_reset','$imagesURL/toolbar/tool_disconnect.gif','$imagesURL/toolbar/tool_disconnect_f3.gif',1);\n ";
//$listImages[] = "$CheckClass.addImage('log_reset','$imagesURL/toolbar/tool_disconnect.gif','$imagesURL/toolbar/tool_disconnect_f3.gif',1);\n ";
$objListToolBar->Add("divider");
$objListToolBar->Add("user_print", "la_ToolTip_Print","#","swap('user_print','toolbar/tool_print_f2.gif');",
"swap('user_print', 'toolbar/tool_print.gif');","window.print();","tool_print.gif");
$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);
$objListToolBar->AddToInitScript("fwLoadMenus();");
if($_GET["resetpage"]==1)
$objSession->SetVariable("Page_EmailsL","1");
+$objEmailLogList = new clsEmailLogList();
$order = $objConfig->Get("EmailsL_SortOrder");
$SearchWords = $objSession->GetVariable("EmailsLSearchWord");
if(strlen($SearchWords))
{
- $where = $objSession->AdminSearchWhereClause($SearchWords);
+ $where = $objEmailLogList->AdminSearchWhereClause($SearchWords);
}
else
$where = "";
if(strlen($SessionFilter)>0)
{
if(strlen($where))
$where.= " AND ";
$where.=$SessionFilter;
}
$sql = "SELECT EmailLogId, fromuser, addressto, subject, event, FROM_UNIXTIME(timestamp,'%m-%d-%Y %H:%i:%s') as time_sent FROM ".GetTablePrefix()."EmailLog";
if(strlen($where)) {
- $sql .= "AND ".$where;
+ $sql .= " WHERE ".$where;
}
$orderBy = trim($objConfig->Get("EmailsL_SortField")." ".$objConfig->Get("EmailsL_SortOrder"));
if ($orderBy == 'asc') {
$objConfig->Set("EmailsL_SortField", "time_sent");
$orderBy = "time_sent ".$orderBy;
}
if ($orderBy == 'desc') {
$objConfig->Set("EmailsL_SortField", "time_sent");
$orderBy = "time_sent ".$orderBy;
}
if(strlen($orderBy))
$sql .=" ORDER BY ".$orderBy;
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."<br>\n";
$objListView = new clsListView($objListToolBar);
$objListView->CurrentPageVar = "Page_EmailsL";
$objListView->PerPageVar = "Perpage_EmailsL";
$objUsers->Query_Item( $sql, $objListView->GetLimitSQL() );
$itemcount = TableCount(GetTablePrefix()."EmailLog", $where,0);
$objListView->SetListItems($objUsers);
$objListView->IdField = "EmailLogId";
$objListView->PageLinkTemplate = $pathtoroot.$admin."/templates/user_page_link.tpl";
$objListView->ColumnHeaders->Add("fromuser",admin_language("la_prompt_FromUsername"),1,0,$order,"width=\"35%\"","EmailsL_SortField","EmailsL_SortOrder","fromuser");
$objListView->ColumnHeaders->Add("addressto",admin_language("la_prompt_AddressTo"),1,0,$order,"width=\"20%\"","EmailsL_SortField","EmailsL_SortOrder","addressto");
$objListView->ColumnHeaders->Add("subject",admin_language("la_prompt_Subject"),1,0,$order,"width=\"10%\"","EmailsL_SortField","EmailsL_SortOrder","subject");
$objListView->ColumnHeaders->Add("event",admin_language("la_prompt_Event"),1,0,$order,"width=\"15%\"","EmailsL_SortField","EmailsL_SortOrder","event");
$objListView->ColumnHeaders->Add("time_sent",admin_language("la_prompt_SentOn"),1,0,$order,"width=\"20%\"","EmailsL_SortField","EmailsL_SortOrder","time_sent");
$objListView->ColumnHeaders->SetSort($objConfig->Get("EmailsL_SortField"),$order);
$objListView->PrintToolBar = FALSE;
$objListView->SearchBar = TRUE;
$objListView->SearchKeywords = $SearchWords;
$objListView->SearchAction="m_emaillog_search";
$objListView->CheckboxName = "itemlist[]";
$objListView->TotalItemCount = $itemcount;
$objListView->ConfigureViewMenu($SortFieldVar,$SortOrderVar,$DefaultSortField,
$CurrentFilterVar,$SessionView,$Bit_All);
$title = admin_language("la_Show_EmailLog")." (".$objUsers->NumItems().")";
$h = "\n\n<SCRIPT Language=\"JavaScript1.2\">\n".$objListView->GetViewMenu($imagesURL)."\n</SCRIPT>\n";
int_header($objListToolBar,NULL, $title,NULL,$h);
?>
<FORM method="POST" ACTION="" NAME="emaillistform" ID="emaillistform">
<?php
print $objListView->PrintList();
?>
<input type="hidden" name="Action" value="">
</FORM>
<!-- CODE FOR VIEW MENU -->
<form ID="viewmenu" method="post" action="<?php echo $_SERVER["PHP_SELF"]."?env=".BuildEnv(); ?>" 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>
<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>
<script src="<?php echo $adminURL; ?>/listview/listview.js"></script>
<script>
initSelectiorContainers();
<?php echo $objListToolBar->Get("CheckClass").".setImages();"; ?>
</script>
<!-- END CODE-->
<?php int_footer(); ?>
Property changes on: trunk/admin/logs/email_log.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.3
\ No newline at end of property
+1.4
\ No newline at end of property
Index: trunk/admin/include/elements.php
===================================================================
--- trunk/admin/include/elements.php (revision 401)
+++ trunk/admin/include/elements.php (revision 402)
@@ -1,612 +1,611 @@
-
<?php
##############################################################
##In-portal :: Administration Interfaces :: Common Elements ##
##############################################################
## 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( !isset($is_install) ) $is_install = false;
if(!$is_install)
{
if (!admin_login())
{
if(!headers_sent()) {
setcookie("sid"," ",time()-3600);
echo "Test";
}
$objSession->Logout();
header("Location: ".$adminURL."/login.php");
die();
//require_once($pathtoroot."admin/login.php");
}
}
global $admin,$pathtoroot, $objConfig;
if(!strlen($admin))
{
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
{
$admin = "admin";
}
}
require_once($pathtoroot.$admin."/include/sections.php");
$envar = "env=" . BuildEnv();
/* this function loads the javascript for each module's toolbar */
function load_module_javascript($sectionname, $skip_modules = Array() )
{
global $adminURL, $pathtoroot;
echo "<SCRIPT LANGUAGE=JavaScript1.2 src=\"".$adminURL."/browse/fw_menu.js\"></SCRIPT>\n";
echo "<SCRIPT LANGUAGE=JavaScript1.2 src=\"".$adminURL."/include/tabs.js\"></SCRIPT>\n";
echo "<script language=\"JavaScript1.2\" src=\"$adminURL/include/checkarray.js\"></script>\n";
global $objConfig, $ItemTabs;
$m = GetModuleArray("admin");
echo "<!-- ".count($m)."-->";
foreach($m as $key=>$value)
{
$path = $pathtoroot. $value."admin/include/toolbar/".$sectionname.".php";
if( !in_array($value, $skip_modules) && file_exists($path) )
{
echo "\n<!-- $path -->\n";
include_once($path);
}
else
echo "\n<!-- $path not found -->\n";
}
}
function load_module_styles()
{
global $objConfig, $ItemTabs,$rootURL,$pathtoroot;
$m = GetModuleArray("admin");
echo "<!-- module styles (".count($m).")-->";
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value."admin/include/style.css";
if(file_exists($path))
{
$inc = $rootURL.$value."admin/include/style.css";
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$inc\">\n";
}
}
}
//***********************************
//Page Header
function int_header($toolbar=NULL,$NavBarText=NULL,$ExtraTitle=NULL,$onLoad=NULL, $ExtraHead=NULL,$skip_modules=Array())
{
global $pathtoroot;
global $pathtolocal;
global $section;
global $objSections;
global $rootURL;
global $localURL;
global $adminURL;
global $envar;
global $admin;
global $metatag;
$style_sheet_global = $adminURL."/include/style.css";
$style_sheet_local = $localURL."admin/include/style.css";
$ExtraTitle = htmlentities($ExtraTitle);
if (is_object($toolbar))
{
if(file_exists($pathtolocal."admin/include/toolbar.php"))
require_once ($pathtolocal."admin/include/toolbar.php");
//Aray of the preloaded elems
//$int_toolbar_preload = array();
print "<html><head><title>In-portal</title>\n";
if(strlen($metatag))
{
print $metatag."\n";
}
else
{
print "<meta http-equiv=\"content-type\" content=\"text/html;charset=iso-8859-1\">\n";
print "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n";
}
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$style_sheet_global\">\n";
load_module_styles();
require_once($pathtoroot.$admin."/include/mainscript.php");
//require_once($pathtolocal."admin/include/script.js");
print $ExtraHead;
$sectionname = explode(":", $section);
$sectionname = $sectionname[sizeof($sectionname)-1];
load_module_javascript($sectionname, $skip_modules);
if(is_object($toolbar))
print $toolbar->GetInitScript();
print '</head><body topmargin="0" leftmargin="8" marginheight="8" marginwidth="8" bgcolor="#FFFFFF"';
//*** Preload toolbar images
if(strlen($onLoad))
{
print $onLoad;
}
else
print " ONLOAD=\"clear_list_checkboxes();\"";
//*** Preload toolbar images
if(is_object($toolbar))
{
if (strlen($toolbar->Get("CheckClass")))
{
print $toolbar->onLoadString().">";
}
else
print " >";
$menufunc = $toolbar->Get("load_menu_func");
if (strlen($menufunc))
{
print "<script language=\"JavaScript1.2\">$menufunc</script>";
}
}
else
print " >";
}
else
{
print "<html><head><title>In-Portal </title>";
print "<meta http-equiv=\"content-type\" content=\"text/html;charset=iso-8859-1\">";
print "<meta http-equiv=\"Pragma\" content=\"no-cache\">";
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$style_sheet_global\">";
load_module_styles();
require_once ($pathtoroot.$admin."/include/mainscript.php");
//require_once ($pathtolocal."admin/include/script.js");
$sectionname = explode(":", $section);
$sectionname = $sectionname[sizeof($sectionname)-1];
load_module_javascript($sectionname);
print "</head><body topmargin=\"0\" leftmargin=\"8\" marginheight=\"8\" marginwidth=\"8\" bgcolor=\"#FFFFFF\">";
}
if(strlen($section)>0)
{
$objSections->SetCurrentSection($section);
$sec = $objSections->GetCurrentSection();
if ($sec->Get("notitle") != 1) print $objSections->page_title();
print $objSections->page_tabs($envar);
if ($sec->Get("nonavbar") != 1) //Section Navigatior
print $objSections->section_header($envar,$NavBarText,$ExtraTitle);
//Toolbar if appropriate
if ( isset($sections[$section]) && ($sections[$section]['toolbar']==1) || ( is_object($toolbar) ) )
print $toolbar->Build();
}
}//Page Header
// HELP Page Header
function int_help_header()
{
global $pathtoroot;
global $pathtolocal;
global $section;
global $objSections;
global $rootURL;
global $localURL;
global $adminURL;
global $envar;
global $admin;
global $metatag;
$style_sheet_global = $adminURL."/include/style.css";
$style_sheet_local = $localURL."admin/include/style.css";
$ExtraTitle = htmlentities($ExtraTitle);
// TOOLBAR:
print "<html><head><title>In-Portal - Help</title>";
print "<meta http-equiv=\"content-type\" content=\"text/html;charset=iso-8859-1\">";
print "<meta http-equiv=\"Pragma\" content=\"no-cache\">";
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$style_sheet_global\">";
load_module_styles();
require_once ($pathtoroot.$admin."/include/mainscript.php");
print "</head><body topmargin=\"0\" leftmargin=\"8\" marginheight=\"8\" marginwidth=\"8\" bgcolor=\"#FFFFFF\">";
if(strlen($section)>0)
{
$objSections->SetCurrentSection($section);
$sec = $objSections->GetCurrentSection();
if ($sec->Get("notitle") != 1) print $objSections->page_title();
if ($sec->Get("nonavbar") != 1) //Section Navigatior
print $objSections->section_header($envar,$NavBarText,$ExtraTitle, true);
}
}// HELP Page Header
function int_SectionHeader($toolbar=NULL,$onLoad=NULL,$NavBarText=NULL,$ExtraTitle=NULL)
{
global $pathtoroot;
global $pathtolocal;
global $section, $sections;
global $objSections;
global $rootURL;
global $adminURL,$admin;
global $localURL;
global $envar;
global $b_topmargin;
if (!isset($b_topmargin))
$b_topmargin = 8;
$sectionname = explode(":", $section);
$sectionname = $sectionname[sizeof($sectionname)-1];
load_module_javascript($sectionname);
if(is_object($toolbar))
print $toolbar->GetInitScript();
print "</head><body topmargin=\"$b_topmargin\" leftmargin=\"8\" marginheight=\"$b_topmargin\" marginwidth=\"8\" bgcolor=\"#FFFFFF\"";
//*** Preload toolbar images
if(strlen($onLoad))
{
print $onLoad;
}
else
print " onload=\"if (clear_checkboxes) clear_checkboxes();\"";
print ">";
global $b_header_addon;
if (isset($b_header_addon)) echo $b_header_addon;
if(strlen($section)>0)
{
$objSections->SetCurrentSection($section);
$sec = $objSections->GetCurrentSection();
if ($sec->Get("notitle")!=1)
print $objSections->page_title();
print $objSections->page_tabs($envar);
//Section Navigatior
if ($sec->Get("nonavbar")!=1)
{
if (is_null($ExtraTitle))
$ExtraTitle = "";
print $objSections->section_header($envar,$NavBarText,$ExtraTitle);
}
//Toolbar if appropriate
if( isset($sections[$section]) )
if($sections[$section]['toolbar'] == 1 || (is_object($toolbar)) )
print $toolbar->Build();
}
}//Section Page Header
//***********************************
//SubSection Title
function int_subsection_title($caption, $ColSpan = 5)
{
int_table_color(1);
print <<<END
<!-- Subsection Title -->
<tr class="subsectiontitle">
<td colspan="$ColSpan">$caption</td>
</tr>
END;
}
function int_subsection_title_install($caption)
{
int_table_color(1);
print <<<END
<!-- Subsection Title -->
<tr class="subsectiontitle">
<td colspan="3">$caption</td>
</tr>
END;
}
function int_subsection_title_ret($caption)
{
int_table_color_ret(1);
$o = "<!-- Subsection Title --><tr class=\"subsectiontitle\"><td colspan=\"5\">$caption</td></tr>";
return $o;
}
//SubSection Title
//***********************************
//Table Alternating colors
function int_table_color($reset_color=0, $return_result = false)
{
static $colorset;
if($reset_color)
{ $colorset="table_color2";
return;
}
if ($colorset == "table_color1")
$colorset = "table_color2";
else
$colorset = "table_color1";
$ret = "class=\"".$colorset."\"";
if($return_result)
return $ret;
else
print $ret;
}//Table Alternating colors
//Table Alternating colors with return
function int_table_color_ret($reset_color=0)
{
static $colorset;
if($reset_color)
{ $colorset="table_color2";
return;
}
if ($colorset == "table_color1")
$colorset = "table_color2";
else
$colorset = "table_color1";
return "class=\"".$colorset."\"";
}//Table Alternating colors
//***********************************
//Hint
function int_hint($caption)
{
global $imagesURL;
print <<<END
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td>
<span class="hint"><img src="$imagesURL/smicon7.gif" width="14" height="14" align="absmiddle">$caption</span>
<td>
</tr>
</table>
END;
}//Hint
function int_hint_red($caption)
{
global $imagesURL;
print <<<END
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td>
<span class="hint_red">$caption</span>
<td>
</tr>
</table>
END;
}//Hint
//***********************************
//Navigation String
function int_nav($caption)
{
global $pathtoroot;
global $imagespath;
print <<<END
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#f0f0f0">
<tr>
<td><b class="text"><span class="navbar"><a class="navbar" href="">$caption</a></span></b></td>
</tr>
</table>
END;
}//Navigation String
//***********************************
//Print Out Images
function int_img($img)
{
global $images;
global $pathtoroot;
global $imagesURL;
$src = $imagesURL."/".$images[$img]['file'];
$alt = $images[$img]['alt'];
$width = $images[$img]['width'];
$height = $images[$img]['height'];
$name = $img;
//Set ID if needed
if ($img == 'img:tool:view')
$id = "ID=\"viewbutton\"";
print "<img alt=\"$alt\" name=\"$name\" src=\"$src\" width=\"$width\" height=\"$height\" $id border=\"0\" align=\"absmiddle\">";
}//Print Out Images
//***********************************
//Page Footer
function int_footer()
{
global $objSession;
if($objSession->HasSystemPermission("DEBUG.INFO"))
{
//phpinfo();
}
print <<<END
</body>
</html>
END;
}//Page Footer
function HomeEnv()
{
global $m_var_list_update;
$m_var_list_update["cat"]=0;
return BuildEnv();
}
function UpEnv()
{
global $m_var_list_update,$objCatList;
$current = $objCatList->CurrentCat();
$parent = $current->Get("ParentId");
$m_var_list_update["cat"]=$parent;
return BuildEnv();
}
function ModuleInclude($file)
{
global $pathtoroot;
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value.$file;
if(file_exists($path))
{
echo "<!-- $path -->";
@include_once($path);
}
}
}
function MultiEditButtons(&$ToolBar,$next,$prev,$Form,$StatusField, $url,$onClick, $ExtraVar="", $prev_phrase = 'Phrase Not Passed', $next_phrase = 'Phrase Not Passed')
{
global $adminURL;
$ToolBar->Add("divider");
if($prev>-1)
{
$MouseOver="swap('moveleft','toolbar/tool_prev_f2.gif');";
$MouseOut="swap('moveleft', 'toolbar/tool_prev.gif');";
$var="env=".BuildEnv()."&en=$prev&lpn=".GetVar('lpn');
if (strlen($ExtraVar))
$var.= $ExtraVar;
if ($onClick != 'LangSubmitMove') {
$link = "javascript:edit_submit('$Form','$StatusField','$url',0,'$var');";
}
else {
$link = "javascript:$onClick('$url', '$prev')";
}
$ToolBar->Add("moveleft",$prev_phrase,$link,$MouseOver,$MouseOut,"","toolbar/tool_prev.gif");
}
else
{
$MouseOver="";
$MouseOut="";
//$onClick="";
$link="#";
$ToolBar->Add("moveleft",$prev_phrase,"#","","","","toolbar/tool_prev_f3.gif");
}
if($next>-1)
{
$MouseOver="swap('moveright','toolbar/tool_next_f2.gif');";
$MouseOut="swap('moveright', 'toolbar/tool_next.gif');";
$var="env=".BuildEnv()."&en=$next".( isset($_REQUEST['lpn']) ? '&lpn='.$_REQUEST['lpn'] : '');
if (strlen($ExtraVar))
$var.= $ExtraVar;
if ($onClick != 'LangSubmitMove') {
$link = "javascript:edit_submit('$Form','$StatusField','$url',0,'$var');";
}
else {
$link = "javascript:$onClick('$url', '$next')";
}
$ToolBar->Add("moveright",$next_phrase,$link,$MouseOver,$MouseOut,"","toolbar/tool_next.gif");
}
else
{
$ToolBar->Add("moveright",$next_phrase,"#","","","","toolbar/tool_next_f3.gif");
}
}
function InsertButtons(&$ToolBar, $Buttons = Array(), $params = Array() )
{
foreach($Buttons as $button)
switch($button)
{
case 'save':
$ToolBar->Add( "img_save", "la_Save", "#",
"swap('img_save','toolbar/tool_select_f2.gif');",
"swap('img_save', 'toolbar/tool_select.gif');",
"edit_submit('".$params['form']."','".$params['status_field']."','".$params['url']."',1,'&lpn=".$_REQUEST['lpn']."');","tool_select.gif");
break;
case 'cancel':
$ToolBar->Add( "img_cancel", "la_Cancel", "#",
"swap('img_cancel','toolbar/tool_cancel_f2.gif');",
"swap('img_cancel', 'toolbar/tool_cancel.gif');",
"edit_submit('".$params['form']."','".$params['status_field']."','".$params['url']."',2,'&lpn=".$_REQUEST['lpn']."');","tool_cancel.gif");
break;
case 'edit':
break;
case 'delete':
break;
}
}
function GetTitle($item_phrase, $tab_phrase, $id)
{
// gets correct caption for editing windows with tabs
//echo "In: $item_phrase, $tab_phrase, $id";
$is_new = isset($_REQUEST['new']) && ($_REQUEST['new'] == 1) ? 1 : 0;
$text = $is_new ? 'la_Text_Adding' : 'la_Text_Editing';
$text = admin_language($text).' '.admin_language($item_phrase);
if($is_new == 0) $text .= ' #'.$id;
$text .= ' - '.admin_language($tab_phrase);
return $text;
}
function MarkFields($form_name)
{
// mark specified form fields as required
?> <script language="JavaScript">MarkAsRequired(document.getElementById("<?php echo $form_name; ?>"));</script> <?php
}
?>
Property changes on: trunk/admin/include/elements.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.8
\ No newline at end of property
+1.9
\ No newline at end of property
Index: trunk/admin/help/install_help.php
===================================================================
--- trunk/admin/help/install_help.php (revision 401)
+++ trunk/admin/help/install_help.php (revision 402)
@@ -1,144 +1,144 @@
<?php
define('THIS_FILE', 'admin/help/install_help.php');
$pathtoroot = "";
if(!strlen($pathtoroot))
{
//$path=dirname(realpath(__FILE__));PATH_TRANSLATED
$path=dirname(realpath(__FILE__));
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;
}
}
function GetPathChar($path = null)
{
if( !isset($path) ) $path = $GLOBALS['pathtoroot'];
$pos = strpos($path, ':');
return ($pos === false) ? "/" : "\\";
}
$path_char = GetPathChar();
-$rootURL = 'http://'.dirname($_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);
+$rootURL = 'http://'.dirname($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']);
$rootURL = str_replace('/help','',$rootURL);
$tmp = explode('/', $rootURL);
if( $tmp[ count($tmp) - 1 ] == $admin) unset( $tmp[ count($tmp) - 1 ] );
$rootURL = implode('/', $tmp).'/';
unset($tmp);
function print_pre($s)
{
echo '<pre>'.print_r($s, true).'</pre>';
}
$section = $_REQUEST['section'];
$section = explode(':', $section);
if($section[0] == 'in-portal') $section[0] = 'kernel';
$topic_path = str_replace(THIS_FILE, '', $_SERVER['PATH_TRANSLATED']).$section[0].'/admin/include/help/'.$section[1].'.txt';
//echo "TP: $topic_path<br>";
?>
<html>
<head>
<title>In-Portal - Help</title>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta http-equiv="Pragma" content="no-cache">
<link rel="stylesheet" type="text/css" href="<?php echo $rootURL; ?>include/style.css">
</head>
<body topmargin="0" leftmargin="8" marginheight="8" marginwidth="8" bgcolor="#FFFFFF">
<DIV style='position:relative; z-Index: 1; background-color: #ffffff; padding-top:1px;'>
<div style='position:absolute; width:100%;top:0px;' align='right'>
<img src='<?php echo $rootURL; ?>images/logo_bg.gif'>
</div>
<img src="<?php echo $rootURL; ?>images/spacer.gif" width="1" height="7"><br>
<div style='z-Index:1; position:relative'>
<!-- ADMIN TITLE -->
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr><td valign="top" class="admintitle" align="left">
<img alt="" width="46" height="46" src="<?php echo $rootURL; ?>images/icon_install.gif" align="absmiddle">&nbsp;Installtion Help<br>
<img src='<?php echo $rootURL; ?>images/spacer.gif' width=1 height=4><br>
</td></tr></table>
<!-- SECTION NAVIGATOR -->
<table border="0" cellpadding="2" cellspacing="0" class="tableborder_full" width="100%" height="30"><tr>
<TD class="header_left_bg" width="100%">
<span class="tablenav_link">Install</span>
</td>
<td align="right" class="tablenav" background="<?php echo $rootURL; ?>images/tabnav_back.jpg" width="10">
</td>
</tr>
</table>
<!-- END SECTION NAVIGATOR -->
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
<tr>
<td bgcolor="F6F6F6">
<div class="help_box">
<?php
if( file_exists($topic_path) )
{
echo file_get_contents($topic_path);
}
?>
</h3> </div>
</td>
</tr>
</table>
</body>
</html>
\ No newline at end of file
Property changes on: trunk/admin/help/install_help.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Index: trunk/admin/install.php
===================================================================
--- trunk/admin/install.php (revision 401)
+++ trunk/admin/install.php (revision 402)
@@ -1,1887 +1,1887 @@
<?php
error_reporting(0);
define("GET_LICENSE_URL", "http://www.intechnic.com/myaccount/license.php");
define('BACKUP_NAME', 'dump(.*).txt'); // how backup dump files are named
$general_error = '';
$pathtoroot = "";
if(!strlen($pathtoroot))
{
$path=dirname(realpath(__FILE__));
//$path=dirname(realpath(__FILE__));
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;
}
}
$path_char = GetPathChar();
//phpinfo(INFO_VARIABLES);
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
$pathtoroot = $pathtoroot.$pathchar;
}
if( file_exists($pathtoroot.'debug.php') && !defined('DEBUG_MODE') ) include_once($pathtoroot.'debug.php');
$is_install = TRUE;
$admin = substr($path,strlen($pathtoroot));
$state = isset($_GET["state"]) ? $_GET["state"] : '';
if(!strlen($state))
{
$state = isset($_POST['state']) ? $_POST['state'] : '';
}
include($pathtoroot.$admin."/install/install_lib.php");
$install_type = GetVar('install_type', true);
$force_finish = isset($_REQUEST['ff']) ? true : false;
$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']);
+ $rootURL = 'http://'.dirname($_SERVER['HTTP_HOST'].$_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( isset($g_DBType) && $g_DBType && 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">&nbsp;</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();
$installed = $ado ? TableExists($ado,"ConfigurationAdmin,Category,Permissions") : false;
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")
{
$login_err_mesg = ''; // always init vars before use
if( !isset($g_License) ) $g_License = '';
$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=".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['HTTP_HOST']), "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 == '' && $g_License != '')) {
$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;
$lic_login = isset($_POST['login']) ? $_POST['login'] : '';
$lic_password = isset($_POST['password']) ? $_POST['password'] : '';
if ($lic_login != '' && $lic_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=".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['HTTP_HOST']), "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=".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));
// old licensing script doen't return 2nd parameter (licanse code)
if( isset($tmp_data[1]) ) 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;
$tmp_lic_opt = GetVar('lic_opt', true);
switch($tmp_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:
//set_ini_value("Intechnic","License",base64_encode("local"));
//set_ini_value("Intechnic","LicenseCode",base64_encode("local"));
//save_values();
$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 ( !isset($install_type) || $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) || !count($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");
$NewLang = false;
}
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;
}
$next_step = GetVar('next_step', true);
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)
{
$next_step = GetVar('next_step', true);
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( !isset($objTagList) || !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"];
+ //set_ini_value("Site","DomainName",$_SERVER["HTTP_HOST"]);
+ //$g_DomainName= $_SERVER["HTTP_HOST"];
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=".GetMaxPortalVersion($pathtoroot.$admin)."&domain=".md5($_SERVER['SERVER_NAME']), "r");
+ $rfile = @fopen(GET_LICENSE_URL."?url=".base64_encode($_SERVER['HTTP_HOST'].$_POST['Site_Path'])."&modules=".base64_encode($modules_str)."&license_code=".base64_encode($g_LicenseCode)."&version=".GetMaxPortalVersion($pathtoroot.$admin)."&domain=".md5($_SERVER['HTTP_HOST']), "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>";
}
// init variables
$vars = Array('db_error','restore_error','PassError','DomainError','login_error','inst_error');
foreach($vars as $var_name) ReSetVar($var_name);
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;
}
$tmp_step = GetVar('next_step', true);
if (!$tmp_step) {
$tmp_step = 1;
}
if ( isset($got_license) && $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
$lic_opt = isset($_POST['lic_opt']) ? $_POST['lic_opt'] : false;
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 || $lic_opt == 1) { ?>class="current"<?php } ?>>Select License
<li <?php if ($tmp_step == 3 && $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 == '') || $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 == '') || $lic_opt == 1) { ?>class="current"<?php } ?>>Select License
<li <?php if ($tmp_step == 3 && $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 if( isset($title) ) echo $title;?></td>
</tr>
<tr>
<td class="text"><?php if( isset($help) ) echo $help;?></td>
</tr>
</table>
</td>
</tr>
</table>
<br>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td id="footer">
Powered by In-portal &copy; 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.46
\ No newline at end of property
+1.47
\ No newline at end of property
Index: trunk/admin/install/settings.php
===================================================================
--- trunk/admin/install/settings.php (revision 401)
+++ trunk/admin/install/settings.php (revision 402)
@@ -1,41 +1,41 @@
<td>
<img src="images/icon_install.gif" width="46" height="46" alt="" align="absmiddle">&nbsp;<span class="admintitle">Set Root Password</span><br><br>
<?php section_header('Step '.$tmp_step.' - Set Root Password'); ?>
<table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar">
<?php include("install/toolbar.php"); ?>
</table>
<!-- toolbar button \\-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
<tr valign="top">
<td width="60%" bgcolor="#F0F0F0">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4">
<tr class="table_color2">
<td class="txt">
<b>Enter the URL which the In-Portal root directory (<I><?php echo $path; ?></I>) corresponds to on your web server.</b></td>
<td>
http://
- <input TYPE="TEXT" class="text" NAME="domain" VALUE="<?php echo $_SERVER["SERVER_NAME"]; ?>">
+ <input TYPE="TEXT" class="text" NAME="domain" VALUE="<?php echo $_SERVER['HTTP_HOST']; ?>">
<?php
$pathguess =substr($_SERVER["SCRIPT_NAME"],0,-17);
?>
<input type="text" name="site" class="text" VALUE="<?php echo $pathguess; ?>">
</td>
</tr>
<tr class="table_color2">
<td colspan="2"><p class="error"><?php echo $PassError; ?></p><br/></td>
</tr>
<td>
<br>
<input TYPE="hidden" NAME ="state" VALUE="server_settings_save">
<input type="hidden" name="next_step" value="<?php echo $next_step;?>">
<input type="hidden" name="install_type" value="<?php echo $install_type;?>">
<input type="submit" name="submit_form" value="Login" class="button">
<input type="reset" name="Cancel" value="Cancel" class="button" ONCLICK = "history.go(-1);">
<input type="hidden" name="UserPass" VALUE="<?php echo $UserPass; ?>">
<input type="hidden" name="UserName" VALUE="<?php echo $UserName; ?>">
</td>
</tr>
</table>
</td>
\ No newline at end of file
Property changes on: trunk/admin/install/settings.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/download_license.php
===================================================================
--- trunk/admin/install/download_license.php (revision 401)
+++ trunk/admin/install/download_license.php (revision 402)
@@ -1,42 +1,42 @@
<td>
<img src="images/icon_install.gif" width="46" height="46" alt="" align="absmiddle">&nbsp;<span class="admintitle">Select License</span><br><br>
<?php
$stmp_step = $tmp_step;
section_header('Step '.$stmp_step.' - Select License');
?>
<table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar">
<?php include("install/toolbar.php"); ?>
</table>
<!-- toolbar button \\-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
<tr valign="top">
<td width="60%" bgcolor="#F0F0F0">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4">
<tr class="table_color2">
<td ALIGN="left" class="txt"><b>Domain:</b></td>
- <td ALIGN="left" class="txt"><input type="text" readonly name="domain" value="<?php echo $_SERVER['SERVER_NAME']?>"></td>
+ <td ALIGN="left" class="txt"><input type="text" readonly name="domain" value="<?php echo $_SERVER['HTTP_HOST']?>"></td>
</tr>
<tr class="table_color2">
<td ALIGN="left" class="txt"><b>Available licenses:</b></td>
<td ALIGN="left" class="txt"><?php echo $license_select;?></td>
</tr>
<tr class="table_color2">
<td colspan="2"><p class="error"><?php if( isset($download_license_error) ) echo $download_license_error; ?></p><br/></td>
</tr>
<td>
<br>
<input TYPE="hidden" NAME ="state" VALUE="download_license">
<input type="submit" name="submit_form" value="Continue" class="button">
<input type="reset" name="Cancel" value="Cancel" class="button" ONCLICK = "history.go(-1);">
<input type="hidden" name="UserPass" VALUE="<?php echo $UserPass; ?>">
<input type="hidden" name="UserName" VALUE="<?php echo $UserName; ?>">
<input type="hidden" name="dlog" VALUE="<?php echo $_POST['login']; ?>">
<input type="hidden" name="dpass" VALUE="<?php echo $_POST['password']; ?>">
<input type="hidden" name="next_step" value="<?php echo $next_step;?>">
<input type="hidden" name="install_type" value="<?php echo $install_type;?>">
</td>
</tr>
</table>
</td>
\ No newline at end of file
Property changes on: trunk/admin/install/download_license.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Index: trunk/admin/install/upgrades/inportal_upgrade_v1.0.7.sql
===================================================================
--- trunk/admin/install/upgrades/inportal_upgrade_v1.0.7.sql (revision 401)
+++ trunk/admin/install/upgrades/inportal_upgrade_v1.0.7.sql (revision 402)
@@ -1,26 +1,27 @@
CREATE TABLE EmailLog (
EmailLogId int(11) NOT NULL auto_increment,
fromuser varchar(200) default NULL,
addressto varchar(255) default NULL,
subject varchar(255) default NULL,
timestamp bigint(20) default '0',
event varchar(100) default NULL,
PRIMARY KEY (EmailLogId)
)
CREATE TABLE ImportScripts (
is_id smallint(5) unsigned NOT NULL auto_increment,
is_Module varchar(50) NOT NULL default '',
is_string_id varchar(10) NOT NULL default '',
is_script varchar(100) NOT NULL default '',
is_label varchar(255) NOT NULL default '',
is_field_prefix varchar(50) NOT NULL default '',
is_requred_fields varchar(255) NOT NULL default '',
is_enabled tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (is_id)
)
INSERT INTO ConfigurationValues VALUES ('EmailsL_SortField', 'time_sent', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Perpage_EmailsL', '20', 'In-Portal', '');
+UPDATE ConfigurationValues SET VariableValue = 'u.CreatedOn' WHERE VariableName = 'User_SortField';
UPDATE Modules SET Version = '1.0.7' WHERE Name = 'In-Portal';
\ No newline at end of file
Property changes on: trunk/admin/install/upgrades/inportal_upgrade_v1.0.7.sql
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.5
\ No newline at end of property
+1.6
\ No newline at end of property
Index: trunk/admin/install/inportal_data.sql
===================================================================
--- trunk/admin/install/inportal_data.sql (revision 401)
+++ trunk/admin/install/inportal_data.sql (revision 402)
@@ -1,281 +1,281 @@
INSERT INTO ConfigurationAdmin VALUES ('Site_Name', 'la_Text_Website', 'la_config_website_name', 'text', '', '', 7, 1);
INSERT INTO ConfigurationAdmin VALUES ('Site_Path', 'la_Text_Website', 'la_config_web_address', 'text', '', '', 6, 1);
INSERT INTO ConfigurationAdmin VALUES ('Backup_Path', 'la_Text_BackupPath', 'la_config_backup_path', 'text', '', '', 6, 1);
INSERT INTO ConfigurationAdmin VALUES ('Domain_Detect', 'la_Text_Website', 'la_config_detect_domain', 'text', '', '', 8, 1);
INSERT INTO ConfigurationAdmin VALUES ('Category_Sortfield', 'la_Text_General', 'la_category_sortfield_prompt', 'select', '', 'Name=la_Category_Name,Description=la_Category_Description,CreatedOn=la_Category_Date,EditorsPick=la_Category_Pick,Pop=la_Category_Pop,<SQL>SELECT FieldLabel as OptionName, FieldName as OptionValue FROM CustomField WHERE Type=0</SQL>', 1, 1);
INSERT INTO ConfigurationAdmin VALUES ('Category_Sortorder', 'la_Text_General', 'la_category_sortfield_prompt', 'select', '', 'asc=la_common_ascending,desc=la_common_descending', 2, 1);
INSERT INTO ConfigurationAdmin VALUES ('Category_Sortfield2', 'la_Text_General', 'la_category_sortfield2_prompt', 'select', '', 'Name=la_Category_Name,Description=la_Category_Description,CreatedOn=la_Category_Date,EditorsPick=la_Category_Pick,Pop=la_Category_Pop,<SQL>SELECT FieldLabel as OptionName, FieldName as OptionValue FROM CustomField WHERE Type=0</SQL>', 3, 1);
INSERT INTO ConfigurationAdmin VALUES ('Category_Sortorder2', 'la_text_General', 'la_category_sortfield2_prompt', 'select', '', 'asc=la_common_ascending,desc=la_common_descending', 4, 1);
INSERT INTO ConfigurationAdmin VALUES ('Perpage_Category', 'la_Text_General', 'la_category_perpage_prompt', 'text', '', '', 5, 1);
INSERT INTO ConfigurationAdmin VALUES ('Category_DaysNew', 'la_Text_General', 'la_category_daysnew_prompt', 'text', '', '', 6, 1);
INSERT INTO ConfigurationAdmin VALUES ('Category_ShowPick', 'la_Text_General', 'la_category_showpick_prompt', 'checkbox', '', '', 7, 1);
INSERT INTO ConfigurationAdmin VALUES ('Category_MetaKey', 'la_Text_MetaInfo', 'la_category_metakey', 'text', '', '', 8, 1);
INSERT INTO ConfigurationAdmin VALUES ('Category_MetaDesc', 'la_Text_MetaInfo', 'la_category_metadesc', 'text', '', '', 9, 1);
INSERT INTO ConfigurationAdmin VALUES ('User_NewGroup', 'la_Text_General', 'la_users_new_group', 'select', NULL, '0=lu_none,<SQL>SELECT GroupId as OptionName, Name as OptionValue FROM <PREFIX>PortalGroup WHERE Enabled=1 AND Personal=0</SQL>', 3, 1);
INSERT INTO ConfigurationAdmin VALUES ('User_GuestGroup', 'la_Text_General', 'la_users_guest_group', 'select', NULL, '0=lu_none,<SQL>SELECT GroupId as OptionName, Name as OptionValue FROM <PREFIX>PortalGroup WHERE Enabled=1 AND Personal=0</SQL>', 4, 1);
INSERT INTO ConfigurationAdmin VALUES ('RootPass', 'la_Text_General', 'la_prompt_root_pass', 'password', NULL, NULL, 11, 0);
INSERT INTO ConfigurationAdmin VALUES ('RootPassVerify', 'la_Text_General', 'la_prompt_root_pass_verify', 'password', NULL, NULL, 11, 0);
INSERT INTO ConfigurationAdmin VALUES ('User_Allow_New', 'la_Text_General', 'la_users_allow_new', 'radio', '', '1=la_User_Instant,2=la_User_Not_Allowed,3=la_User_Upon_Approval', 1, 1);
INSERT INTO ConfigurationAdmin VALUES ('User_Password_Auto', 'la_Text_General', 'la_users_password_auto', 'checkbox', '', '', 10, 1);
INSERT INTO ConfigurationAdmin VALUES ('User_Votes_Deny', 'la_Text_Restrictions', 'la_users_votes_deny', 'text', '', '', 4, 1);
INSERT INTO ConfigurationAdmin VALUES ('User_Review_Deny', 'la_Text_Restrictions', 'la_users_review_deny', 'text', '', '', 5, 1);
INSERT INTO ConfigurationAdmin VALUES ('Server_Name', 'la_Text_Website', 'la_config_server_name', 'text', '', '', 4, 0);
INSERT INTO ConfigurationAdmin VALUES ('Config_Server_Time', 'la_Text_Date_Time_Settings', 'la_config_time_server', 'select', '', '1=la_m12,2=la_m11,3=la_m10,5=la_m9,6=la_m8,7=la_m7,8=la_m6,9=la_m5,10=la_m4,11=la_m3,12=la_m2,13=la_m1,14=la_m0,15=la_p1,16=la_p2,17=la_p3,18=la_p4,19=la_p5,20=la_p6,21=la_p7,22=la_p8,23=la_p9,24=la_p10,25=la_p11,26=la_p12,27=la_p13', 6, 1);
INSERT INTO ConfigurationAdmin VALUES ('Config_Site_Time', 'la_Text_Date_Time_Settings', 'la_config_site_zone', 'select', '', '1=la_m12,2=la_m11,3=la_m10,5=la_m9,6=la_m8,7=la_m7,8=la_m6,9=la_m5,10=la_m4,11=la_m3,12=la_m2,13=la_m1,14=la_m0,15=la_p1,16=la_p2,17=la_p3,18=la_p4,19=la_p5,20=la_p6,21=la_p7,22=la_p8,23=la_p9,24=la_p10,25=la_p11,26=la_p12,27=la_p13', 7, 1);
INSERT INTO ConfigurationAdmin VALUES ('Smtp_Server', 'la_Text_smtp_server', 'la_prompt_mailserver', 'text', NULL, NULL, 10, 1);
INSERT INTO ConfigurationAdmin VALUES ('Smtp_Port', 'la_Text_smtp_server', 'la_prompt_mailport', 'text', NULL, NULL, 11, 1);
INSERT INTO ConfigurationAdmin VALUES ('Smtp_Authenticate', 'la_Text_smtp_server', 'la_prompt_mailauthenticate', 'checkbox', NULL, NULL, 12, 1);
INSERT INTO ConfigurationAdmin VALUES ('Smtp_User', 'la_Text_smtp_server', 'la_prompt_smtp_user', 'text', NULL, NULL, 13, 1);
INSERT INTO ConfigurationAdmin VALUES ('Smtp_Pass', 'la_Text_smtp_server', 'la_prompt_smtp_pass', 'text', NULL, NULL, 14, 1);
INSERT INTO ConfigurationAdmin VALUES ('Smtp_SendHTML', 'la_Text_smtp_server', 'la_prompt_mailhtml', 'checkbox', NULL, NULL, 15, 0);
INSERT INTO ConfigurationAdmin VALUES ('Smtp_DefaultHeaders', 'la_Text_smtp_server', 'la_prompt_smtpheaders', 'textarea', NULL, 'COLS=40 ROWS=5', 16, 0);
INSERT INTO ConfigurationAdmin VALUES ('Smtp_AdminMailFrom', 'la_Text_smtp_server', 'la_prompt_AdminMailFrom', 'text', NULL, NULL, 17, 1);
INSERT INTO ConfigurationAdmin VALUES ('Perpage_Category_Short', 'la_Text_General', 'la_category_perpage__short_prompt', 'text', '', '', 5, 1);
INSERT INTO ConfigurationAdmin VALUES ('CookieSessions', 'la_Text_Website', 'la_prompt_session_management', 'select', NULL, '0=lu_query_string,1=lu_cookies,2=lu_auto', 8, 1);
INSERT INTO ConfigurationAdmin VALUES ('SessionTimeout', 'la_Text_Website', 'la_prompt_session_timeout', 'text','', '', 9, 1);
INSERT INTO ConfigurationAdmin VALUES ('SystemTagCache', 'la_Text_Website', 'la_prompt_syscache_enable', 'checkbox', NULL, NULL, 10, 0);
INSERT INTO ConfigurationAdmin VALUES ('User_SubscriberGroup', 'la_Text_General', 'la_users_subscriber_group', 'select', NULL, '0=lu_none,<SQL>SELECT GroupId as OptionName, Name as OptionValue FROM <PREFIX>PortalGroup WHERE Enabled=1 AND Personal=0</SQL>', 5, 1);
INSERT INTO ConfigurationAdmin VALUES ('Root_Name', 'la_Text_General', 'la_prompt_root_name', 'text', '', '', 8, 1);
INSERT INTO ConfigurationAdmin VALUES ('SocketBlockingMode', 'la_Text_Website', 'la_prompt_socket_blocking_mode', 'checkbox', NULL, NULL, 11, 0);
INSERT INTO ConfigurationAdmin VALUES ('Min_UserName', 'la_Text_General', 'la_text_min_username', 'text', '', '', 1, 0);
INSERT INTO ConfigurationAdmin VALUES ('Min_Password', 'la_Text_General', 'la_text_min_password', 'text', '', '', 2, 0);
INSERT INTO ConfigurationValues VALUES ('Columns_Category', '2', 'In-Portal', 'Categories')
INSERT INTO ConfigurationValues VALUES ('DomainSelect','1','In-Portal','in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Site_Path', '/', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Perpage_Archive', '25', 'inportal', '')
INSERT INTO ConfigurationValues VALUES ('debug', '1', 'inportal', '')
INSERT INTO ConfigurationValues VALUES ('Perpage_User', '100', 'inportal', '')
INSERT INTO ConfigurationValues VALUES ('Perpage_LangEmail', '20', 'inportal', '')
INSERT INTO ConfigurationValues VALUES ('Default_FromAddr', '', 'inportal', '')
INSERT INTO ConfigurationValues VALUES ('email_replyto', '', 'inportal', '')
INSERT INTO ConfigurationValues VALUES ('email_footer', 'message footer goes here', 'inportal', '')
INSERT INTO ConfigurationValues VALUES ('Default_Theme', 'default', 'In-Portal', '')
INSERT INTO ConfigurationValues VALUES ('Default_Language', 'English', 'inportal', '')
INSERT INTO ConfigurationValues VALUES ('SessionTimeout', '3600', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('User_SortOrder', 'asc', 'In-Portal', '')
INSERT INTO ConfigurationValues VALUES ('Suggest_MinInterval', '3600', 'inportal', '')
INSERT INTO ConfigurationValues VALUES ('SubCat_ListCount', '3', 'inportal', '')
INSERT INTO ConfigurationValues VALUES ('Timeout_Rating', '3600', 'In-Portal', 'System')
-INSERT INTO ConfigurationValues VALUES ('User_SortField', 'DateCreated', 'In-Portal', '')
+INSERT INTO ConfigurationValues VALUES ('User_SortField', 'u.CreatedOn', 'In-Portal', '')
INSERT INTO ConfigurationValues VALUES ('Perpage_Relations', '10', 'In-Portal', '')
INSERT INTO ConfigurationValues VALUES ('Group_SortField', 'GroupName', 'In-Portal', '')
INSERT INTO ConfigurationValues VALUES ('Group_SortOrder', 'asc', 'In-Portal', '')
INSERT INTO ConfigurationValues VALUES ('Default_FromName', 'Webmaster', 'In-Portal', '')
INSERT INTO ConfigurationValues VALUES ('Perpage_Category', '10', 'In-Portal', 'in-portal:configure_categories')
INSERT INTO ConfigurationValues VALUES ('Category_Sortfield', 'Name', 'In-Portal', 'in-portal:configure_categories')
INSERT INTO ConfigurationValues VALUES ('Category_Sortorder', 'asc', 'In-Portal', 'in-portal:configure_categories')
INSERT INTO ConfigurationValues VALUES ('MetaKeywords', NULL, 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Relation_LV_Sortfield', 'ItemType', 'In-Portal', '')
INSERT INTO ConfigurationValues VALUES ('ampm_time', '1', 'In-Portal', '')
INSERT INTO ConfigurationValues VALUES ('Perpage_Template', '10', 'In-Portal', '')
INSERT INTO ConfigurationValues VALUES ('Perpage_Phrase', '40', 'In-Portal', '')
INSERT INTO ConfigurationValues VALUES ('Perpage_Sessionlist', '20', 'In-Portal', '')
INSERT INTO ConfigurationValues VALUES ('Category_Sortfield2', 'Description', 'In-Portal', 'in-portal:configure_categories')
INSERT INTO ConfigurationValues VALUES ('Category_Sortorder2', 'asc', 'In-Portal', 'in-portal:configure_categories')
INSERT INTO ConfigurationValues VALUES ('Category_DaysNew', '8', 'In-Portal', 'in-portal:configure_categories')
INSERT INTO ConfigurationValues VALUES ('Category_ShowPick', '', 'In-Portal', 'in-portal:configure_categories')
INSERT INTO ConfigurationValues VALUES ('Category_MetaKey', '', 'In-Portal', 'in-portal:configure_categories')
INSERT INTO ConfigurationValues VALUES ('Category_MetaDesc', '', 'In-Portal', 'in-portal:configure_categories')
INSERT INTO ConfigurationValues VALUES ('MetaDescription', NULL, 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('User_NewGroup', '13', 'In-Portal:Users', 'in-portal:configure_users')
INSERT INTO ConfigurationValues VALUES ('User_Allow_New', '3', 'In-Portal:Users', 'in-portal:configure_users')
INSERT INTO ConfigurationValues VALUES ('User_Password_Auto', '0', 'In-Portal:Users', 'in-portal:configure_users')
INSERT INTO ConfigurationValues VALUES ('User_Votes_Deny', '5', 'In-Portal:Users', 'in-portal:configure_users')
INSERT INTO ConfigurationValues VALUES ('User_Review_Deny', '5', 'In-Portal:Users', 'in-portal:configure_users')
INSERT INTO ConfigurationValues VALUES ('Config_Name', '', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Config_Company', '', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Config_Reg_Number', '', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Config_Website_Name', '', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Config_Web_Address', '', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Config_Server_Time', '14', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Config_Site_Time', '14', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Site_Name', 'In-Portal', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Backup_Path', '', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Perpage_Items', '20', 'In-Portal', '')
INSERT INTO ConfigurationValues VALUES ('GuestSessions', '1', 'In-Portal', '')
INSERT INTO ConfigurationValues VALUES ('Smtp_Server', NULL, 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Smtp_Port', NULL, 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Smtp_User', NULL, 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Smtp_Pass', NULL, 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Smtp_SendHTML', '1', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Smtp_Authenticate', '0', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Perpage_Email', '10', 'In-Portal', '')
INSERT INTO ConfigurationValues VALUES ('Smtp_DefaultHeaders', 'X-Priority: 1\r\nX-MSMail-Priority: High\r\nX-Mailer: In-Portal', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Smtp_AdminMailFrom', 'portal@user.domain.name', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('Category_Highlight_OpenTag', '<span class="match">', 'In-Portal', 'in-portal:configure_categories')
INSERT INTO ConfigurationValues VALUES ('Category_Highlight_CloseTag', '</span>', 'In-Portal', 'in-portal:configure_categories')
INSERT INTO ConfigurationValues VALUES ('User_GuestGroup', '14', 'In-Portal:Users', 'in-portal:configure_users')
INSERT INTO ConfigurationValues VALUES ('RootPass', '', 'In-Portal:Users', 'in-portal:configure_users')
INSERT INTO ConfigurationValues VALUES ('RootPassVerify', '', 'In-Portal:Users', 'in-portal:configure_users')
INSERT INTO ConfigurationValues VALUES ('Perpage_Category_Short', '3', 'In-Portal', 'in-portal:configure_categories')
INSERT INTO ConfigurationValues VALUES ('CookieSessions', '2', 'In-Portal', 'in-portal:configure_general')
INSERT INTO ConfigurationValues VALUES ('SearchRel_Increase_category', '30', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('SearchRel_Keyword_category', '90', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('SearchRel_Pop_category', '5', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('SearchRel_Rating_category', '5', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('SearchRel_DefaultIncrease', '30', 'In-Portal', 'inportal:configure_searchdefault');
INSERT INTO ConfigurationValues VALUES ('SearchRel_DefaultKeyword', '80', 'In-Portal', 'SearchRel_DefaultKeyword');
INSERT INTO ConfigurationValues VALUES ('SearchRel_DefaultPop', '10', 'In-Portal', 'inportal:configuration_searchdefault');
INSERT INTO ConfigurationValues VALUES ('SearchRel_DefaultRating', '10', 'In-Portal', 'inportal:configure_searchdefault');
INSERT INTO ConfigurationValues VALUES ('SystemTagCache', '0', 'In-Portal', 'in-portal:configure_general');
INSERT INTO ConfigurationValues VALUES ('Root_Name', 'lu_rootcategory_name', 'In-Portal', 'in-portal:configure_categories');
INSERT INTO ConfigurationValues VALUES ('User_SubscriberGroup', '12', 'In-Portal:Users', 'in-portal:configure_users');
INSERT INTO ConfigurationValues VALUES ('SocketBlockingMode', '0', 'In-Portal', 'in-portal:configure_general');
INSERT INTO ConfigurationValues VALUES ('Min_UserName', '3', 'In-Portal:Users', 'in-portal:configure_users');
INSERT INTO ConfigurationValues VALUES ('Min_Password', '5', 'In-Portal:Users', 'in-portal:configure_users');
INSERT INTO ConfigurationValues VALUES ('LinksValidation_LV_Sortfield', 'ValidationTime', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('CustomConfig_LV_Sortfield', 'FieldName', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Event_LV_SortField', 'Description', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Theme_LV_SortField', 'Name', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Template_LV_SortField', 'FileName', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Lang_LV_SortField', 'PackName', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Phrase_LV_SortField', 'Phrase', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('LangEmail_LV_SortField', 'Description', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('CustomData_LV_SortField', 'FieldName', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Summary_SortField', 'Module', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Session_SortField', 'UserName', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('SearchLog_SortField', 'Keyword', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Perpage_StatItem', '10', 'inportal', '');
INSERT INTO ConfigurationValues VALUES ('Perpage_Groups', '20', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Perpage_Event', '20', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Perpage_BanRules', '20', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Perpage_SearchLog', '20', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Perpage_LV_lang', '20', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Perpage_LV_Themes', '20', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Perpage_LV_Catlist', '20', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Perpage_Reviews', '20', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Perpage_Modules', '20', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Perpage_Grouplist', '20', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Perpage_Images', '20', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('EmailsL_SortField', 'time_sent', 'In-Portal', '');
INSERT INTO ConfigurationValues VALUES ('Perpage_EmailsL', '20', 'In-Portal', '');
INSERT INTO Events VALUES (30, 'USER.ADD', 1, 0, 'In-Portal:Users', 'la_event_user.add', 0)
INSERT INTO Events VALUES (32, 'USER.ADD', 2, 0, 'In-Portal:Users', 'la_event_user.add', 1)
INSERT INTO Events VALUES (31, 'USER.APPROVE', 1, 0, 'In-Portal:Users', 'la_event_user.approve', 0)
INSERT INTO Events VALUES (33, 'USER.APPROVE', 2, 0, 'In-Portal:Users', 'la_event_user.approve', 1)
INSERT INTO Events VALUES (34, 'USER.VALIDATE', 1, 0, 'In-Portal:Users', 'la_event_user.validate', 0)
INSERT INTO Events VALUES (35, 'USER.VALIDATE', 2, 0, 'In-Portal:Users', 'la_event_user.validate', 1)
INSERT INTO Events VALUES (36, 'USER.DENY', 1, 0, 'In-Portal:Users', 'la_event_user.deny', 0)
INSERT INTO Events VALUES (37, 'USER.DENY', 2, 0, 'In-Portal:Users', 'la_event_user.deny', 1)
INSERT INTO Events VALUES (38, 'USER.PSWD', 2, 0, 'In-Portal:Users', 'la_event_user.forgotpw', 1)
INSERT INTO Events VALUES (39, 'USER.PSWD', 1, 0, 'In-Portal:Users', 'la_event_user.forgotpw', 0)
INSERT INTO Events VALUES (45, 'USER.ADD.PENDING', 1, 0, 'In-Portal:Users', 'la_event_user.add.pending', 0)
INSERT INTO Events VALUES (47, 'CATEGORY.ADD', 1, 0, 'In-Portal:Category', 'la_event_category.add', 0)
INSERT INTO Events VALUES (48, 'CATEGORY.ADD.PENDING', 1, 0, 'In-Portal:Category', 'la_event_category.add.pending', 0)
INSERT INTO Events VALUES (49, 'CATEGORY.ADD.PENDING', 2, 0, 'In-Portal:Category', 'la_event_category.add.pending', 1)
INSERT INTO Events VALUES (50, 'CATEGORY.ADD', 2, 0, 'In-Portal:Category', 'la_event_category.add', 1)
INSERT INTO Events VALUES (51, 'CATEGORY.DELETE', 1, 0, 'In-Portal:Category', 'la_event_category_delete', 0)
INSERT INTO Events VALUES (52, 'CATEGORY.DELETE', 2, 0, 'In-Portal:Category', 'la_event_category_delete', 1)
INSERT INTO Events VALUES (53, 'CATEGORY.MODIFY', 1, 0, 'In-Portal:Category', 'la_event_category.modify', 0)
INSERT INTO Events VALUES (54, 'CATEGORY.MODIFY', 2, 0, 'In-Portal:Category', 'la_event_category.modify', 1)
INSERT INTO Events VALUES (56, 'CATEGORY.APPROVE', 1, 0, 'In-Portal:Category', 'la_event_category.approve', 0)
INSERT INTO Events VALUES (57, 'CATEGORY.APPROVE', 2, 0, 'In-Portal:Category', 'la_event_category.approve', 1)
INSERT INTO Events VALUES (58, 'CATEGORY.DENY', 1, 0, 'In-Portal:Category', 'la_event_category.deny', 0)
INSERT INTO Events VALUES (59, 'CATEGORY.DENY', 2, 0, 'In-Portal:Category', 'la_event_category.deny', 1)
INSERT INTO Events VALUES (60, 'USER.SUBSCRIBE', 1, 0, 'In-Portal:Users', 'la_event_user.subscribe', 0);
INSERT INTO Events VALUES (61, 'USER.SUBSCRIBE', 2, 0, 'In-Portal:Users', 'la_event_user.subscribe', 1);
INSERT INTO Events VALUES (62, 'USER.UNSUBSCRIBE', 1, 0, 'In-Portal:Users', 'la_event_user.unsubscribe', 0);
INSERT INTO Events VALUES (63, 'USER.UNSUBSCRIBE', 2, 0, 'In-Portal:Users', 'la_event_user.unsubscribe', 1);
INSERT INTO Events VALUES (64,'USER.SUGGEST', '1', '0', 'In-Portal:Users', 'la_event_user.suggest', '0');
INSERT INTO Events VALUES (65,'USER.SUGGEST', '2', '0', 'In-Portal:Users', 'la_event_user.suggest', '1');
INSERT INTO IdGenerator VALUES ('100');
INSERT INTO ItemTypes VALUES (1, 'In-Portal', 'Category', 'Name', 'CreatedById', NULL, NULL, 'la_ItemTab_Categories', 1, 'admin/category/addcategory.php', 'clsCategory', 'Category');
INSERT INTO ItemTypes VALUES (6, 'In-Portal', 'PortalUser', 'Login', '', NULL, NULL, '', 0, '', 'clsPortalUser', 'User');
INSERT INTO Modules (Name, Path, Var, Version, Loaded, LoadOrder, TemplatePath, RootCat, BuildDate) VALUES ('In-Portal', 'kernel/', 'm', '1.0.7', 1, 0, '', 0, '1054738405');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('CATEGORY.VIEW', 'lu_PermName_Category.View_desc', 'lu_PermName_Category.View_error', 'In-Portal');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('CATEGORY.ADD', 'lu_PermName_Category.Add_desc', 'lu_PermName_Category.Add_error', 'In-Portal');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('CATEGORY.DELETE', 'lu_PermName_Category.Delete_desc', 'lu_PermName_Category.Delete_error', 'In-Portal');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('CATEGORY.ADD.PENDING', 'lu_PermName_Category.AddPending_desc', 'lu_PermName_Category.AddPending_error', 'In-Portal');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('CATEGORY.MODIFY', 'lu_PermName_Category.Modify_desc', 'lu_PermName_Category.Modify_error', 'In-Portal');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('ADMIN', 'lu_PermName_Admin_desc', 'lu_PermName_Admin_error', 'Admin');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('LOGIN', 'lu_PermName_Login_desc', 'lu_PermName_Admin_error', 'Front');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('DEBUG.ITEM', 'lu_PermName_Debug.Item_desc', '', 'Admin');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('DEBUG.LIST', 'lu_PermName_Debug.List_desc', '', 'Admin');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('DEBUG.INFO', 'lu_PermName_Debug.Info_desc', '', 'Admin');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('PROFILE.MODIFY', 'lu_PermName_Profile.Modify_desc', '', 'Admin');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('SHOWLANG', 'lu_PermName_ShowLang_desc', '', 'Admin');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('FAVORITES', 'lu_PermName_favorites_desc', 'lu_PermName_favorites_error', 'In-Portal');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('SYSTEM_ACCESS.READONLY', 'la_PermName_SystemAccess.ReadOnly_desc', 'la_PermName_SystemAccess.ReadOnly_error', 'Admin');
INSERT INTO PortalGroup VALUES (13, 'Member', '', '1054738682', 0, 0, 1, 13);
INSERT INTO PortalGroup VALUES (12, 'Subscribers', '', '1054738670', 0, 0, 1, 12);
INSERT INTO PortalGroup VALUES (14, 'Guest', 'Guest User', '0', 1, 0, 1, 14);
INSERT INTO PortalGroup VALUES (11, 'admin', '', '1054738405', 0, 0, 1, 11);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('LOGIN', 13, 1, 1, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('LOGIN', 11, 1, 1, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('LOGIN', 12, 1, 1, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('ADMIN', 11, 1, 1, 0);
INSERT INTO SearchConfig VALUES ('Category', 'NewItem', 0, 1, 'lu_fielddesc_category_newitem', 'lu_field_newitem', 'In-Portal', 'la_Text_Category', 18, 80, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'PopItem', 0, 1, 'lu_fielddesc_category_popitem', 'lu_field_popitem', 'In-Portal', 'la_Text_Category', 19, 81, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'HotItem', 0, 1, 'lu_fielddesc_category_hotitem', 'lu_field_hotitem', 'In-Portal', 'la_Text_Category', 17, 79, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'MetaDescription', 0, 1, 'lu_fielddesc_category_metadescription', 'lu_field_metadescription', 'In-Portal', 'la_Text_Category', 16, 78, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'ParentPath', 0, 1, 'lu_fielddesc_category_parentpath', 'lu_field_parentpath', 'In-Portal', 'la_Text_Category', 15, 77, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'ResourceId', 0, 1, 'lu_fielddesc_category_resourceid', 'lu_field_resourceid', 'In-Portal', 'la_Text_Category', 14, 76, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'CreatedById', 0, 1, 'lu_fielddesc_category_createdbyid', 'lu_field_createdbyid', 'In-Portal', 'la_Text_Category', 13, 75, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'CachedNavbar', 0, 1, 'lu_fielddesc_category_cachednavbar', 'lu_field_cachednavbar', 'In-Portal', 'la_Text_Category', 12, 74, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'CachedDescendantCatsQty', 0, 1, 'lu_fielddesc_category_cacheddescendantcatsqty', 'lu_field_cacheddescendantcatsqty', 'In-Portal', 'la_Text_Category', 11, 73, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'MetaKeywords', 0, 1, 'lu_fielddesc_category_metakeywords', 'lu_field_metakeywords', 'In-Portal', 'la_Text_Category', 10, 72, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'Priority', 0, 1, 'lu_fielddesc_category_priority', 'lu_field_priority', 'In-Portal', 'la_Text_Category', 9, 71, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'Status', 0, 1, 'lu_fielddesc_category_status', 'lu_field_status', 'In-Portal', 'la_Text_Category', 7, 69, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'EditorsPick', 0, 1, 'lu_fielddesc_category_editorspick', 'lu_field_editorspick', 'In-Portal', 'la_Text_Category', 6, 68, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'CreatedOn', 0, 1, 'lu_fielddesc_category_createdon', 'lu_field_createdon', 'In-Portal', 'la_Text_Category', 5, 67, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'Description', 1, 1, 'lu_fielddesc_category_description', 'lu_field_description', 'In-Portal', 'la_Text_Category', 4, 66, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'Name', 1, 1, 'lu_fielddesc_category_name', 'lu_field_name', 'In-Portal', 'la_Text_Category', 3, 65, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'ParentId', 0, 1, 'lu_fielddesc_category_parentid', 'lu_field_parentid', 'In-Portal', 'la_Text_Category', 2, 64, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'CategoryId', 0, 1, 'lu_fielddesc_category_categoryid', 'lu_field_categoryid', 'In-Portal', 'la_Text_Category', 0, 62, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'Modified', 0, 1, 'lu_fielddesc_category_modified', 'lu_field_modified', 'In-Portal', 'la_Text_Category', 20, 82, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('Category', 'ModifiedById', 0, 1, 'lu_fielddesc_category_modifiedbyid', 'lu_field_modifiedbyid', 'In-Portal', 'la_Text_Category', 21, 83, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'PortalUserId', 0, 0, 'lu_fielddesc_user_portaluserid', 'lu_field_portaluserid', 'In-Portal', 'la_text_user', 0, 173, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'Login', 0, 0, 'lu_fielddesc_user_login', 'lu_field_login', 'In-Portal', 'la_text_user', 1, 174, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'Password', 0, 0, 'lu_fielddesc_user_password', 'lu_field_password', 'In-Portal', 'la_text_user', 2, 175, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'tz', 0, 0, 'lu_fielddesc_user_tz', 'lu_field_tz', 'In-Portal', 'la_text_user', 17, 190, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'dob', 0, 0, 'lu_fielddesc_user_dob', 'lu_field_dob', 'In-Portal', 'la_text_user', 16, 189, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'Modified', 0, 0, 'lu_fielddesc_user_modified', 'lu_field_modified', 'In-Portal', 'la_text_user', 15, 188, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'Status', 0, 0, 'lu_fielddesc_user_status', 'lu_field_status', 'In-Portal', 'la_text_user', 14, 187, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'ResourceId', 0, 0, 'lu_fielddesc_user_resourceid', 'lu_field_resourceid', 'In-Portal', 'la_text_user', 13, 186, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'Country', 0, 0, 'lu_fielddesc_user_country', 'lu_field_country', 'In-Portal', 'la_text_user', 12, 185, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'Zip', 0, 0, 'lu_fielddesc_user_zip', 'lu_field_zip', 'In-Portal', 'la_text_user', 11, 184, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'State', 0, 0, 'lu_fielddesc_user_state', 'lu_field_state', 'In-Portal', 'la_text_user', 10, 183, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'City', 0, 0, 'lu_fielddesc_user_city', 'lu_field_city', 'In-Portal', 'la_text_user', 9, 182, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'Street', 0, 0, 'lu_fielddesc_user_street', 'lu_field_street', 'In-Portal', 'la_text_user', 8, 181, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'Phone', 0, 0, 'lu_fielddesc_user_phone', 'lu_field_phone', 'In-Portal', 'la_text_user', 7, 180, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'CreatedOn', 0, 0, 'lu_fielddesc_user_createdon', 'lu_field_createdon', 'In-Portal', 'la_text_user', 6, 179, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'Email', 0, 0, 'lu_fielddesc_user_email', 'lu_field_email', 'In-Portal', 'la_text_user', 5, 178, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'LastName', 0, 0, 'lu_fielddesc_user_lastname', 'lu_field_lastname', 'In-Portal', 'la_text_user', 4, 177, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO SearchConfig VALUES ('PortalUser', 'FirstName', 0, 0, 'lu_fielddesc_user_firstname', 'lu_field_firstname', 'In-Portal', 'la_text_user', 3, 176, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, 0);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT count(*) FROM <%prefix%>Category WHERE Status=1 ', NULL, 'la_prompt_ActiveCategories', '0', '1');
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT count(*) FROM <%prefix%>PortalUser WHERE Status=1 ', NULL, 'la_prompt_ActiveUsers', '0', '1');
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT count(*) FROM <%prefix%>UserSession', NULL, 'la_prompt_CurrentSessions', '0', '1');
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT(*) as CategoryCount FROM <%prefix%>Category', NULL, 'la_prompt_TotalCategories', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT(*) AS ActiveCategories FROM <%prefix%>Category WHERE Status = 1', NULL, 'la_prompt_ActiveCategories', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT(*) AS PendingCategories FROM <%prefix%>Category WHERE Status = 2', NULL, 'la_prompt_PendingCategories', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT(*) AS DisabledCategories FROM <%prefix%>Category WHERE Status = 0', NULL, 'la_prompt_DisabledCategories', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT(*) AS NewCategories FROM <%prefix%>Category WHERE (NewItem = 1) OR ( (UNIX_TIMESTAMP() - CreatedOn) <= <%m:config name="Category_DaysNew"%>*86400 AND (NewItem = 2) )', NULL, 'la_prompt_NewCategories', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT(*) FROM <%prefix%>Category WHERE EditorsPick = 1', NULL, 'la_prompt_CategoryEditorsPick', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT <%m:post_format field="MAX(CreatedOn)" type="date"%> FROM <%prefix%>Category', NULL, 'la_prompt_NewestCategoryDate', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT <%m:post_format field="MAX(Modified)" type="date"%> FROM <%prefix%>Category', NULL, 'la_prompt_LastCategoryUpdate', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT(*) AS TotalUsers FROM <%prefix%>PortalUser', NULL, 'la_prompt_TopicsUsers', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT(*) AS ActiveUsers FROM <%prefix%>PortalUser WHERE Status = 1', NULL, 'la_prompt_UsersActive', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT(*) AS PendingUsers FROM <%prefix%>PortalUser WHERE Status = 2', NULL, 'la_prompt_UsersPending', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT(*) AS DisabledUsers FROM <%prefix%>PortalUser WHERE Status = 0', NULL, 'la_prompt_UsersDisabled', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT <%m:post_format field="MAX(CreatedOn)" type="date"%> FROM <%prefix%>PortalUser', NULL, 'la_prompt_NewestUserDate', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT( DISTINCT LOWER( Country ) ) FROM <%prefix%>PortalUser WHERE LENGTH(Country) > 0', NULL, 'la_prompt_UsersUniqueCountries', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT( DISTINCT LOWER( State ) ) FROM <%prefix%>PortalUser WHERE LENGTH(State) > 0', NULL, 'la_prompt_UsersUniqueStates', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT(*) AS TotalUserGroups FROM <%prefix%>PortalGroup', NULL, 'la_prompt_TotalUserGroups', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT(*) AS BannedUsers FROM <%prefix%>PortalUser WHERE IsBanned = 1', NULL, 'la_prompt_BannedUsers', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT(*) AS NonExipedSessions FROM <%prefix%>UserSession WHERE Status = 1', NULL, 'la_prompt_NonExpiredSessions', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT(*) AS ThemeCount FROM <%prefix%>Theme', NULL, 'la_prompt_ThemeCount', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', 'SELECT COUNT(*) AS RegionsCount FROM <%prefix%>Language', NULL, 'la_prompt_RegionsCount', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', '<%m:sql_action sql="SHOW+TABLES" action="COUNT" field="*"%>', NULL, 'la_prompt_TablesCount', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', '<%m:sql_action sql="SHOW+TABLE+STATUS" action="SUM" field="Rows"%>', NULL, 'la_prompt_RecordsCount', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', '<%m:custom_action sql="empty" action="SysFileSize"%>', NULL, 'la_prompt_SystemFileSize', 0, 2);
INSERT INTO StatItem VALUES (0, 'In-Portal', '<%m:sql_action sql="SHOW+TABLE+STATUS" action="SUM" format_as="file" field="Data_length"%>', NULL, 'la_prompt_DataSize', 0, 2);
\ No newline at end of file
Property changes on: trunk/admin/install/inportal_data.sql
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.7
\ No newline at end of property

Event Timeline