Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sun, Feb 2, 7:01 PM

in-portal

This file is larger than 256 KB, so syntax highlighting was skipped.
Index: trunk/kernel/parser.php
===================================================================
--- trunk/kernel/parser.php (revision 897)
+++ trunk/kernel/parser.php (revision 898)
@@ -1,3442 +1,3447 @@
<?php
$ItemTypes["category"]=1;
$ItemTables[1] = "Category";
$ParserFiles[] = "kernel/parser.php";
function m_ParseEnv($str = NULL)
{
global $m_var_list, $objConfig, $objCatList, $objLanguages, $objThemes;
if ($str != NULL)
{
$str = substr($str,1);
$pieces = explode("-", $str);
//echo "<PRE>";print_r($pieces);echo "</PRE>";
$m_var_list["cat"] = $pieces[0];
$m_var_list["p"] = $pieces[1];
$objCatList->Page = $m_var_list["p"];
$m_var_list["lang"] = $pieces[2];
$m_var_list["theme"] = $pieces[3];
}
else
{
$m_var_list["cat"]=0;
$m_var_list["p"] = 1;
$m_var_list["lang"] = $objLanguages->GetPrimary();
$m_var_list["theme"]= $objThemes->GetPrimaryTheme();
}
}
function m_BuildEnv()
{
global $m_var_list, $m_var_list_update;
$module_vars = Array('cat','p','lang','theme');
$ret = GenerateModuleEnv('m', $module_vars);
if( isset($GLOBALS['m_var_list_update']['cat']) ) unset($GLOBALS['m_var_list_update']['cat']);
return $ret;
}
function m_GetVar($name)
{
// get variable from template variable's list
global $m_var_list, $m_var_list_update;
return isset($m_var_list_update[$name]) ? $m_var_list_update[$name] : $m_var_list[$name];
}
function &LoadRelatedItems(&$Relations,&$RelatedItems,$ResourceId)
{
global $objItemTypes;
if(!is_object($Relations))
{
$Relations = new clsRelationshipList();
}
//$Relations->debuglevel = 2;
if ($ResourceId != '') {
$sql = sprintf("SELECT RelationshipId, Type, Enabled, Priority,
IF(TargetId = %1\$s, TargetId, SourceId) AS SourceId,
IF(TargetId = %1\$s, SourceId, TargetId) AS TargetId,
IF(TargetId = %1\$s, TargetType, SourceType) AS SourceType,
IF(TargetId = %1\$s, SourceType, TargetType) AS TargetType
FROM %%s", $ResourceId);
$where = "((SourceId=$ResourceId) OR (TargetId=$ResourceId AND Type=1)) AND Enabled=1";
$Relations->LoadRelated($where,"",$sql);
$ids = array();
if($Relations->NumItems()>0)
{
foreach($Relations->Items as $r)
{
if($r->Get("SourceId")==$ResourceId)
{
$ids[$r->Get("TargetType")][] = $r->Get("TargetId");
}
if($r->Get("TargetId")==$ResourceId && $r->Get("Type")==1)
{
$ids[$r->Get("SourceType")][] = $ResourceId;
}
}
foreach($ids as $ItemType=>$idlist)
{
$Item =& $objItemTypes->GetItem($ItemType);
$table = GetTablePrefix().$Item->Get("SourceTable");
if($ItemType!=1)
{
$cattable = GetTablePrefix()."CategoryItems";
$sql = "SELECT *,CategoryId FROM $table INNER JOIN $cattable ON ";
$sql .=" ($table.ResourceId=$cattable.ItemResourceId) WHERE $table.Status=1 AND PrimaryCat=1 ";
$sql .=" AND ResourceId IN (".implode(",",$ids[$ItemType]).")";
}
else
{
$sql = "SELECT *,CategoryId FROM $table ";
$sql .="WHERE $table.Status=1 ";
$sql .=" AND ResourceId IN (".implode(",",$ids[$ItemType]).")";
}
// echo $sql."<br>\n";
$RelatedItems->Query_Item($sql,-1,-1,$ItemType);
}
}
}
}
/*
@description: Inserts the html from a remote source
@attrib: _url:: Remote URL to include
@attrib: _StartPos:: Numeric start point of text to include, or string match
@attrib: _EndPos:: Numeric end point of text to include, or string match
@example: <inp:m_insert_url _Url="http://www.google.com" _StartPos="\<center\>" _EndPos="\</center\>" />
*/
function m_insert_url($attribs=array())
{
global $pathtoroot;
$url = $attribs["_url"];
$StartPos = $attribs["_startpos"];
$EndPos = $attribs["_endpos"];
$socket = new Socket($url,0,NULL);
$txt = $socket->socket_read_all();
$lines = explode("\n",$txt);
$txt = substr($txt,strpos($txt,"<"));
$tmp = strtolower($txt);
$bodypos = strpos($tmp,"<body");
if(strlen($bodypos)>0)
{
$head = substr($txt,0,$bodypos-1);
$body = substr($txt,$bodypos);
if(substr($tmp,-7)=="</html>")
$body = substr($body,0,-7);
}
else
$body = $txt;
if(strlen($body))
{
if(strlen($StartPos))
{
if(!is_numeric($StartPos))
{
$start = strpos($body,$StartPos);
}
else
$start = (int)$StartPos;
}
else
$start = 0;
if(strlen($EndPos))
{
if(!is_numeric($EndPos))
{
$end = strpos($body,$EndPos,$start) + strlen($EndPos);
}
else
$end = (int)$EndPos;
}
else
$end = NULL;
$o = substr($body,$start,$end-$start);
}
return $o;
}
/*
@description: Displays a template depending on the login status of the user
@attrib: _logintemplate:tpl: template to display when the user is NOT logged in
@attrib: _LoggedinTemplate:tpl: template to display when the user is logged in
@example: <inp:m_loginbox _LoginTemplate="right_login" _LoggedInTemplate="right_loggedin" />
*/
function m_loginbox($attribs = array())
{
global $var_list, $objSession, $objUsers, $objTemplate;
$userid = $objSession->Get("PortalUserId");
$groupid = $objSession->Get("GroupId");
if ($userid == 0)
{
if (strlen($attribs["_logintemplate"]))
$t = $objTemplate->ParseTemplate($attribs["_logintemplate"]);
return $t;
}
else
{
$user =& $objUsers->GetItem($userid);
if (strlen($attribs["_loggedintemplate"]))
$t = $user->ParseTemplate($attribs["_loggedintemplate"]);
return $t;
}
}
/*
@description: result of suggest site action
*/
function m_suggest_result()
{
global $suggest_result;
return $suggest_result;
}
/*
@description: result of subscribe to mailing list action
*/
function m_subscribe_result()
{
global $SubscribeResult;
if(strlen($SubscribeResult))
return language($SubscribeResult);
return "";
}
/*
@description: email address of user subscribing to mailing list
*/
function m_subscribe_address()
{
global $SubscribeAddress;
if(strlen($SubscribeAddress))
return $SubscribeAddress;
return "";
}
/*
@description: Error message of subscribe to mailing list action
*/
function m_subscribe_error()
{
global $SubscribeError;
if(strlen($SubscribeError))
return language($SubscribeError);
return "";
}
/*
@description: Displays a prompt for a form field
@attrib: _Form:: Form name for the field
@attrib: _Field:: Field Name
@attrib: _LangText:lang: Language var to use for field label
@attrib: _plaintext:: Plain text to use for field label (langtext is used by default if both are set)
@attrib: _Template:tpl: template used to display the field label (if not set "<inp:form_prompt />" is used
@attrib: _ErrorTemplate:tpl: If the field is in an error state (ie missing input) this template is used. Will default to the normal template if not set
*/
function m_form_prompt($attribs = array())
{
global $FormError, $objTemplate, $objConfig;
$form = strtolower($attribs["_form"]);
$field = strtolower($attribs["_field"]);
if($form=="m_register" && ($field=="password" || $field=="passwordverify") && $objConfig->Get("User_Password_Auto"))
{
$o = "";
}
else
{
$t = $attribs["_template"];
if(!strlen($t))
{
$templateText = "<inp:form_prompt />";
}
$e = $attribs["_errortemplate"];
if(!strlen($e))
$e = $t;
if(strlen($attribs["_langtext"]))
{
$txt = language($attribs["_langtext"]);
}
else
$txt = $attribs["_plaintext"];
if (strtolower($field) == "dob")
{
if (isset($FormError[strtolower($form)][strtolower($field."_day")]) || isset($FormError[strtolower($form)][strtolower($field."_month")]) || isset($FormError[strtolower($form)][strtolower($field."_year")]))
$rawtext = $objTemplate->GetTemplate($e, true);
}
if(isset($FormError[strtolower($form)][strtolower($field)]))
{
$rawtext = $objTemplate->GetTemplate($e);
}
elseif (strlen($t))
$rawtext = $objTemplate->GetTemplate($t);
if(is_object($rawtext))
{
$src = $rawtext->source;
$o = str_replace("<inp:form_prompt />",$txt, $src);
}
else
$o = str_replace("<inp:form_prompt />", $txt, $templateText);
}
return $o;
}
/*
@description: Returns text if system is configured to use auto-generated passwords
@attrib:_LangText:lang:Language tag to return
@attrib:_PlainText::Plain text to return (_LangText takes precedece)
@attrib:_Value:bool:Auto Password setting value to match
*/
function m_autopassword($attribs = array())
{
global $objConfig;
if($attribs["_value"]=="true" || $attribs["_value"]==1)
{
$IsAuto = $objConfig->Get("User_Password_Auto");
}
else
{
$IsAuto = !$objConfig->Get("User_Password_Auto");
}
if($IsAuto)
{
if(strlen($attribs["_langtext"]))
{
$ret = language($attribs["_langtext"]);
}
else
$ret = $attribs["_plaintext"];
if(!$ret)
return "true";
}
return $ret;
}
/*
@description: checks if field specified is equals to value specified
@attrib: _Form:: Form name for the field
@attrib: _Field:: Field Name
@attrib: _Value:: Field value to compare to
@example: <inp:m_field_equals _field="topic_subject" _Form="edit_topic" _Value="test" />true</inp:m_field_equals>
*/
function m_field_equals($attribs = array())
{
global $FormValues;
//print_pre($attribs);
$form = $attribs["_form"];
$field = $attribs["_field"];
if(isset($_POST[$field]))
{
$value = $_POST[$field];
}
else
$value = $FormValues[$form][$field];
//echo "POST_VALUE: [$value] vs USER_VALUE: [".$attribs['_value']."]<br>";
return $value == $attribs['_value'] ? 1 : '';
}
/*
@description: creates an INPUT tag for a form field. All extra attributes are passed to the INPUT tag
@attrib: _Form:: Form name for the field
@attrib: _Field:: Field Name
@attrib: _ForgetValue:bool: if true, forget value
@attrib: _Required:bool: If set, In-Portal requires this field have a value when submitting
@example: <inp:m_form_input type="text" class="input" style="width:600px;" _field="topic_subject" _Form="edit_topic" _Required="1" />
*/
function m_form_input($attribs = array())
{
global $FormValues, $objConfig;
$html_attribs = ExtraAttributes($attribs);
$form = $attribs["_form"];
$field = strtolower($attribs["_field"]);
// $field = $attribs["_field"];
if(isset($_POST[$field]) && $attribs['_forgetvalue'] != 1)
{
$value = inp_htmlize($_POST[$field],1);
}
else {
if ($attribs['_forgetvalue'] != 1) {
$value = inp_htmlize($FormValues[$form][$field]);
}
}
//echo $form.".".$field."=".$value." = ".$attribs['_forgetvalue']."<br>\n";
if($form=="m_register" && ($field=="password" || $field=="passwordverify") && $objConfig->Get("User_Password_Auto"))
{
$ret = "";
}
else
{
$ret = "<INPUT ".$html_attribs." name=\"$field\" VALUE=\"$value\" />";
if($attribs["_required"])
$ret .= "<input type=hidden name=\"required[]\" VALUE=\"$field\" />";
if($attribs["_custom"])
$ret .= "<input type=hidden name=\"custom[]\" VALUE=\"$field\" />";
}
return $ret;
}
/*
@description: creates an INPUT tag (type checkbox) for a form field. All extra attributes are passed to the INPUT tag
@attrib: _Form:: Form name for the field
@attrib: _Field:: Field Name
@attrib: _Value:bool: If true, the radio button is CHECKED
@attrib: _Required:bool: If set, In-Portal requires this field have a value when submitting
@attrib: _Custom:bool: If set, handled as a custom field
@example: <inp:m_form_checkbox _field="owner_notify" _Form="edit_topic" />
*/
function m_form_checkbox($attribs = array())
{
global $FormValues, $objConfig;
$html_attribs = ExtraAttributes($attribs);
$form = $attribs["_form"];
$field = strtolower($attribs["_field"]);
if(isset($_POST[$field]))
{
$value = (int)$_POST[$field];
if($value==1)
$checked = " CHECKED";
}
else
{
$value = (int)$FormValues[$form][$field];
if($value==1)
$checked=" CHECKED";
}
//echo $form.".".$field."=".$value."<br>\n";
$ret = "<INPUT TYPE=\"checkbox\" $html_attribs name=\"$field\" VALUE=\"1\" $checked />";
if($attribs["_required"])
$ret .= "<input type=hidden name=\"required[]\" VALUE=\"$field\" />";
if($attribs["_custom"])
$ret .= "<input type=hidden name=\"custom[]\" VALUE=\"$field\" />";
return $ret;
}
/*
@description: creates an INPUT tag (type radio) for a form field. All extra attributes are passed to the INPUT tag
@attrib: _Form:: Form name for the field
@attrib: _Field:: Field Name
@attrib: _Value:: Value assigned to radio button. If the form field value matches this attribute, the radio button is CHECKED
@attrib: _Required:bool: If set, In-Portal requires this field have a value when submitting
@attrib: _Custom:bool: If set, handled as a custom field
@example: <inp:m_form_checkbox _field="owner_notify" _Form="edit_topic" />
*/
function m_form_radio($attribs = array())
{
global $FormValues, $objConfig;
$html_attribs = ExtraAttributes($attribs);
$form = $attribs["_form"];
$field = strtolower($attribs["_field"]);
$val = $attribs["_value"];
if(isset($_POST[$field]))
{
$value = (int)$_POST[$field];
if($value==1)
$checked = " CHECKED";
}
else
{
$value = (int)$FormValues[$form][$field];
if($value==$val)
$checked=" CHECKED";
}
//echo $form.".".$field."=".$value."<br>\n";
$ret = "<INPUT TYPE=\"radio\" $html_attribs name=\"$field\" VALUE=\"$val\" $checked />";
if($attribs["_required"])
$ret .= "<input type=hidden name=\"required[]\" VALUE=\"$field\" />";
if($attribs["_custom"])
$ret .= "<input type=hidden name=\"custom[]\" VALUE=\"$field\" />";
return $ret;
}
/*
@description: returns the value for a form field. This may be defaulted by the system or set by a previus submit (as in an error condition)
@attrib: _Form:: Form name for the field
@attrib: _Field:: Field Name
@example: <inp:m_form_value _field="owner_notify" _Form="edit_topic" />
*/
function m_form_value($attribs = array())
{
global $FormValues;
$form = $attribs["_form"];
$field = strtolower($attribs["_field"]);
if(isset($_POST[$field]))
{
$value = inp_htmlize($_POST[$field],1);
}
else
$value = inp_htmlize($FormValues[$form][$field]);
//echo "<pre>"; print_r($FormValues); echo "</pre>";
return $value;
}
/*
@description: creates an form OPTION tag for a form SELECT tag.
All extra attributes are passed to the OPTION tag.
@attrib: _Form:: Form name for the field
@attrib: _Field:: Field Name
@attrib: _Value:: Value to use for this option (ie the value attribute) If the current value of the select
field is the same as this attribute, then this option will be set SELECTED.
@attrib: _langtext:lang: language tag to display for this option in the SELECT dropdown
@attrib: _plaintext:: plain text to display for this option in the SELECT dropdown (if _langtext is set, it is used instead of _plaintext)
@example: <inp:m_form_option _value="3321" _field="formfield" _form="formname" _langtext="lu..."
*/
function m_form_option($attribs = array())
{
global $FormValues;
$html_attribs = ExtraAttributes($attribs);
$field = $attribs["_field"];
$val = $attribs["_value"];
if(isset($_POST[$field]))
{
$value = $_POST[$field];
}
else
{
$value = $FormValues[$attribs['_form']][$field];
}
$selected = ($val == $value)? "SELECTED" : "";
if(strlen($attribs["_langtext"]))
{
$txt = language($attribs["_langtext"]);
}
else
$txt = $attribs["_plaintext"];
$o = "<OPTION $html_attribs VALUE=\"$val\" $selected>$txt</OPTION>";
return $o;
}
/*
@description: creates an form TEXTAREA field. All extra attributes are passed to the TEXTAREA tag
@attrib: _Form:: Form name for the field
@attrib: _Field:: Field Name
@attrib: _Required:bool: If set, In-Portal requires this field have a value when submitting
@attrib: _Custom:bool: If set, handled as a custom field
@example: <inp:m_form_textarea class="textarea" _field="bb_signature" _Form="bb_profile" ID="textbody" style="width:300px;" ROWS=10 COLS=65 WRAP="VIRTUAL" />
*/
function m_form_textarea($attribs = array())
{
global $FormValues;
$html_attribs = ExtraAttributes($attribs);
$field = $attribs["_field"];
$form = $attribs["_form"];
if(isset($_POST[$field]))
{
$value = inp_htmlize($_POST[$field],1);
}
else
{
$value = inp_htmlize($FormValues[$attribs["_form"]][$field]);
}
$ret = "<TEXTAREA NAME=\"$field\" $html_attribs>$value</TEXTAREA>";
if($attribs["_required"])
{
$ret .= "<input type=hidden name=required[] VALUE=\"$field\" />";
}
if($attribs["_custom"])
{
$ret .= "<input type=hidden name=\"custom[]\" VALUE=\"$field\" />";
}
return $ret;
}
/*
@description: creates an form field to upload images. (INPUT type=file) All extra attributes are passed to the INPUT tag
@attrib: _Form:: Form name for the field
@attrib: _Field:: Field Name
@attrib: _Required:bool: If set, In-Portal requires this field have a value when submitting
@attrib: _ImageTypes:: Comma-separated list of file extensions allowed
@attrib: _Thumbnail:bool: If true, image is treated as a thumbnail
@attrib: _ImageName:: System name of image being uploaded
@attrib: _MaxSize:int: Maximum size of image to upload, or 0 to allow all
*/
function m_form_imageupload($attribs = array())
{
$html_attribs = ExtraAttributes($attribs);
$field = $attribs["_field"];
$form = $attribs["_form"];
$TypesAllowed = $attribs["_imagetypes"];
$isthumb = (int)$attribs["_thumbnail"];
$imgname = $attribs["_imagename"];
$maxsize = $attribs["_maxsize"];
$ret = "<INPUT $html_attribs TYPE=file NAME=\"$field\" >";
$ret .= "<INPUT TYPE=HIDDEN name=\"isthumb[$field]\" VALUE=\"$isthumb\">";
$ret .= "<INPUT TYPE=HIDDEN name=\"imagetypes[$field]\" VALUE=\"$TypesAllowed\">";
$ret .= "<INPUT TYPE=HIDDEN name=\"imagename[$field]\" VALUE=\"$imgname\">";
$ret .= "<INPUT TYPE=HIDDEN name=\"maxsize[$field]\" VALUE=\"$maxsize\">";
if($attribs["_required"])
$ret .= "<input type=hidden name=required[] VALUE=\"$field\" />";
return $ret;
}
/*
@description: Returns the error text for a form field, or nothing if no error exists for the field
@attrib: _Form:: Form name for the field
@attrib: _Field:: Field Name
*/
function m_form_error($attribs = array())
{
global $FormError;
$form = $attribs["_form"];
$field = $attribs["_field"];
return $FormError[$form][$field];
}
/**
@description: Provides a simple solution for displaying a language flag when a form has an error. Generic and limited to 1 language vairable.
@attrib: _Form:: Form name for the field
*/
function m_form_has_errors($attribs = array())
{
// shows specified template once if form has error(-s)
global $FormError;
$f = $attribs["_form"];
$ret = is_array($FormError[$f]);
if(!$ret) return '';
return isset($attribs["_asif"]) ? true : language('lu_errors_on_form');
}
/**
@description: Lists form errors for all fields in a form
@attrib: _Form:: Form name for the field
@attrib: _ItemTemplate:tpl: Template used to display each form error (if not set, "<inp:form_error />" is used)
*/
function m_list_form_errors($attribs = array())
{
global $FormError, $content_set, $objTemplate;
$t = $attribs["_itemtemplate"];
if(!strlen($t))
$templateText = "<inp:form_error />";
$f = $attribs["_form"];
$o = "";
if (strlen($t))
{
$rawtext = $objTemplate->GetTemplate($t, true);
$src = $rawtext->source;
}
else
$src = $templateText;
//echo $f."<br>";
//echo $t."<br>";
// echo "<PRE>"; print_r($FormError); echo "</pre>";
if(is_array($FormError[$f]))
{
foreach($FormError[$f] as $e)
{
$o .= str_replace("<inp:form_error />",$e, $src);
}
}
if(!strlen($o))
$content_set = 0;
return $o;
}
function m_form_load_values($FormName,$IdValue)
{
global $FormValues, $objUsers, $objSession, $objConfig;
switch($FormName)
{
case "m_acctinfo":
$u =& $objUsers->GetItem($IdValue);
$FormValues[$FormName]["username"] = $u->Get("Login");
//$FormValues[$FormName]["password"] = $u->Get("Password");
//$FormValues[$FormName]["passwordverify"] = $u->Get("Password");
$FormValues[$FormName]["password"] = "";
$FormValues[$FormName]["passwordverify"] = "";
$FormValues[$FormName]["firstname"] = $u->Get("FirstName");
$FormValues[$FormName]["lastname"] = $u->Get("LastName");
$FormValues[$FormName]["email"] = $u->Get("Email");
$FormValues[$FormName]["phone"] = $u->Get("Phone");
$FormValues[$FormName]["street"] = $u->Get("Street");
$FormValues[$FormName]["city"] = $u->Get("City");
$FormValues[$FormName]["state"] = $u->Get("State");
$FormValues[$FormName]["zip"] = $u->Get("Zip");
$FormValues[$FormName]["country"] = $u->Get("Country");
// $FormValues[$FormName]["dob"] = LangDate($u->Get("dob"));
$FormValues[$FormName]["dob_day"] = adodb_date("d", $u->Get("dob"));
$FormValues[$FormName]["dob_year"] = adodb_date("Y", $u->Get("dob"));
$FormValues[$FormName]["dob_month"] = adodb_date("m", $u->Get("dob"));
$u->LoadCustomFields();
if(is_array($u->CustomFields))
{
foreach($u->CustomFields as $f=>$v)
{
$FormValues[$FormName][$f] = $v;
}
}
break;
case "m_profile":
$u =& $objUsers->GetItem($IdValue);
if(is_object($u))
{
$FormValues[$FormName]["pp_firstname"] = $objSession->GetPersistantVariable("pp_firstname");
$FormValues[$FormName]["pp_lastname"] = $objSession->GetPersistantVariable("pp_lastname");
$FormValues[$FormName]["pp_dob"] = $objSession->GetPersistantVariable("pp_dob");
$FormValues[$FormName]["pp_email"] = $objSession->GetPersistantVariable("pp_email");
$FormValues[$FormName]["pp_phone"] = $objSession->GetPersistantVariable("pp_phone");
$FormValues[$FormName]["pp_street"] = $objSession->GetPersistantVariable("pp_street");
$FormValues[$FormName]["pp_city"] = $objSession->GetPersistantVariable("pp_city");
$FormValues[$FormName]["pp_state"] = $objSession->GetPersistantVariable("pp_state");
$FormValues[$FormName]["pp_zip"] = $objSession->GetPersistantVariable("pp_zip");
$FormValues[$FormName]["pp_country"] = $objSession->GetPersistantVariable("pp_country");
}
break;
case "m_simplesearch":
$FormValues[$FormName]["keywords"] = $objSession->GetVariable("Search_Keywords");
break;
case "m_simple_subsearch":
$FormValues[$FormName]["keywords"] = $objSession->GetVariable("Search_Keywords");
break;
}
}
/*
@description: Generates the ACTTION property for a FORM tag used by In-Portal
@attrib: _Template:tpl: If set, this is the template the form submits to (default is the current template)
@attrib: _Form:: The form name<br>Possible Values:
<UL>
<LI>login: user login
<LI>logout: user logout
<LI>forgotpw: Form to prompt the user for forgotten password information
<LI>forgotpw_confirm: confirmation form for forgotpw
<LI>suggest: form to suggest the site to a friend
<LI>suggest_confirm: form to confirm suggestion of the site to a friend
<LI>m_subscribe: form to subscribe to the mailing list
<LI>subscribe_confirm: form to confirm subscription to the mailing list
<LI>m_unsubscribe: form to unsubscribe from the mailing list
<LI>unsubscribe_confirm: form to confirm un-subscription from the mailing list
<LI>m_acctinfo: user account information
<LI>m_profile: system-level profile information
<LI>m_register: New User registration form
<LI>m_addcat: Suggest Category form
<LI>m_addcat_confirm: Confirmation for add category
<LI>m_simplesearch: Perform a simple search
<LI>m_simple_subsearch: Search within results
<LI>m_adv_searchtype: Form to select type of advanced search
<LI>m_adv_subsearch: Advanced Search
<LI>error_access: form displayed on the access denied template
<LI>error_template: Form displayed on the template error page
<LI>m_set_theme: Form displayed for theme selection
</UL>
@attrib: _SubscribeTemplate:tpl: The destination template with "m_subscribe", "subscribe_confirm", "unsubscribe_confirm" _Form actions. Can be reused in other scenarios as programmed.
@attrib: _UnSubscribeTemplate:tpl: The destination template for "m_subscribe" _Form action. Can be reused in other scenarios as programmed.
@attrib: _ConfirmTemplate:tpl: The destination template for "m_unsubscribe", "suggest" _Form actions. Can be reused in other scenarios as programmed.
@attrib: _DestTemplate:tpl: The destination template for "suggest_confirm", "suggest" _Form actions. Can be reused in other scenarios as programmed.
@attrib: _ErrorTemplate:tpl: The destination template extensively used in most of _Form actions in case of error.
@attrib: _Referer:bool: The destination template will be taken from referer page we can from.
@example: <FORM enctype="multipart/form-data" method="POST" NAME="article_review" ACTION="<inp:m_form_action _Form="register" _confirm="join_confirm" />">
*/
function m_form_action($attribs = array())
{
global $var_list, $var_list_update, $m_var_list_update, $objSession, $objConfig, $objCatList;
$target_template = $attribs["_template"];
if(strlen($target_template))
{
$var_list_update["t"] = $target_template;
}
else
$var_list_update["t"] = $var_list["t"];
$ret = "";
$form = strtolower($attribs["_form"]);
switch($form)
{
case "login":
if(!$objSession->SessionEnabled())
{
$var_list_update["t"] = "error_session";
$ret = GetIndexURL(2)."?env=" . BuildEnv();
}
else
{
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_login";
if($attribs["_successtemplate"])
{
$ret .= "&dest=".$attribs["_successtemplate"];
}
else
if(strlen($var_list["dest"]))
$ret .= "&dest=".$var_list["dest"];
}
break;
case "logout":
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_logout";
break;
case "forgotpw":
if(!$objSession->SessionEnabled())
{
$var_list_update["t"] = "error_session";
$ret = GetIndexURL(2)."?env=" . BuildEnv();
}
else
{
if(strlen($attribs["_errortemplate"]))
{
$err = $attribs["_errortemplate"];
}
else
$err = $var_list["t"];
$ret = GetIndexURL(2)."?env=".BuildEnv()."&Action=m_forgotpw&error=$err";
}
break;
case "forgotpw_confirm":
$ret = GetIndexURL(2)."?env=".BuildEnv();
break;
case "suggest":
if(!$objSession->SessionEnabled())
{
$var_list_update["t"] = "error_session";
$ret = GetIndexURL(2)."?env=" . BuildEnv();
}
else
{
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_suggest_email";
if(strlen($attribs["_confirmtemplate"])>0)
{
$ret .= "&Confirm=".$attribs["_confirmtemplate"];
}
if(strlen($Dest))
{
$ret .= "&DestTemplate=$Dest";
}
else
{
if(strlen($attribs["_confirmtemplate"])>0)
$ret .="&DestTemplate=".$var_list["t"];
}
if(strlen($attribs["_errortemplate"])>0)
{
$ret .= "&Error=".$attribs["_errortemplate"];
}
}
break;
case "suggest_confirm":
if(!$objSession->SessionEnabled())
{
$var_list_update["t"] = "error_session";
$ret = GetIndexURL(2)."?env=" . BuildEnv();
}
else
{
if(strlen($_GET["DestTemplate"]))
{
$var_list_update["t"] = $_GET["DestTemplate"];
}
else
$var_list_update["t"] = "index";
$ret = GetIndexURL(2)."?env=" . BuildEnv();
}
break;
case "m_subscribe":
if(!$objSession->SessionEnabled())
{
$var_list_update["t"] = "error_session";
$ret = GetIndexURL(2)."?env=" . BuildEnv();
}
else
{
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_subscribe_confirm";
if(strlen($attribs["_subscribetemplate"]))
{
$ret .="&Subscribe=".$attribs["_subscribetemplate"];
}
if(strlen($attribs["_unsubscribetemplate"])>0)
{
$ret .= "&Unsubscribe=".$attribs["_unsubscribetemplate"];
}
if(strlen($attribs["_errortemplate"])>0)
{
$ret .= "&Error=".$attribs["_errortemplate"];
}
}
break;
case "subscribe_confirm":
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_subscribe";
if($attribs["_subscribetemplate"])
$ret .= "&Subscribe=".$attribs["_subscribetemplate"];
break;
case "unsubscribe_confirm":
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_unsubscribe";
if($attribs["_subscribetemplate"])
$ret .= "&Subscribe=".$attribs["_subscribetemplate"];
break;
case "m_unsubscribe":
if(!$objSession->SessionEnabled())
{
$var_list_update["t"] = "error_session";
$ret = GetIndexURL(2)."?env=" . BuildEnv();
}
else
{
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_unsubscribe";
if(strlen($attribs["_confirmtemplate"])>0)
{
$ret .= "&Confirm=".$attribs["_confirmtemplate"];
}
if(strlen($Dest))
{
$ret .= "&DestTemplate=$Dest";
}
else
{
if(strlen($attribs["_confirmtemplate"])>0)
$ret .="&DestTemplate=".$var_list["t"];
}
}
if(strlen($attribs["_confirmtemplate"])>0)
{
$ret .="&ErrorTemplate=".$attribs["_confirmtemplate"];
}
break;
case "m_unsubscribe_confirm":
$ret = GetIndexURL(2)."?env=" . BuildEnv();
break;
case "m_acctinfo":
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_acctinfo&UserId=".$objSession->Get("PortalUserId");
m_form_load_values($form, $objSession->Get("PortalUserId"));
break;
case "m_profile":
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_profile&UserId=".$objSession->Get("PortalUserId");
m_form_load_values($form,$objSession->Get("PortalUserId"));
break;
case "m_set_theme":
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_set_theme";
break;
case "m_register":
if(!$objSession->SessionEnabled())
{
$var_list_update["t"] = "error_session";
$ret = GetIndexURL(2)."?env=" . BuildEnv();
}
else
{
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_register";
switch ($objConfig->Get("User_Allow_New"))
{
case "1":
if(strlen($attribs["_confirmtemplate"]) && $objConfig->Get("User_Password_Auto"))
$_dest = "&dest=".$attribs["_confirmtemplate"];
else
$_dest = "&dest=".$attribs["_logintemplate"];
break;
case "2":
if(strlen($attribs["_notallowedtemplate"]))
$_dest = "&dest=".$attribs["_notallowedtemplate"];
break;
case "3":
if(strlen($attribs["_pendingtemplate"]))
$_dest = "&dest=".$attribs["_pendingtemplate"];
break;
}
if (strlen($_dest))
$ret .= $_dest;
}
break;
case "register_confirm":
if(!$objSession->SessionEnabled())
{
$var_list_update["t"] = "error_session";
$ret = GetIndexURL(2)."?env=" . BuildEnv();
}
else
{
$ret = GetIndexURL(2)."?env=" . BuildEnv();
}
break;
case "m_addcat":
if(!$objSession->SessionEnabled())
{
$var_list_update["t"] = "error_session";
$ret = GetIndexURL(2)."?env=" . BuildEnv();
}
else
{
$action = "m_add_cat";
if ($objSession->HasCatPermission("CATEGORY.ADD.PENDING"))
{
if(strlen($attribs["_confirmpending"]))
{
$ConfirmTemplate = $attribs["_confirmpending"];
}
else
$ConfirmTemplate = $attribs["_confirm"];
$action="m_add_cat_confirm";
}
if ($objSession->HasCatPermission("CATEGORY.ADD"))
{
$ConfirmTemplate = $attribs["_confirm"];
$action="m_add_cat_confirm";
}
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=$action";
if(strlen($ConfirmTemplate))
$ret .= "&Confirm=$ConfirmTemplate";
if (strlen($attribs["_mod_finishtemplate"])) {
$CurrentCat = $objCatList->CurrentCategoryID();
if((int)$CurrentCat>0)
{
$c = $objCatList->GetCategory($CurrentCat);
//will prefix the template with module template root path depending on category
$ids = $c->GetParentIds();
$tpath = GetModuleArray("template");
$roots = GetModuleArray("rootcat");
// get template path of module, by searching for moudle name
// in this categories first parent category
// and then using found moudle name as a key for module template paths array
$path = $tpath[array_search ($ids[0], $roots)];
$t = $path . $attribs["_mod_finishtemplate"];
}
else {
$t = $attribs["_mod_finishtemplate"]; //Just in case
}
}
else {
$t = $attribs["_finishtemplate"];
}
$ret .="&DestTemplate=".$t;
}
break;
case "m_addcat_confirm":
$target_template = $_GET["DestTemplate"];
if(strlen($target_template))
{
$var_list_update["t"] = $target_template;
}
else
$var_list_update["t"] = $var_list["t"];
$ret = GetIndexURL(2)."?env=".BuildEnv();
break;
case "m_simplesearch":
if(!$objSession->SessionEnabled())
{
$var_list_update["t"] = "error_session";
$ret = GetIndexURL(2)."?env=" . BuildEnv();
}
else
{
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_simple_search";
if(strlen($attribs["_errortemplate"]))
$ret.= "&Error=".$attribs["_errortemplate"];
m_form_load_values($form, 0);
}
break;
case "m_simple_subsearch":
if(!$objSession->SessionEnabled())
{
$var_list_update["t"] = "error_session";
$ret = GetIndexURL(2)."?env=" . BuildEnv();
}
else
{
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_simple_subsearch";
m_form_load_values($form,0);
}
break;
case "m_adv_search_type":
if(!$objSession->SessionEnabled())
{
$var_list_update["t"] = "error_session";
$ret = GetIndexURL(2)."?env=" . BuildEnv();
}
else
{
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_advsearch_type";
m_form_load_values($form,0);
}
break;
case "m_adv_search":
$SearchType = $_GET["type"];
if(!is_numeric($SearchType))
$SearchType = $_POST["itemtype"];
if(!$objSession->SessionEnabled() && !strlen($SearchType))
{
$var_list_update["t"] = "error_session";
$ret = GetIndexURL(2)."?env=" . BuildEnv();
}
else
{
$ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_adv_search&type=$SearchType";
m_form_load_values($form,0);
}
break;
case "error_access":
$target_template = $_GET["DestTemplate"];
if(!strlen($target_template))
$target_template="login";
$var_list_update["t"] = $target_template;
$ret = GetIndexURL(2)."?env=" . BuildEnv();
break;
case "error_template":
$target_template = $_GET["DestTemplate"];
if($attribs["_referer"] == 1)
{
$target_template = "_referer_";
}
elseif (!strlen($target_template))
{
$target_template = "index";
}
$var_list_update["t"] = $target_template;
// $m_var_list_update["cat"]=0;
$ret = GetIndexURL(2)."?env=".BuildEnv();
break;
}
return $ret;
}
/*
@description: creates a URL to allow the user to log out. Accepts the same attributes as m_template_link
*/
function m_logout_link($attribs)
{
$ret = m_template_link($attribs)."&Action=m_logout";
return $ret;
}
/*
@description: returns a URL to the current theme
@attrib: _page:: Additional address to be added to the end of the theme URL
*/
function m_theme_url($attribs=array())
{
global $objConfig,$objSession, $objThemes, $CurrentTheme;
if(!is_object($CurrentTheme))
$CurrentTheme = $objThemes->GetItem($m_var_list["theme"]);
$theme_url = "http://". ThisDomain().$objConfig->Get("Site_Path")."themes/".$CurrentTheme->Get("Name")."/";
if($attribs["_page"])
{
if ($attribs["_page"] != 'current')
{
$theme_url .= $attribs["_page"];
}
else
{
$theme_url = "http://".ThisDomain().$objConfig->Get("Site_Path")."index.php?env=".BuildEnv();
}
}
return $theme_url;
}
/*
@description: returns a URL to the current theme
*/
function m_current_page_url($attribs=array())
{
global $objConfig,$objSession;
$theme_url = "http://".$objConfig->Get("Site_Path")."index.php?env=".BuildEnv();
return $theme_url;
}
/*
@description: returns a URL to the current theme
@attrib: _fullpath:bool: Append the title with the full path of the current category
@attrib: _currentcategory:bool: Append the title with the current category
@attrib: _catfield:: If _currentcategory is used, this attribute determines which category field to use (Name, Description, etc) Defaults to Name
*/
function m_page_title($attribs = array())
{
global $objConfig, $objCatList;
$ret = $objConfig->Get("Site_Name");
if($attribs["_fullpath"] || $attribs["_currentcategory"])
{
$CurrentCat = $objCatList->CurrentCategoryID();
if((int)$CurrentCat>0)
{
$c = $objCatList->GetCategory($CurrentCat);
if($attribs["_fullpath"])
{
$path = $c->Get("CachedNavbar");
if(strlen($path))
$ret .= " - ".$path;
}
else
{
if($attribs["_currentcategory"])
{
$f = $attribs["_catfield"];
if(!strlen($f))
$f = "Name";
$ret .= " - ".$c->Get($f);
}
}
}
}
$ret = stripslashes($ret);
return $ret;
}
/*
@description: list all active themes
@attrib: _ItemTemplate:tpl: Template to display each theme in the list
*/
function m_list_themes($attribs=array())
{
global $objThemes;
$t = $attribs["_itemtemplate"];
if(strlen($t))
{
$objThemes->Clear();
$objThemes->LoadThemes("Enabled=1","PrimaryTheme DESC");
foreach($objThemes->Items as $theme)
{
$o .= $theme->ParseTemplate($t);
}
}
return $o;
}
/*
@description: display text based on the user's language
@attrib: _Phrase:lang: label to replace with language-specific text
@example: <inp:m_language _Phrase="lu_hello_world" />
*/
function m_language($attribs)
{
global $objSession, $objLanguages, $ForceLanguage;
$phrase = $attribs["_phrase"];
$LangId = (int)$ForceLanguage;
if(strlen($phrase))
{
$lang = getArrayValue($attribs,'_language');
if(strlen($lang))
{
$l = $objLanguages->GetItemByField("PackName",$lang);
if(is_object($l))
{
$LangId = $l->Get("LanguageId");
}
}
return language($phrase,$LangId);
}
else
return "";
}
/*
@description: Creates a URL used to set the current language for a user
@attrib: _language:: Language to set (this value should be the language Pack Name)
*/
function m_setlang_link($attribs)
{
global $m_var_list_update, $objSession,$objLanguages;
$lang = $attribs["_language"];
if(strlen($lang))
{
$l = $objLanguages->GetItemByField("PackName",$lang);
if(is_object($l))
$LangId = $l->Get("LanguageId");
}
else
$LangId=$objSession->Get("Language");
if($LangId)
{
$m_var_list_update["lang"] = $LangId;
$ret = GetIndexURL(2)."?env=".BuildEnv();
unset($m_var_list_update["lang"]);
}
else
$ret = "";
return $ret;
}
/*
@description: list all active languages
@attrib: _ItemTemplate:tpl: Template to display each language in the list
*/
function m_list_languages($attribs)
{
global $objLanguages, $content_set;
$sql = "SELECT * FROM ".GetTablePrefix()."Language WHERE Enabled=1";
$objLanguages->Clear();
$objLanguages->Query_Item($sql);
if($objLanguages->NumItems()>0)
{
foreach($objLanguages->Items as $l)
$o .= $l->ParseTemplate($attribs["_itemtemplate"]);
}
else
$content_set=0;
return $o;
}
/*
@description: returns the date format for a language
@attrib: _lang:: Pack Name of language to use. The current language is used if this is not set
*/
function m_lang_dateformat($attribs=array())
{
global $objLanguages, $objSession;
$lang = $attribs["_lang"];
if(!strlen($lang))
{
$LangId = $objSession->Get("Language");
$l = $objLanguages->GetItem($LangId);
}
else
{
$l = $objLanguages->GetItemByField("PackName",$lang);
}
$fmt = GetDateFormat($LangId);
$fmt = GetStdFormat($fmt);
return $fmt;
}
/*
@description: returns a language field value
@attrib: _Field:: Language field to return
@attrib: _lang:: Pack Name of language to use. The current language is used if this is not set
*/
function m_lang_field($attribs = array())
{
global $objLanguages, $objSession;
if(!strlen($attribs["_field"]))
return "";
$lang = $attribs["_lang"];
if(!strlen($lang))
{
$LangId = $objSession->Get("Language");
$l = $objLanguages->GetItem($LangId);
}
else
{
$l = $objLanguages->GetItemByField("PackName",$lang);
}
if(is_object($l))
{
//$ret = $l->Get($attribs["_field"]);
$e = new clsHtmlTag();
$e->name=$l->TagPrefix;
$e->attributes=$attribs;
$ret = $l->ParseObject($e);
}
return $ret;
}
/*
@description: Creates a URL used to set the current theme for a user
@attrib: _theme:: Name of Theme to set. The template selected in the new them is always "index"
*/
function m_settheme_link($attribs)
{
global $m_var_list_update, $objSession, $objThemes, $CurrentTheme;
$ThemeName = $attribs["_theme"];
if(strlen($ThemeName))
{
$t = $objThemes->GetItemByField("Name",$ThemeName);
if(is_object($t))
{
$Id = $t->Get("ThemeId");
}
else
$Id = 0;
}
else
{
$t = $CurrentTheme;
$Id = 0;
}
$m_var_list_update["theme"] = $Id;
$ret = GetIndexURL(2)."?env=".BuildEnv();
unset($m_var_list_update["theme"]);
return $ret;
}
/*
@description: Initializes categories
*/
function m_init_cats($attribs = array())
{
// save current & previous category (used in pagination)
global $objSession, $objCatList;
global $var_list;
//echo "SID_INIT: ".$var_list["sid"].'(COOKIE_SID: '.$_COOKIE["sid"].')<br>';
$objSession->SetVariable('prev_category', $objSession->GetVariable('last_category') );
$objSession->SetVariable('last_category', $objCatList->CurrentCategoryID() );
//$last_cat = $objSession->GetVariable('last_category');
//$prev_cat = $objSession->GetVariable('prev_category');
//echo "Last CAT: [$last_cat]<br>";
//echo "Prev CAT: [$prev_cat]<br>";
}
/*
@description: List all subcategories a user is allowed to view
@attrib: _columns:int: Numver of columns to display the categories in (defaults to 1)
@attrib: _maxlistcount:int: Maximum number of categories to list
@attrib: _FirstItemTemplate:tpl: Template used for the first category listed
@attrib: _LastItemTemplate:tpl: Template used for the last category listed
@attrib: _ItemTemplate:tpl: default template used for category list items
@attrib: _NoTable:bool: If set to 1, the categories will not be listed in a table. If a table is used, all HTML attributes are passed to the TABLE tag
@example: <inp:m_list_cats _NoTable="0" _columns="2" _ItemTemplate="catlist_element" border="0" cellspacing="0" cellpadding="0" width="98%" />
*/
function m_list_cats($attribs = array())
{
global $var_list, $objConfig, $objSession, $objCatList, $var_list_update, $content_set, $objSystemCache;
$CachedList = GetTagCache("kernel","m_list_cats",$attribs,m_BuildEnv());
if(strlen($CachedList))
{
return $CachedList;
}
$cols = $attribs["_columns"];
if($cols<1)
$cols =1;
$CategoryId = $attribs["_catid"];
if(!is_numeric($CategoryId))
$CategoryId = $objCatList->CurrentCategoryID();
$cat_count = (int)$attribs["_maxlistcount"];
/* validation */
if(strlen($attribs["_itemtemplate"])==0)
{
if($attribs["dataexists"])
$content_set = 0;
return "";
}
$GroupList = $objSession->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];
$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))";
$objCatList->Clear();
$OrderBy = $objCatList->QueryOrderByClause(TRUE,TRUE,TRUE);
$objCatList->LoadCategories("ParentId=$CategoryId AND Status=1",$OrderBy);
if ($objCatList->NumItems() == 0)
{
if($attribs["_dataexists"])
$content_set = 0;
return "";
}
$html_attr = ExtraAttributes($attribs);
$o="";
$notable = $attribs["_notable"];
$count=0;
$row=0;
$var_list_update["t"] = $var_list["t"];
if(!$notable)
{
$per_row = ceil($objCatList->NumItems()/$cols);
$o = "<TABLE $html_attr><TR CLASS=\"m_list_cats\">";
$o .= "<TD valign=\"top\">";
$CatCount = $objCatList->NumItems();
foreach($objCatList->Items as $cat)
{
$parsed=0;
if($count==$per_row)
{
$o .= "</TD><TD valign=\"top\">";
$count=0;
}
if($row==0 && strlen($attribs["_firstitemtemplate"]))
{
$o.= $cat->ParseTemplate($attribs["_firstitemtemplate"]);
$parsed=1;
}
if($row==$CatCount-1 && !$parsed && strlen($attribs["_lastitemtemplate"])>0)
{
$o .= $cat->ParseTemplate($attribs["_lastitemtemplate"]);
$parsed=1;
}
if(!$parsed)
$o.= $cat->ParseTemplate($attribs["_itemtemplate"]);
$count++;
$row++;
}
if($count != $per_row)
$o .= "</TD>";
$o .= "\n</tr></table>\n";
}
else
{
$CatCount = $objCatList->NumItems();
foreach($objCatList->Items as $cat)
{
if($cat->Get("ParentId")==$CategoryId)
{
if($row==0 && strlen($attribs["_firstitemtemplate"]))
{
//echo 'Saving <b>ID</b> in <b>m_sub_cats</b>[ first ] '.$cat->UniqueId().'<br>';
//$GLOBALS['cat_ID'] = $cat->UniqueId();
$o.= $cat->ParseTemplate($attribs["_firstitemtemplate"]);
$parsed=1;
}
if($row==$CatCount-1 && !$parsed && strlen($attribs["_lastitemtemplate"])>0)
{
//echo 'Saving <b>ID</b> in <b>m_sub_cats</b>[ last ] '.$cat->UniqueId().'<br>';
//$GLOBALS['cat_ID'] = $cat->UniqueId();
$o .= $cat->ParseTemplate($attribs["_lastitemtemplate"]);
$parsed=1;
}
if(!$parsed)
{
//echo 'Saving <b>ID</b> in <b>m_sub_cats</b>[ each ] '.$cat->UniqueId().'<br>';
//$GLOBALS['cat_ID'] = $cat->UniqueId();
$o .= $cat->ParseTemplate($attribs["_itemtemplate"]);
}
$row++;
$i++;
$count++;
if($count>=$cat_count && $cat_count>0)
break;
}
}
}
unset($var_list_update["t"]);
SaveTagCache("kernel","m_list_cats",$attribs,m_BuildEnv(),$o);
return $o;
}
function LoadCatSearchResults($attribs)
{
global $objSession, $objPermissions, $objCatList, $objSearchCats, $objConfig, $CountVal, $m_var_list;
$GroupList = $objSession->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];
$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))";
$CAT_VIEW = $objPermissions->GetPermId("CATEGORY.VIEW");
$ctable = $objCatList->SourceTable;
$stable = $objSession->GetSearchTable(); // $objSearchCats->SourceTable;
$ptable = GetTablePrefix()."PermCache";
$sql = "SELECT * FROM $stable INNER JOIN $ctable ON ($stable.ItemId=$ctable.CategoryId) ";
$sql .= "INNER JOIN $ptable ON ($ctable.CategoryId=$ptable.CategoryId) ";
$sql .="WHERE ItemType=1 AND Status=1 AND $acl_where AND PermId=$CAT_VIEW ORDER BY EdPick DESC,Relevance DESC ";
$objSearchCats->Page = $m_var_list["p"];
if($objSearchCats->Page<1)
$objSearchCats->Page=1;
if(is_numeric($objConfig->Get($objSearchCats->PerPageVar)))
{
$Start = ($objSearchCats->Page-1)*$objConfig->Get($objSearchCats->PerPageVar);
$limit = "LIMIT ".$Start.",".$objConfig->Get($objSearchCats->PerPageVar);
}
else
$limit = NULL;
if(strlen($limit))
$sql .= $limit;
// echo "TEST:<BR>$sql<br>\n";
$objSearchCats->Query_Item($sql);
$where = "ItemType=1";
if(is_numeric($CountVal[1]))
{
$objSearchCats->QueryItemCount = $CountVal[1];
}
else
{
$objSearchCats->QueryItemCount = QueryCount($sql);
$CountVal[1]= $objSearchCats->QueryItemCount;
}
}
/*
@description: Used in conjuction with m_search_list_cats. This function generates a navigation link which is
used to switch from a short list to a longer list. The page number is not changed.
If this tag is called before the list tag, this function will load the category list.
Generally, it is good practice to duplicate all attributes set for m_search_list_cats.
Any extra HTML attributes are passed to the anchor tag
@attrib: _Template:tpl: Template to link to
@attrib: _text:lang: language tag to include as text for the anchor tag
@attrib: _plaintext:: plain text to include as text for the anchor tag. The _text attribute takes presedence
if both are included.
@attrib: _image:: URL to an image to include inside the anchor tag.
*/
function m_search_cat_more($attribs = array())
{
global $objSearchCats, $objConfig, $m_var_list_update;
$html_attribs = ExtraAttributes($attribs);
$DestTemplate = $attribs["_template"];
if($attribs["_shortlist"])
$objSearchList->PerPageVar = "Perpage_Category_Short";
if($objSearchCats->NumItems()==0)
{
LoadCatSearchResults($attribs);
}
$max = $objConfig->Get($objSearchList->PerPageVar);
$val = $objSearchCats->QueryItemCount;
if($val > $max)
{
if($attribs["_root"])
$attribs["_category"]=0;
$m_var_list_update["p"]=1;
$url = m_template_link($attribs);
unset($m_var_list_update["p"]);
$o = "<A $html_attribs HREF=\"$url\">";
$text = $attribs["_text"];
if(!strlen($text))
{
$text = $attribs["_plaintext"];
if(!strlen($text))
{
}
$o .= $text."</A>";
}
else
$o .= language($text);
if(strlen($attribs["_image"]))
{
$o .= "<IMG SRC=\"".$attribs["_image"]."\" BORDER=\"0\" />";
}
$o .= "</A>";
}
return $o;
}
/*
@description: Used in conjuction with m_search_list_cats. This function generates the page navigation
for the list. If this tag is called before the list tag, this function will load
the category list. Generally, it is good practice to duplicate all attributes set for
m_search_list_cats.
@attrib: _PagesToList:int: Number of pages to list (default is 10)
@attrib: _label:lang: language tag to include in the output if there are pages to list. If there are no pages
listed, this text will not be included (resulting in an empty output)
*/
function m_search_cat_pagenav($attribs = array())
{
global $objSearchCats, $objConfig, $objCatList, $objSession;
$DestTemplate = $attribs["_template"];
$PagesToList = $attribs["_pagestolist"];
if(!is_numeric($PagesToList))
$PagesToList = 10;
$CatId = $attribs["_catid"];
if(!is_numeric($CatId))
$CatId = $objCatList->CurrentCategoryID();
$objSearchCats->PerPageVar = "Perpage_Category";
if($attribs["_shortlist"])
$objSearchCats->PerPageVar = "Perpage_Category_Short";
if($objSearchCats->NumItems()==0)
{
LoadCatSearchResults($attribs);
}
$o = $objSearchCats->GetPageLinkList($DestTemplate);
if(strlen($o) && strlen($attribs["_label"]))
$o = language($attribs["_label"]).$o;
return $o;
}
/*
@description: List all categories matched in a search
@attrib: _columns:int: Numver of columns to display the categories in (defaults to 1)
@attrib: _maxlistcount:int: Maximum number of categories to list
@attrib: _ShortList:bool: If set, the Perpage_Category_Short setting is used instead of Perpage_Category
@attrib: _FirstItemTemplate:tpl: Template used for the first category listed
@attrib: _LastItemTemplate:tpl: Template used for the last category listed
@attrib: _ItemTemplate:tpl: default template used for category list items
@attrib: _NoTable:bool: If set to 1, the categories will not be listed in a table. If a table is used, all HTML attributes are passed to the TABLE tag
@example: <inp:m_search_list_cats _NoTable="1" _ItemTemplate="category_search_results_element" />
*/
function m_search_list_cats($attribs = array())
{
global $var_list, $objConfig, $objSession, $objCatList, $var_list_update, $content_set,
$objSearchCats, $objPermissions, $m_var_list;
if(!is_object($objSearchCats))
{
$objSearchCats = new clsCatList();
$objSearchCats->SourceTable = $objSession->GetSessionTable('Search'); //"ses_".$objSession->GetSessionKey()."_Search"
$objSearchCats->Clear();
}
$objSearchCats->PerPageVar = "Perpage_Category";
if($attribs["_shortlist"])
{
$objSearchCats->Page=1;
$m_var_list["p"] = 1;
$objSearchCats->PerPageVar = "Perpage_Category_Short";
}
$keywords = $objSession->GetVariable("Search_Keywords"); // for using in all this func branches
if($objSearchCats->NumItems()==0)
{
LoadCatSearchResults($attribs);
//echo "Cat count: ". $objSearchCats->QueryItemCount;
$ret = 0;
if ($keywords) {
foreach ($objSearchCats->Items as $cat) {
if (strstr(strip_tags(strtolower($cat->Data['Name'])), strtolower($_POST['keywords'])) || strstr(strip_tags(strtolower($cat->Data['Description'])), strtolower($_POST['keywords']))) {
$ret++;
}
}
}
else {
$ret = $objSearchCats->QueryItemCount;
}
if ($ret == 0) //if ($objSearchCats->NumItems() == 0)
{
$content_set = 0;
return language("lu_no_categories");
}
}
$html_attr = ExtraAttributes($attribs);
$cols = $attribs["_columns"];
if($cols<1)
$cols =1;
$cat_count = (int)$attribs["_maxlistcount"];
/* validation */
if(strlen($attribs["_itemtemplate"])==0)
{
$content_set = 0;
return "ERROR -1";
}
$o="";
$notable = $attribs["_notable"];
$max_categories = $objConfig->Get($objSearchCats->PerPageVar);
$count=0;
$row=0;
$var_list_update["t"] = $var_list["t"];
if(!$notable)
{
$per_row = ceil($objCatList->NumItems()/$cols);
$o = "<TABLE $html_attr><TR CLASS=\"m_list_cats\">";
$o .= "<TD valign=\"top\">";
foreach($objSearchCats->Items as $cat)
{
$parsed=0;
if($count==$per_row)
{
$o .= "</TD><TD valign=\"top\">";
$count=0;
}
if($row==0 && strlen($attribs["_firstitemtemplate"]))
{
$o.= $cat->ParseTemplate($attribs["_firstitemtemplate"]);
$parsed=1;
}
if($row==$objSearchCats->NumItems()-1 && !$parsed && strlen($attribs["_lastitemtemplate"])>0)
{
$o .= $cat->ParseTemplate($attribs["_lastitemtemplate"]);
$parsed=1;
}
if(!$parsed)
$o.= $cat->ParseTemplate($attribs["_itemtemplate"]);
$count++;
}
if($count != $per_row)
$o .= "</TD>";
$o .= "\n</tr></table>\n";
}
else
{
//echo "<pre>"; print_r($objSearchCats->Items); echo "</pre>";
foreach($objSearchCats->Items as $cat)
{
//$cat->Keywords = GetKeywords($objSession->GetVariable("Search_Keywords"));
$keywords_found = strstr( strip_tags(strtolower($cat->Data['Name'])), strtolower($keywords)) || strstr(strip_tags(strtolower($cat->Data['Description'])), strtolower($keywords));
if(!$keywords) $keywords_found = true;
if ($keywords_found) {
if($row==0 && strlen($attribs["_firstitemtemplate"]))
{
$o.= $cat->ParseTemplate($attribs["_firstitemtemplate"]);
$parsed=1;
}
if($row==$objSearchCats->NumItems()-1 && !$parsed && strlen($attribs["_lastitemtemplate"])>0)
{
$o .= $cat->ParseTemplate($attribs["_lastitemtemplate"]);
$parsed=1;
}
if(!$parsed)
$o.= $cat->ParseTemplate($attribs["_itemtemplate"]);
$row++;
$i++;
$count++;
if($count == $max_categories) break;
}
}
}
unset($var_list_update["t"]);
return $o;
}
/*
@description: Parse a template based on the current advanced search type
@attrib:_TypeSelect:tpl:Template to parse if no item type has been selected
@attrib:_ItemSelect:tpl:Template to parse if an item type has been selected to search
*/
function m_advsearch_include($attribs)
{
global $objTemplate;
$TypeSelectTemplate = $attribs["_typeselect"];
$ItemTemplate = $attribs["_itemselect"];
if((strlen($_GET["type"])>0 || $_POST["itemtype"]>0) && ($_GET["Action"]=="m_advsearch_type" || $_GET["Action"]=="m_adv_search"))
{
$o = $objTemplate->ParseTemplate($ItemTemplate);
}
else
$o = $objTemplate->ParseTemplate($TypeSelectTemplate);
return $o;
}
/*
@description: Returns the name of the item type currently being advanced searched
@attrib::_plaintext:bool:If set, simply returns the name of the item if not, builds a language tag (lu_searchtitle_[name])
*/
function m_advsearch_type($attribs)
{
global $objItemTypes;
if($_GET["Action"]=="m_advsearch_type")
{
$ItemType = $_POST["itemtype"];
}
elseif($_GET["Action"]=="m_adv_search")
$ItemType = $_GET["type"];
$o = "";
if((int)$ItemType>0)
{
$Item = $objItemTypes->GetItem($ItemType);
if(is_object($Item))
{
$name = strtolower($Item->Get("ItemName"));
if($attribs["_plaintext"])
{
$o .= $name;
}
else
$o = language("lu_searchtitle_".strtolower($name));
}
}
return $o;
}
/*
@description: Lists advanced search fields for the selected item type
@attrib: _FirstItemTemplate:tpl: Template used for the first field listed
@attrib: _LastItemTemplate:tpl: Template used for the last field listed
@attrib: _AltLastItemTemplate:tpl: Altername Template used for the last field listed
@attrib: _ItemTemplate:tpl: default template used for field list items
@attrib: _AltTemplate:tpl: Alternate template used for field list items
*/
function m_advsearch_fields($attribs)
{
global $objItemTypes, $objTemplate, $objSearchConfig;
if(!is_object($objSearchConfig))
$objSearchConfig = new clsSearchConfigList();
if($_GET["Action"]=="m_advsearch_type")
{
$ItemType = $_POST["itemtype"];
}
elseif($_GET["Action"]=="m_adv_search")
$ItemType = $_GET["type"];
$o = "";
if((int)$ItemType>0)
{
$Item = $objItemTypes->GetItem($ItemType);
if(is_object($Item))
{
$name = strtolower($Item->Get("ItemName"));
$table = $Item->Get("SourceTable");
$sql = "SELECT * FROM ".$objSearchConfig->SourceTable." WHERE TableName='$table' AND AdvancedSearch=1 ORDER BY DisplayOrder";
$objSearchConfig->Query_Item($sql);
$row=0;
if(is_array($objSearchConfig->Items))
{
$ItemCount = count($objSearchConfig->Items);
foreach($objSearchConfig->Items as $s)
{
$even = (($row+1) % 2 == 0);
$parsed=0;
if($row==0 && strlen($attribs["_firstitemtemplate"]))
{
$o .= $s->ParseTemplate($attribs["_firstitemtemplate"]);
$parsed=1;
}
if($row==$ItemCount-1 && $even && !$parsed && strlen($attribs["_altlastitemtemplate"])>0)
{
$o .= $s->ParseTemplate($attribs["_altlastitemtemplate"]);
$parsed=1;
}
if($row==$ItemCount-1 && !$parsed && strlen($attribs["_lastitemtemplate"])>0)
{
$o .= $s->ParseTemplate($attribs["_lastitemtemplate"]);
$parsed=1;
}
if(!$parsed)
{
if($even && strlen($attribs["_altitemtemplate"])>0)
{
$o .= $s->ParseTemplate($attribs["_altitemtemplate"]);
}
else
$o .= $s->ParseTemplate($attribs["_itemtemplate"]);
}
$row++;
}
}
}
}
return $o;
}
/*
@description: create a link to a template based on attributes passed into the tag. All extra HTML attributes
are passed to the anchor tag created.
@attrib: _Template:tpl: Template to link to. Just the template name is listed here. (ex: use "index" instead if "inlink/index")
@attrib: _Module:: Module being linked to (ie In-Bulletin or In-News or In-Link)
@attrib: _perm:: A list of permissions to check. If the user has any of the the permissions in the list,
the link will be generated. (If the _DeniedTemplate attribute is set, this template is used
and the link is created.)
@attrib: _DeniedTemplate:tpl: This template is used if the user does not have a permission listed in the _perm
attribute. If this attirbute is not included and the user does not have access,
nothing is returned. (The link is not created.)
@attrib: _Root:bool: If set, the current category is set to the module's root category
@attrib: _text:lang: language tag to include as text for the anchor tag
@attrib: _plaintext:: plain text to include as text for the anchor tag. The _text attribute takes presedence
if both are included.
@attrib: _image:: URL to an image to include inside the anchor tag.
@attrib: _image_actions:: Image events.
*/
function m_module_link($attribs = array())
{
global $objCatList, $objSession;
$permission = $attribs["_perm"];
$o = "";
$tpath = GetModuleArray("template");
if(strlen($permission))
{
$perms = explode(",",$permission);
$hasperm = FALSE;
for($x=0;$x<count($perms);$x++)
{
if($objSession->HasCatPermission($perms[$x]))
{
$hasperm = TRUE;
break;
}
}
}
else
$hasperm = TRUE;
if(!$hasperm && strlen($attribs["_deniedtemplate"])>0)
{
$hasperm = TRUE;
$attribs["_template"]=$attribs["_deniedtemplate"];
}
if($hasperm)
{
$module = $attribs["_module"];
if(ModuleEnabled($module))
{
$t = $tpath[$attribs["_module"]];
$t .= $attribs["_template"];
$attribs["_template"] = $t;
$html_attr = ExtraAttributes($attribs);
if($attribs["_root"])
{
$func = ModuleTagPrefix($module)."_root_link";
if(function_exists($func))
{
$url = $func($attribs);
}
else
$url = m_template_link($attribs);
}
else
$url = m_template_link($attribs);
$o = "<A $html_attr HREF=\"";
$o .= $url;
$o .= "\"> ";
$text = $attribs["_text"];
if(!strlen($text))
{
$text = $attribs["_plaintext"];
if(!strlen($text))
{
if(strlen($attribs["_image"]))
{
$text = "<IMG SRC=\"".$attribs["_image"]."\" BORDER=\"0\">";
}
}
$o .= $text."</A>";
}
else
$o .= language($text)."</A>";
}
else
{
$o = "";
}
}
return $o;
}
/*
@description: create a link to a template based on attributes passed into the tag. All extra HTML attributes
are passed to the anchor tag created.
@attrib: _Template:tpl: Template to link to. Just the template name is listed here. (ex: use "index" instead if "inlink/index")
@attrib: _perm:: A list of permissions to check. If the user has any of the the permissions in the list,
the link will be generated. (If the _DeniedTemplate attribute is set, this template is used
and the link is created.)
@attrib: _DeniedTemplate:tpl: This template is used if the user does not have a permission listed in the _perm
attribute. If this attirbute is not included and the user does not have access,
nothing is returned. (The link is not created.)
@attrib: _text:lang: language tag to include as text for the anchor tag
@attrib: _plaintext:: plain text to include as text for the anchor tag. The _text attribute takes presedence
if both are included.
@attrib: _image:: URL to an image to include inside the anchor tag.
*/
function m_permission_link($attribs = array())
{
global $objCatList, $objSession;
$permission = $attribs["_perm"];
$o = "";
if(strlen($permission))
{
$perms = explode(",",$permission);
$hasperm = FALSE;
for($x=0;$x<count($perms);$x++)
{
if($objSession->HasCatPermission($perms[$x]))
{
$hasperm = TRUE;
break;
}
}
}
else
$hasperm = TRUE;
if(!$hasperm && strlen($attribs["_deniedtemplate"])>0)
{
$hasperm = TRUE;
$attribs["_template"]=$attribs["_deniedtemplate"];
}
if($hasperm)
{
$url = m_template_link($attribs);
$o = "<A $html_attr HREF=\"";
$o .= $url;
$o .= "\"> ";
$text = $attribs["_text"];
if(!strlen($text))
{
$text = $attribs["_plaintext"];
if(!strlen($text))
{
if(strlen($attribs["_image"]))
{
$text = "<IMG SRC=\"".$attribs["_image"]."\" BORDER=\"0\">";
}
}
$o .= $text."</A>";
}
else
$o .= language($text)."</A>";
}
else
{
$o = "";
}
return $o;
}
function m_confirm_password_link($attribs = array())
{
global $var_list, $var_list_update, $m_var_list_update, $objSession, $objConfig;
$template = "forgotpw_reset_result";
$user = $objSession->Get("tmp_user_id").";".$objSession->Get("tmp_email");
$query = "&user_key=".base64_encode($user)."&Action=m_resetpw";
$var_list["t"] = $template;
if($attribs["_secure"])
{
$ret = "https://".ThisDomain().$objConfig->Get("Site_Path")."index.php?env=".BuildEnv().$query;
}
else
{
$ret = "http://".ThisDomain().$objConfig->Get("Site_Path")."index.php?env=".BuildEnv().$query;
}
return $ret;
}
/*
@description: Create a link to a template.
@attrib: _Template:tpl: Template to link to (ex: "inbulletin/post_list")
@attrib: _Query:str: Extra query sring to be added to link URL (ex: "&test=test")
@attrib: _Category:int: Set the current category to this ID. If not set, the current category is unchanged
@attrib: _anchor:: If included, a local anchor (#) is added. (ex: _anchor="top" results in <A HREF="..#top">)
@attrib: _Root:bool:If set, gets module root category id
@attrib: _Module:str:Module Name
@attrib: _Relative:bool: Is set, creates an relative url url (../..address)
@example: <a href="<inp:m_template_link _Template="index" _Category=0 />"><inp:m_language _Phrase="lu_home" /></a>
*/
function m_template_link($attribs = array())
{
global $var_list, $var_list_update, $m_var_list_update, $objCatList;
$template = $attribs["_template"];
$query = trim($attribs["_query"]);
$query = !ereg("^&", $query)? "&$query" : $query;
if(!strlen($template))
$template = $var_list["t"];
$cat = $attribs["_category"];
$var_list_update["t"] = $template;
if(strlen($cat))
{
if($cat=="NULL")
{
$m_var_list_update["cat"]=0;
}
else
{
$m_var_list_update["cat"] = $cat;
}
}
$link_type = getArrayValue($attribs,'_relative') ? 0 : 2;
$ret = GetIndexURL($link_type)."?env=".BuildEnv().$query;
if(strlen($attribs["_anchor"]))
$ret .= "#".$attribs["_anchor"];
unset($var_list_update["t"]);
if(strlen($cat))
unset($m_var_list_update["cat"]);
return $ret;
}
/*
@description: create a link to a template based on user permissions. All extra HTML attributes are passed to the anchor tag created.
@attrib: _Template:tpl: Template to link to if the user has access
@attrib: _DeniedTemplate:tpl: This template is used if the user does not have a permission listed in the _perm
attribute. If this attirbute is not included and the user does not have access,
the "login" template is used.
@attrib: _perm:: A list of permissions to check. If the user has any of the the permissions in the list,
the link will be generated. (If the _DeniedTemplate attribute is set, this template is used
and the link is created.)
@attrib: _System:bool: Set this attribute if one of the permissions in the list is a system permission (ie: LOGIN)
@attrib: _Category:int: Set the current category to this ID. If not set, the current category is unchanged
@example: <a href="<inp:m_access_template_link _Template="my_account" _DeniedTemplate="login" _Perm="login" />"><inp:m_language _Phrase="lu_myaccount" /></A>
*/
function m_access_template_link($attribs = array(), $Permission="")
{
global $var_list, $var_list_update, $m_var_list_update, $objCatList, $objSession;
$cat = $attribs["_category"];
if(strlen($cat))
{
if($cat=="NULL")
$cat = 0;
}
else
$cat = $objCatList->CurrentCategoryID();
if(!strlen($Permission))
{
$Permission = strtoupper($attribs["_perm"]);
}
$o = "";
$hasperm = FALSE;
if(strlen($Permission))
{
$perms = explode(",",$Permission);
for($x=0;$x<count($perms);$x++)
{
if($objSession->HasCatPermission(trim($perms[$x]),$cat))
{
$hasperm = TRUE;
break;
}
}
if(!$hasperm && $attribs["_system"])
{
for($x=0;$x<count($perms);$x++)
{
if($objSession->HasSystemPermission(trim($perms[$x])))
{
$hasperm = TRUE;
break;
}
}
}
}
$access = $attribs["_template"];
$denied = $attribs["_deniedtemplate"];
if(!strlen($denied))
$denied = "login";
$m_var_list_update["cat"] = $cat;
if($hasperm)
{
$template = $access;
if(!strlen($template))
$template = $var_list["t"];
$var_list_update["t"] = $template;
}
else
{
$template = $denied;
if(!strlen($template))
$template = $var_list["t"];
if($template == "login")
{
$dest = $access;
}
$var_list_update["t"] = $template;
}
$ret = GetIndexURL(2)."?env=".BuildEnv();
unset($var_list_update["t"]);
if(strlen($dest))
$ret .= "&dest=$dest";
return $ret;
}
/*
@description: returns a text based on user permissions. Text from inside of the tag will be returned if text attributes are not specified and user has permissions to category, or if _NoPerm attribute set to 1 and user doesn't have permissions. Otherwise entire section will be excluded.
@attrib: _Text:lang: Template to link to if the user has access
@attrib: _PlainText:: This template is used if the user does not have a permission listed in the _perm attribute. If this attirbute is not included and the user does not have access, the "login" template is used.
@attrib: _DenyText:lang: Template to link to if the user has access
@attrib: _PlainDenyText:: This exact text is used if the user does not have a permission listed in the _perm attribute and _DenyText attribute is not set.
@attrib: _perm:: A list of permissions to check. If the user has any of the the permissions in the list, the link will be generated.
@attrib: _System:bool: Set this attribute if one of the permissions in the list is a system permission (ie: LOGIN)
@attrib: _Category:int: Set the current category to this ID. If not set, the current category is unchanged
@attrib: _MatchAllPerms:int: Checks for all listed Permissions to be TRUE. Note: this attribute is rarely used.
@attrib: _NoPerm:int: The whole tag will return inner text if user has no permissions and attribute set to 1. Default value is 0.
@example: <inp:m_perm_text _Text="!lu_allow_language_tag!" _PlainText="Just a text" _DenyText="!lu_deny_language_tag!" _PlainDenyText="Just a plain text" _Perm="login" _MatchAllPerms="1" _NoPerm="0">Some HTML here!</inp>
*/
function m_perm_text($attribs = array())
{
global $var_list, $var_list_update, $m_var_list_update, $objCatList, $objSession;
$cat = $attribs["_category"];
if(strlen($cat))
{
if($cat=="NULL")
$cat = 0;
}
else
$cat = $objCatList->CurrentCategoryID();
if(!strlen($Permission))
{
$Permission = strtoupper($attribs["_perm"]);
}
$o = "";
$hasperm = FALSE;
$count = 0;
if(strlen($Permission))
{
$perms = explode(",",$Permission);
for($x=0;$x<count($perms);$x++)
{
$_AllPermsCount[$count] = 0;
if($objSession->HasCatPermission($perms[$x],$cat))
{
$hasperm = TRUE;
$_AllPermsCount[$count] = 1;
// break;
}
$count++;
}
if(!$hasperm && $attribs["_system"])
{
for($x=0; $x<count($perms); $x++)
{
$_AllPermsCount[$count] = 0;
if($objSession->HasSystemPermission($perms[$x]))
{
$hasperm = TRUE;
$_AllPermsCount[$count] = 1;
// break;
}
$count++;
}
}
}
if ((int)$attribs["_matchallperms"])
{
if (count($_AllPermsCount) != array_sum($_AllPermsCount))
$hasperm = FALSE;
}
$text = $attribs["_text"];
$plaintext = $attribs["_plaintext"];
$denytext = $attribs["_denytext"];
$plaindenytext = $attribs["_plaindenytext"];
$nopermissions_status = (int)$attribs["_noperm"]? 1 : 0;
if(!strlen($denied))
$denied = "login";
if (!$nopermissions_status)
{
if ($hasperm)
{
if (strlen($text) || strlen($plaintext))
$ret = strlen($text)? language($text) : $plaintext;
else
$ret = "1";
}
else
$ret = strlen($denytext)? language($denytext) : $plaindenytext;
}
elseif (!$hasperm)
{
$ret = "1";
}
return $ret;
}
/*
@description: Returns the error string associated with a permission
*/
function m_permission_error($attribs = array())
{
global $objPermissions;
$ret = "";
$perm = strtoupper($_GET["error"]);
if(strlen($perm))
{
$ado = &GetADODBConnection();
$sql = "SELECT * FROM ".GetTablePrefix()."PermissionConfig WHERE PermissionName ='$perm'";
$rs = $ado->Execute($sql);
if($rs && !$rs->EOF)
{
$data = $rs->fields;
$error_tag = $data["ErrorMessage"];
}
else
$error_tag = "lu_unknown_error";
$ret = language($error_tag);
}
return $ret;
}
/*
@description: Returns the error text encountered when parsing templates
*/
function m_template_error($attribs = array())
{
global $objTemplate;
$ret = "";
if($objTemplate->ErrorNo<0)
{
$ret = $objTemplate->ErrorStr;
}
return $ret;
}
/*
@description: Creates a category navigation bar
@attrib: _Template:tpl: template to use for navigation links
@attrib: _RootTemplate:bool: If set, this template is linked to for the root category
@attrib: _LinkCurrent:bool: If set, the last (current) category is linked. Otherwise the current category is simply displayed
@attrib: _Separator:: text to display between levels of the navigation bar
@attrib: _Root:: Root category configuration variable to use. (ex: Link for In-Link's root category) If not set, the system root is used
@example: <inp:m_navbar _RootTemplate="index" _Template="inbulletin/index" _LinkCurrent="1" _separator=" &gt; " />
*/
function m_navbar($attribs = array())
{
global $m_var_list_update, $var_list, $objCatList, $objConfig, $objModules;
$separator = getArrayValue($attribs, '_separator');
if(!$separator) $separator = "<span class=\"NAV_ARROW\"> > </span>";
$admin = (int)getArrayValue($attribs, 'admin');
$t = getArrayValue($attribs, '_template');
$LinkLeafNode = getArrayValue($attribs, '_linkcurrent');
$catid = (int)getArrayValue($attribs, '_catid');
if( getArrayValue($attribs, '_root') )
{
$var = getArrayValue($attribs, '_root')."_Root";
$Root = (int)$objConfig->Get($var);
}
else
$Root = 0;
$RootTemplate = getArrayValue($attribs, '_roottemplate');
if($RootTemplate === false) $RootTemplate = '';
$Module = getArrayValue($attribs, '_module');
$ModuleRootTemplate = '';
if($Module)
{
$ModuleRootCat = $objModules->GetModuleRoot($Module);
if($ModuleRootCat>0)
{
$modkey = "_moduleroottemplate";
$ModuleRootTemplate = getArrayValue($attribs, $modkey);
}
else
$ModuleRootTemplate="";
}
else
$ModuleRootCat = 0;
if(!$catid)
$catid = $objCatList->CurrentCategoryID();
$ret = $objCatList->cat_navbar($admin, $catid, $t, $separator,$LinkLeafNode,$Root,$RootTemplate,$ModuleRootCat,$ModuleRootTemplate);
return $ret;
}
/*
@description: Parse a category field and return the value
@attrib: _Field:: Category field to parse
@attrib: _CatId:int: Category ID to parse (uses current category if not set)
@attrib: _StripHTML:bool: if set, all HTML is removed from the output
*/
function m_category_field($attribs)
{
global $objCatList;
$ret = "";
$catid = (int)$attribs["_catid"];
$field = $attribs["_field"];
if(!$catid)
$catid = $objCatList->CurrentCategoryID();
if(strlen($field))
{
$cat =& $objCatList->GetCategory($catid);
if(is_object($cat))
{
$element = new clsHtmlTag();
$element->name=$cat->TagPrefix;
$element->attributes = $attribs;
$ret = $cat->ParseObject($element);
}
}
if($attribs["_striphtml"])
$ret = strip_tags($ret);
return $ret;
}
/*
@description: returns the date of the last modification to a category
@attrib: _Part:: part of the date to display
@attrib: _Local:bool: If set, only subcategories of the current category is checked
@example: <inp:m_category_modified />
*/
function m_category_modified($attribs)
{
global $objConfig, $objCatList;
$ado = &GetADODBConnection();
if($attribs["_local"] && $objCatList->CurrentCategoryID() != 0)
{
$c =& $objCatList->GetItem($objCatList->CurrentCategoryID());
$catlist = $c->GetSubCatIds();
$catwhere = "CategoryId IN (".explode(",",$catlist).")";
$sql = "SELECT MAX(Modified) as ModDate,MAX(CreatedOn) as NewDate FROM ".GetTablePrefix()."Category ";
$sql .= "INNER JOIN ".GetTablePrefix()."CategoryItems ON (".GetTablePrefix()."Category.ResourceId=".GetTablePrefix()."CategoryItems.ItemResourceId) ";
$sql .= "WHERE $catwhere LIMIT 1";
}
else
$sql = "SELECT MAX(Modified) as ModDate FROM ".GetTablePrefix()."Category LIMIT 1";
$rs = $ado->Execute($sql);
if($rs && ! $rs->EOF)
{
$mod = $rs->fields["ModDate"];
if($mod)
{
$part = strtolower($attribs["_part"]);
if(strlen($part))
{
$ret = ExtractDatePart($part,$mod);
}
else
{
$ret = LangDate($mod);
}
}
}
return $ret;
}
/*
@description: creates LINK tags to include all module style sheets
@attrib: _Modules:: Accepts a comma-separated list of modules to include (ie: "In-Link, In-News, In-Bulletin")
@attrib: _*css:none: Each module may set a custom-named stylesheet. For example, for In-Link the attribute would be _In-Linkcss="..".
If a module does not have a *css attribute, the default (style.css) is assumed.
@example: <inp:m_module_stylesheets _Modules="In-Portal,In-News,In-Bulletin,In-Link" _In-PortalCss="incs/inportal_main.css" />
*/
function m_module_stylesheets($attribs)
{
global $TemplateRoot;
$IncludeList = explode(",",trim($attribs["_modules"]));
$tpath = GetModuleArray("template");
for($inc=0;$inc<count($IncludeList);$inc++)
{
$css_attr = "_".strtolower($IncludeList[$inc])."css";
if(strlen($attribs[$css_attr]))
{
$mod_css = $tpath[$IncludeList[$inc]].$attribs[$css_attr];
}
else
$mod_css = $tpath[$IncludeList[$inc]]."style.css";
$file = $TemplateRoot.$mod_css;
if(file_exists($file))
$ret .= "<link rel=\"stylesheet\" href=\"$mod_css\" type=\"text/css\" />\n";
}
return $ret;
}
/*
@description: lists items related to a category
@attrib:CatId:int: Category ID of category, or current category if not set
@attrib:_ListItem: Comma-separated list of item types (ie: Link, Topic, Category, News) The items are listed in the order this list provides, then by priority.
Each item should have its own template passed in as an attribute (_{ItemType}Template)
*/
function m_related_items($attribs)
{
global $objItemTypes, $objCatList, $content_set;
static $Related;
global $CatRelations;
$cat = $attribs["_catid"];
if(!is_numeric($cat))
{
$cat = $objCatList->CurrentCategoryID();
}
$c =& $objCatList->GetCategory($cat);
$data_sent=0;
if(is_object($c))
{
$ResourceId = $c->Get("ResourceId");
$IncludeList = explode(",",trim(strtolower($attribs["_listitems"])));
$o = "";
if(!is_object($CatRelations))
{
$CatRelations = new clsMultiTypeList();
LoadRelatedItems($Related, $CatRelations,$c->Get("ResourceId"));
}
if($CatRelations->NumItems()>0)
{
for($inc=0;$inc<count($IncludeList);$inc++)
{
$t_attr = "_".$IncludeList[$inc]."template";
$t = $attribs[$t_attr];
$item_type = $IncludeList[$inc];
if(strlen($item_type))
{
$objType = $objItemTypes->GetTypeByName($item_type);
if(is_object($objType))
{
foreach($CatRelations->Items as $item)
{
if(is_object($item))
{
if(strtolower($objType->Get("ItemName")) == strtolower($item_type) && $item->type==$objType->Get("ItemType"))
{
if(strlen($item->BasePermissionName))
{
$perm = $item->BasePermissionName.".VIEW";
$haspem = $objSession->HasCatPermission($perm,$item->Get("CategoryId"));
}
else
$hasperm = 1;
if($hasperm)
{
$data_sent =1;
$classname = $objType->Get("ClassName");
if(strlen($classname))
{
$l = new $classname;
$l->Data = $item->Data;
$o .= $l->ParseTemplate($t);
}
}
}
}
$item = NULL;
}
}
else
echo $item_type." not found <br>\n";
}
}
if($data_sent)
{
return $o;
}
else
{
$content_set=0;
return "";
}
}
else
{
$content_set = 0;
return "";
}
}
else
{
$content_set = 0;
return "";
}
}
/*
@description: Returns the number of items related to the current category
@attrib:_CatId:int: If set, this is the category ID to use, otherwise the current category is used
@attrib:_ItemType::Name of item to count. If not set, all related items are counted
*/
function m_related_count($attribs)
{
global $objItemTypes, $objCatList, $content_set;
$cat = $attribs["_catid"];
if(!is_numeric($cat))
{
$cat = $objCatList->CurrentCategoryID();
}
$c =& $objCatList->GetCategory($cat);
$data_sent=0;
//echo "Category: $cat<pre>"; print_r($c); echo " </pre>";
if(is_object($c))
{
$ResourceId = $c->Get("ResourceId");
if(!is_object($CatRelations))
{
$CatRelations = new clsMultiTypeList();
LoadRelatedItems($Related, $CatRelations, $c->Get("ResourceId"));
}
$item_type = $attribs["_itemtype"];
if(strlen($item_type))
{
$objType = $objItemTypes->GetTypeByName($item_type);
if(is_object($objType))
{
$TargetType = $objType->Get("ItemType");
}
else
$TargetType="";
}
if($CatRelations->NumItems()>0)
{
for($x=0;$x<$CatRelations->NumItems();$x++)
{
$a = $CatRelations->GetItemByIndex($x);
if($a->type == $TargetType || !strlen($TargetType))
{
$count++;
}
}
}
}
return $count;
}
/*
@description: Returns the MetaKeywords field for a category, or the system MetaKeywords value
if the category doesn't have a value for MetaKeywords
@attrib: _CatId:int: Category to use (The current category is used by default)
*/
function m_meta_keywords($attribs = array())
{
global $objCatList, $objConfig;
$catid = (int)$attribs["_catid"];
if(!$catid)
{
$catid = $objCatList->CurrentCategoryID();
}
if($catid)
{
$c = $objCatList->GetItem($catid);
$keywords = $c->Get("MetaKeywords");
}
if(!strlen($keywords))
{
$keywords = $objConfig->Get("MetaKeywords");
}
return $keywords;
}
/*
@description: Returns the MetaDescription field for a category, or the system MetaDescription value
if the category doesn't have a value for MetaDescription
@attrib: _CatId:int: Category to use (The current category is used by default)
*/
function m_meta_description($attribs = array())
{
global $objCatList, $objConfig;
$catid = (int)$attribs["_catid"];
if(!$catid)
{
$catid = $objCatList->CurrentCategoryID();
}
if($catid)
{
$c = $objCatList->GetItem($catid);
$desc = $c->Get("MetaDescription");
}
if(!strlen($desc))
{
$desc = $objConfig->Get("MetaDescription");
}
return $desc;
}
/*
@description: return the number of items in the database
@attrib: _ItemType:: Name of item to count
@attrib: _ListType:: Type of item to count (ie: favorites, editor's pick, etc)
@attrib: _CategoryCount:int: Limit scope to the current category
@attrib: _SubCats:bool: Count items in all subcategories (_CategoryCount must be set)
@attrib: _Today:bool: Count items added today
@attrib: _GroupOnly:bool: Only count items the current user can view
@attrib: _NoCache:bool: Count without using cache
*/
function m_itemcount($attribs = array())
{
global $objItemTypes, $objCatList, $objSession, $objCountCache;
$Bit_None = 0;
$Bit_Today = 1;
$Bit_Owner = 2;
$Bit_Global = 4;
$Bit_SubCats=8;
if($attribs["_categorycount"])
{
$evar = m_BuildEnv();
}
else
$evar = "";
$cat = $attribs["_catid"];
if(!is_numeric($cat))
{
$cat = $objCatList->CurrentCategoryID();
}
if((int)$cat>0)
$c = $objCatList->GetCategory($cat);
if(is_numeric($attribs["_itemtype"]))
{
$item = $objItemTypes->GetItem($attribs["_itemtype"]);
}
else
$item = $objItemTypes->GetTypeByName($attribs["_itemtype"]);
$DoUpdate=0;
//echo "<pre>"; print_r($item); echo "</pre>";
$ExtraId="";
if(is_object($item))
{
if($item->Get("ItemType")==1) /* counting categories */
{
$ret = $objCatList->CountCategories($attribs);
}
else
{
$ListVar =& GetItemCollection($attribs["_itemtype"]);
if(is_object($ListVar))
{
$ret = $ListVar->PerformItemCount($attribs);
}
}
}
else
$ret = 0;
return !$ret ? 0 : $ret;
}
/*
@description: Parse a User field and return the value
@attrib: _Field:: User field to parse
@attrib: _UserId:int: Category ID to parse (uses current user if not set)
*/
function m_user_field($attribs)
{
global $objUsers, $objSession;
$o = "";
$userid = $attribs["_userid"];
if(!is_numeric($userid) || $userid=="0")
$userid = $objSession->Get("PortalUserId");
if($userid)
{
$u =& $objUsers->GetItem($userid);
if(is_object($u))
{
$element = new clsHtmlTag();
$element->name = $u->TagPrefix;
$element->attributes = $attribs;
$o = $u->ParseObject($element);
}
}
return $o;
}
/*
@description: Parses a user template
@attrib:_Template:tpl: Template to parse
@attrib:_UserId:int: User ID to parse. If not set, the current user is used
*/
function m_user_detail($attribs = array())
{
global $objTemplate, $objUsers, $objSession;
$tname = $attribs["_template"];
$UserId = (int)$attribs["_userid"];
if(!$UserId)
{
$UserId=$objSession->Get("PortalUserId");
}
if($UserId>0)
{
$u = $objUsers->GetUser($UserId);
$o = $u->ParseTemplate($tname);
}
else
{
$u = new clsPortalUser(NULL);
$o = $u->ParseTemplate($tname);
}
return $o;
}
/*
@description: returns a user field from the current profile being viewed
@example:<inp:m_user_profile_field _Field="login" />
*/
function m_user_profile_field($attribs = array())
{
if((int)$_GET["UserId"])
{
$attribs["_userid"] = $_GET["UserId"];
}
$ret = m_user_field($attribs);
/* if ($ret == '') {
$ret = admin_language("lu_Guest");
}*/
return $ret;
}
/*
@description: Parses a user profile template
@attrib:_Template:tpl: Template to parse
@attrib:_UserId:int: User ID to parse. If not set, the current user is used
*/
function m_user_profile_detail($attribs)
{
if((int)$_GET["UserId"])
{
$attribs["_userid"] = $_GET["UserId"];
}
$ret = m_user_detail($attribs);
return $ret;
}
/*
@description: Lists all user profile fields the user has indicated to be public
@attrib: _ItemTemplate:tpl: Template used to list each field
@example:<inp:m_user_profile _ItemTemplate="view_profile_field" />
*/
function m_user_profile($attribs = array())
{
global $objTemplate, $objUsers;
$tname = $attribs["_itemtemplate"];
$t = $objTemplate->GetTemplate($tname);
if(is_object($t))
{
$html = $t->source;
}
$userid = $_GET["UserId"];
$o = "";
if((int)$userid>0)
{
$u = $objUsers->GetItem($userid);
$vars = $u->GetAllPersistantVars();
foreach($vars as $field=>$value)
{
if(substr($field,0,3)=="pp_")
{
if($value==1)
{
$src = $html;
$src = str_replace("<inp:user_profile_field />","<inp:user _field=\"".substr($field,3)."\" />",$src);
$src = str_replace("lu_profile_field","lu_".$field,$src);
$o .= $u->ParseTemplateText($src);
}
}
}
}
return $o;
}
/*
@description: List users the current user has marked as 'friend'
@attrib: _Status:: Determines which online status to list, either "online" or "offline".
@attrib: _ItemTemplate:tpl: Template used to parse list items
*/
function m_list_friends($attribs = array())
{
global $objUsers, $objSession;
global $online_friends;
$ado = &GetADODBConnection();
$status = strtolower($attribs["_status"]);
$logedin_user = $objSession->Get("PortalUserId");
$u =& $objUsers->GetUser($logedin_user);
//echo "<pre>"; print_r($u); echo "</pre>";
if(!isset($online_friends) || $status=="online")
{
$ftable = GetTablePrefix()."Favorites";
$stable = GetTablePrefix()."UserSession";
$ptable = GetTablePrefix()."PortalUser";
if(isset($online_friends))
{
foreach($online_friends as $id=>$name)
{
$u =& $objUsers->GetUser($id);
$o .= $u->ParseTemplate($attribs["_itemtemplate"]);
}
}
else
{
$sql = "SELECT $ftable.ResourceId,$ftable.ItemTypeId, $ptable.PortalUserId,$stable.PortalUserId FROM $ftable ";
$sql .="INNER JOIN $ptable ON ($ftable.ResourceId=$ptable.ResourceId) INNER JOIN $stable ON ";
$sql .= "($ptable.PortalUserId=$stable.PortalUserId) WHERE ItemTypeId=6 AND $ftable.PortalUserId = ".$logedin_user; //$u->Data['ResourceId'];
//echo $sql;
$rs = $ado->Execute($sql);
while($rs && ! $rs->EOF)
{
$u =& $objUsers->GetItem($rs->fields["PortalUserId"]);
if($status=="online")
{
$o .= $u->ParseTemplate($attribs["_itemtemplate"]);
}
$online_friends[]=$rs->fields["PortalUserId"];
if(ADODB_EXTENSION>0)
{
adodb_movenext($rs);
}
else
$rs->MoveNext();
}
}
}
if($status=="offline")
{
$ftable = GetTablePrefix()."Favorites";
$stable = GetTablePrefix()."UserSession";
$ptable = GetTablePrefix()."PortalUser";
$sessql = "SELECT DISTINCT(PortalUserId) FROM $stable";
if(count($online_friends)>0)
{
$sql = "SELECT $ftable.ResourceId,$ftable.ItemTypeId, $ptable.PortalUserId FROM $ftable ";
$sql .="INNER JOIN $ptable ON ($ftable.ResourceId=$ptable.ResourceId) WHERE ItemTypeId=6 AND ";
$sql .= " $ptable.PortalUserId NOT IN (".implode(",",$online_friends).") AND $ftable.PortalUserId = ".$logedin_user; //$u->Data['ResourceId'];
}
else
{
$sql = "SELECT $ftable.ResourceId,$ftable.ItemTypeId, $ptable.PortalUserId FROM $ftable ";
$sql .="INNER JOIN $ptable ON ($ftable.ResourceId=$ptable.ResourceId) WHERE ItemTypeId=6 AND $ftable.PortalUserId = ".$logedin_user; //$u->Data['ResourceId'];
}
//echo $sql;
$rs = $ado->Execute($sql);
while($rs && ! $rs->EOF)
{
$u = $objUsers->GetItem($rs->fields["PortalUserId"]);
$o .= $u->ParseTemplate($attribs["_itemtemplate"]);
if(ADODB_EXTENSION>0)
{
adodb_movenext($rs);
}
else
$rs->MoveNext();
}
}
$t = $attribs["_itemtemplate"];
return $o;
}
/*
@description: Returns the number of users the current user has marked as 'friend'
@attrib: _Status:: Determines which online status to count, either "online" or "offline".
*/
function m_friend_count($attribs=array())
{
global $objUsers, $objSession;
global $online_friends;
$ado = &GetADODBConnection();
$logedin_user = $objSession->Get("PortalUserId");
$u =& $objUsers->GetUser($logedin_user);
$status = strtolower($attribs["_status"]);
if(!isset($online_friends) || $status=="online")
{
$ftable = GetTablePrefix()."Favorites";
$stable = GetTablePrefix()."UserSession";
$ptable = GetTablePrefix()."PortalUser";
if(isset($online_friends) && $status="online")
{
return count($online_friends);
}
else
{
$online_friends = array();
$sql = "SELECT $ftable.ResourceId,$ftable.ItemTypeId, $ptable.PortalUserId,$stable.PortalUserId FROM $ftable ";
$sql .="INNER JOIN $ptable ON ($ftable.ResourceId=$ptable.ResourceId) INNER JOIN $stable ON ";
$sql .= "($ptable.PortalUserId=$stable.PortalUserId) WHERE ItemTypeId=6 AND $ftable.PortalUserId = ".$logedin_user; //$u->Data['ResourceId'];
//echo $sql."<br>\n";
$rs = $ado->Execute($sql);
while($rs && ! $rs->EOF)
{
$online_friends[$rs->fields["PortalUserId"]]=$rs->fields["PortalUserId"];
if(ADODB_EXTENSION>0)
{
adodb_movenext($rs);
}
else
$rs->MoveNext();
}
if($status=="online")
return count($online_friends);
}
}
if($status=="offline")
{
$ftable = GetTablePrefix()."Favorites";
$stable = GetTablePrefix()."UserSession";
$ptable = GetTablePrefix()."PortalUser";
$sessql = "SELECT DISTINCT(PortalUserId) FROM $stable";
if(count($online_friends)>0)
{
$sql = "SELECT count($ftable.ResourceId) as ItemCount FROM $ftable ";
$sql .="INNER JOIN $ptable ON ($ftable.ResourceId=$ptable.ResourceId) WHERE ItemTypeId=6 AND ";
$sql .= " $ptable.PortalUserId NOT IN (".implode(",",$online_friends).") AND $ftable.PortalUserId = ".$logedin_user; //$u->Data['ResourceId'];
}
else
{
$sql = "SELECT count($ftable.ResourceId) as ItemCount FROM $ftable ";
$sql .="INNER JOIN $ptable ON ($ftable.ResourceId=$ptable.ResourceId) WHERE ItemTypeId=6 AND $ftable.PortalUserId = ".$logedin_user; //$u->Data['ResourceId'];
}
$rs = $ado->Execute($sql);
return $rs->fields["ItemCount"];
}
}
/*
@description: Returns the number of users the current user has marked as 'friend' today
*/
function m_friend_count_today($attribs)
{
global $objSession;
$logedin_user = $objSession->Get("PortalUserId");
$ret =0;
$ado = &GetADODBConnection();
$today = mktime(0,0,0,date("m"),date("d"),date("Y"));
$sql = "SELECT count(*) as c FROM ".GetTablePrefix()."Favorites WHERE ItemTypeId=6 and PortalUserId=".$objSession->Get("PortalUserId")." AND Modified>$today";
$rs = $ado->Execute($sql);
if($rs && !$rs->EOF)
$ret = $rs->fields["c"];
return $ret;
}
/*
@description: Returns the number of items in a search result
@Example: <span>(<inp:m_search_item_count _ItemType="Topic" />)</span>
*/
function m_search_item_count($attribs)
{
global $objItemTypes, $objCatList, $objSession, $CountVal;
if(!is_array($CountVal))
$CountVal=array();
$item = $objItemTypes->GetTypeByName($attribs["_itemtype"]);
if(is_object($item))
{
$val = $CountVal[$item->Get("ItemType")];
if(is_numeric($val))
return $val;
$where = "ItemType=".$item->Get("ItemType");
$table = $objSession->GetSearchTable();
$ret = TableCount($table,$where,0);
$CountVal[$item->Get("ItemType")]=(int)$ret;
}
return $ret;
}
/*
@description: Returns the number of categories in a search result
@Example: <span>(<inp:m_search_cat_count />)</span>
*/
function m_search_cat_count($attribs = array())
{
global $objItemTypes, $objCatList, $objSession, $CountVal, $objSearchCats;
if(!is_object($objSearchCats))
{
$objSearchCats = new clsCatList();
$objSearchCats->SourceTable = $objSession->GetSearchTable();
$objSearchCats->Clear();
}
LoadCatSearchResults($attribs);
//echo "<pre>"; print_r($objSearchCats->Items); echo "</pre>";
$ret = 0;
$keywords = $objSession->GetVariable("Search_Keywords");
/*if ($keywords) {
foreach ($objSearchCats->Items as $cat) {
if (strstr(strip_tags(strtolower($cat->Data['Name'])), strtolower($keywords)) || strstr(strip_tags(strtolower($cat->Data['Description'])), strtolower($keywords))) {
$ret++;
}
}
}*/
//else {
$ret = $objSearchCats->QueryItemCount;
//}
if ($ret == '') {
$ret = 0;
}
//echo $ret;
//$objSearchCats->QueryItemCount = $ret;
return $ret;
}
/*
@description: Returns super global variable by type and name
@attrib: _Name:: Name of variable
@attrib: _Type:: Type super global variable <br>Possible Values:
<UL>
<LI>get: $_GET super variable
<LI>post: $_POST super variable
<LI>cookie: $_COOKIE super variable
<LI>env: $_ENV super variable
<LI>server: $_SERVER super variable
<LI>session: $_SESSION super variable
</UL>
@Example: <inp:m_get_var _name="url" _type="get" />
*/
function m_get_var($attribs = array())
{
global $_GET, $_POST, $_COOKIE, $_FILES, $_ENV, $_SERVER, $_SESSION;
$type = strtolower($attribs['_type']);
$name = $attribs['_name'];
switch ($type)
{
case "get":
$vars = $_GET;
break;
case "cookie":
$vars = $_COOKIE;
break;
case "files":
$vars = $_FILES;
break;
case "server":
$vars = $_SERVER;
break;
case "session":
$vars = $_SESSION;
break;
case "env":
$vars = $_ENV;
break;
case "post":
$vars = $_POST;
break;
default :
$vars = $_POST;
break;
}
$ret = $vars[$name];
return $ret;
}
/*
@description: Returns number of users currently on-line
@attrib: _LastActive:: Last user/session activity in seconds
@attrib: _OwnCount:bool: Count user's own session
*/
function m_users_online($attribs = array())
{
global $objSession;
$LastActive = (int)($attribs['_lastactive']);
$OwnCount = (int)($attribs['_owncount']);
if ($LastActive && !is_null($LastActive))
$sql_add = " AND LastAccessed>".(time()-$LastActive);
if (!$OwnCount || is_null($OwnCount))
$sql_add.= " AND SessionKey!='".$objSession->GetSessionKey()."'";
$ado = &GetADODBConnection();
$sql = "SELECT COUNT(*) AS Counter FROM ".GetTablePrefix()."UserSession WHERE Status=1".$sql_add;
$rs = $ado->Execute($sql);
$ret = ($rs && !$rs->EOF)? $rs->fields["Counter"] : 0;
return $ret;
}
function m_debug_mode($attribs = array())
{
$const_name = $attribs['_debugconst'];
return defined($const_name) && (constant($const_name) == 1) ? 'yes' : '';
}
function m_info($attribs = array())
{
switch ($attribs['_infotype'])
{
case 'site':
global $objConfig;
$ret = ThisDomain().$objConfig->Get('Site_Path');
break;
default:
$ret = '';
break;
}
return $ret;
}
function m_module_enabled($attribs = array())
{
global $objModules;
$module = $attribs['_module'];
// check if module is installed
$ModuleItem = $objModules->GetItemByField('Name', $module);
if( !is_object($ModuleItem) ) return '';
// module is enabled
$ret = $ModuleItem->Get('Loaded') == 1;
// check if installed module is licensed
return $ret ? 'yes' : '';
}
function m_recall($attribs = array())
{
global $objSession;
return $objSession->GetVariable($attribs['_name']);
}
+function m_regional_option($attribs = array())
+{
+ return GetRegionalOption($attribs['_name']);
+}
+
?>
Property changes on: trunk/kernel/parser.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.31
\ No newline at end of property
+1.32
\ No newline at end of property
Index: trunk/kernel/action.php
===================================================================
--- trunk/kernel/action.php (revision 897)
+++ trunk/kernel/action.php (revision 898)
@@ -1,2471 +1,2472 @@
<?php
$ro_perm = $objSession->HasSystemPermission("SYSTEM_ACCESS.READONLY");
// ====== Debugger related: begin ======
$script = basename($_SERVER['PATH_TRANSLATED']);
$skipDebug = Array('index.php','tree.php','head.php','credits.php');
if( admin_login() && !in_array($script, $skipDebug) )
{
if( IsDebugMode() )
{
if($Action) $debugger->setHTMLByIndex(1,'Kernel Action: <b>'.$Action.'</b>','append');
echo '<a href="javascript:self.location.reload();">Reload Frame</a> || ';
echo '<a href="javascript:toggleDebugLayer();">Show Debugger</a><br>';
}
}
unset($script, $skipDebug);
// ====== Debugger related: end ======
switch($Action)
{
case "m_save_import_config":
// Set New Import Category
if( GetVar('categorylist', true) !== false )
{
$cat_id = $_POST['categorylist'];
$objSession->SetVariable('categoryid', $cat_id);
if($cat_id > 0)
{
$cat = $objCatList->GetByResource($cat_id);
if(is_object($cat))
{
$navbar = $cat->Get('CachedNavbar');
$objSession->SetVariable('catnavbar', $navbar);
$objSession->SetVariable('import_category_id', $cat->UniqueId() );
}
}elseif($cat_id == 0)
{
global $objConfig;
$objSession->SetVariable('import_category_id', 0);
}
$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 = DateTimestamp($_POST["user_date"],GetDateFormat());
$CreatedOn += SecondsSinceMidnight($_POST["user_time"]);
$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 += SecondsSinceMidnight($_POST["user_time"]);
$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":
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($ro_perm) break;
if($_POST["GroupEditStatus"]==0)
{
$objSession->ResetSysPermCache();
$GroupId = $_POST["GroupId"];
if($GroupId)
{
$objEditItems = new clsGroupList();
$objEditItems->SourceTable = $objSession->GetEditTable("PortalGroup");
$g = $objEditItems->GetItemByField("ResourceId",$GroupId);
if(is_object($g))
{
$PermList = explode(",",$_POST["PermList"]);
for($i=0;$i<count($PermList);$i++)
{
if(@in_array($PermList[$i],$_POST["inherit"]))
{
$value = -1;
}
else
{
$value = 0;
if(@in_array($PermList[$i],$_POST["permvalue"]))
$value = 1;
}
$g->SetSystemPermission($PermList[$i],$value);
}
}
}
}
break;
case "m_user_sysperm":
if($ro_perm) break;
if($_POST["UserEditStatus"]==0)
{
$UserId = $_POST["ItemId"];
if($UserId)
{
$objEditItems = new clsUserManager();
$objEditItems->SourceTable = $objSession->GetEditTable("PortalUser");
$u = $objEditItems->GetItemByField("ResourceId",$UserId);
unset($g);
if(is_object($u))
{
$objSession->ResetSysPermCache();
$g = $u->GetPersonalGroup(FALSE);
$PermList = explode(",",$_POST["PermList"]);
for($i=0;$i<count($PermList);$i++)
{
if(!@in_array($PermList[$i],$_POST["inherit"]))
{
if(!is_object($g))
$g = $u->GetPersonalGroup(TRUE);
$value = 0;
if(is_array($_POST["permvalue"]))
{
if(in_array($PermList[$i],$_POST["permvalue"]))
$value =1;
$g->SetSystemPermission($PermList[$i],$value);
}
else {
$g->SetSystemPermission($PermList[$i], 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": // not sure if action is used anywhere
if($ro_perm) break;
$useridlist = implode("-", $userlist);
$objSession->SetUserStatus($useridlist, "g_usergroup_status");
$g_usergroup_status = $useridlist;
break;
case "m_group_assign": // not sure if action is used anywhere
if($ro_perm) break;
foreach($grouplist as $group) $objGroups->Add_Users_To_Group($group);
break;
case "m_remove_group":
if($ro_perm) break;
$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":
if($ro_perm) break;
$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;
$objSession->SetVariable("HasChanges", 1);
$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;
$objSession->SetVariable("HasChanges", 1);
$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;
$objSession->SetVariable("HasChanges", 1);
$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;
$objSession->SetVariable("HasChanges", 1);
$user = $_POST["UserId"];
//if($user>0)
//{
foreach($_POST["itemlist"] as $groupid)
{
$g = $objGroups->GetItem($groupid);
$g->DeleteUser($user);
}
//}
break;
case "m_sendmail":
if($ro_perm) break;
$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":
if($ro_perm) break;
RunDown($m_var_list["cat"],"UpdateCacheCounts");
break;
case "m_cat_delete":
if($ro_perm) break;
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($ro_perm) break;
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($ro_perm) break;
if(isset($_POST["catlist"]))
{
$objCatList->CopyToClipboard("COPY","CategoryId",$_POST["catlist"]);
}
break;
case "m_paste":
if($ro_perm) break;
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($ro_perm) break;
if (isset($_POST["catlist"]))
{
foreach($_POST["catlist"] as $catid)
{
$cat =& $objCatList->GetCategory($catid);
$cat->MoveUp();
}
}
break;
case "m_cat_move_down":
if($ro_perm) break;
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($ro_perm) break;
if (isset($_POST["catlist"]))
{
foreach($_POST["catlist"] as $catid)
{
$cat =& $objCatList->GetCategory($catid);
$cat->Approve();
}
}
break;
case "m_cat_decline":
if($ro_perm) break;
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 = intval($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
if( GetVar('CategoryId') > 0 )
{
$original_cats = new clsCatList();
$original_cat = $original_cats->GetItemByField('CategoryId', GetVar('CategoryId'));
if( $original_cat->Get('Name') != stripslashes($_POST['cat_name'] ))
$objSession->SetVariable('PermCache_UpdateRequired', 1);
unset($original_cat, $original_cats);
}
else
{
$objSession->SetVariable('PermCache_UpdateRequired', 1);
}
// 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"];
$objCustomEdit = new clsCustomDataList($objSession->GetEditTable("CustomMetaData"));
$objCustomEdit->LoadResource($id);
$CustomFields = new clsCustomFieldList($_POST['CustomType']);
$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"),$id,$value);
$DataChanged = TRUE;
}
}
}
if($DataChanged)
$objCustomEdit->SaveData();
/*
$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);
}
$vals = $_POST["multiple"];
if (count($vals) > 0) {
foreach($vals as $var=>$value)
{
$cfg = "Search_ShowMultiple_".$var;
$objConfig->Set($cfg,$value);
}
}
else {
$cfg = "Search_ShowMultiple_".$_POST['cfg_var'];
$objConfig->Set($cfg, 0);
}
if (isset($_POST['minkeyword'])) {
$objConfig->Set("Search_MinKeyword_Length", $_POST['minkeyword']);
}
$objConfig->Save();
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":
$ado = &GetADODBConnection();
$rs = $ado->Execute("SELECT COUNT(*) as c FROM ".GetTablePrefix().'Theme WHERE Name="'.$_POST["name"].'"');
if(!$rs->fields["c"])
{
$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"],$Primary,
(int)$_POST["CacheTimeout"]);
$t->Files->ThemeId=$t->Get("ThemeId");
$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";
$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($ro_perm) break;
if (isset($_POST["itemlist"]))
{
$Themes = new clsThemeList();
foreach($_POST["itemlist"] as $id)
{
$Themes->DeleteTheme($id);
}
}
break;
case "m_theme_primary":
if($ro_perm) break;
if( count($_POST['itemlist']) )
{
$ThemeId = array_shift( $_POST['itemlist'] );
$t = new clsThemeList();
$t->SetPrimaryTheme($ThemeId);
}
break;
case "m_template_edit":
if($ro_perm) break;
$objSession->SetVariable("HasChanges", 1);
$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":
if($ro_perm) break;
$objSession->SetVariable("HasChanges", 1);
$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":
if($ro_perm) break;
$objSession->SetVariable("HasChanges", 1);
$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)
{
// Phrase import
/*
$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();
}
*/
$sql='INSERT INTO '.$objSession->GetEditTable('Phrase').' SELECT Phrase, Translation, PhraseType, 0-PhraseId, '.$NewId.' FROM '.GetTablePrefix().'Phrase WHERE LanguageId='.$_POST['srcpack'];
$ado->Execute($sql);
// Events import
$sql = "SELECT * FROM ".GetTablePrefix()."EmailMessage WHERE LanguageId=".$_POST["srcpack"];
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo $sql."<br>\n";
$rs = $ado->Execute($sql);
$eList = new clsEmailMessageList();
//$eList->SourceTable = $objSession->GetEditTable("EmailMessage");
if (!$l->TableExists($objSession->GetEditTable("EmailMessage"))) {
$eList->CreateEmptyEditTable("EmailMessageId", true);
$eList->SourceTable = $objSession->GetEditTable("EmailMessage");
}
else {
$eList->SourceTable = $objSession->GetEditTable("EmailMessage");
}
$sql = "SELECT MIN(EmailMessageId) as MinId FROM ".$eList->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;
$eList->AddEmailEvent($data["Template"], $data["MessageType"], $NewId, $data["EventId"]);
$sql = "UPDATE ".$eList->SourceTable." SET EmailMessageId=$MinId WHERE EmailMessageId=0 LIMIT 1";
$ado->Execute($sql);
$MinId--;
$rs->MoveNext();
}
}
break;
case "m_lang_export":
if($ro_perm) break;
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"]);
+ $_POST["time_format"], $_POST["decimal"],$_POST["thousand"],
+ $_POST['charset']);
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);
// Events import
$sql = "SELECT * FROM ".GetTablePrefix()."EmailMessage WHERE LanguageId=".$_POST["srcpack"];
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo $sql."<br>\n";
$rs = $ado->Execute($sql);
$eList = new clsEmailMessageList();
//$eList->SourceTable = $objSession->GetEditTable("EmailMessage");
$l = new clsEmailMessage();
if (!$l->TableExists($objSession->GetEditTable("EmailMessage"))) {
$eList->CreateEmptyEditTable("EmailMessageId", true);
$eList->SourceTable = $objSession->GetEditTable("EmailMessage");
}
else {
$eList->SourceTable = $objSession->GetEditTable("EmailMessage");
}
$sql = "SELECT MIN(EmailMessageId) as MinId FROM ".$eList->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;
$eList->AddEmailEvent($data["Template"], $data["MessageType"], $_POST["LanguageId"], $data["EventId"]);
$sql = "UPDATE ".$eList->SourceTable." SET EmailMessageId=$MinId WHERE EmailMessageId=0 LIMIT 1";
$ado->Execute($sql);
$MinId--;
$rs->MoveNext();
}
unset($eList);
}
break;
case "m_lang_delete":
if($ro_perm) break;
if (isset($_POST["itemlist"]))
{
$Phrases = new clsPhraseList();
$Messages = new clsEmailMessageList();
foreach($_POST["itemlist"] as $id)
{
$objLanguages->DeleteLanguage($id);
$Phrases->DeleteLanguage($id);
$Messages->DeleteLanguage($id);
}
unset($Phrases);
unset($Messages);
}
break;
case "m_lang_select":
if($ro_perm) break;
$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":
$objSession->SetVariable("HasChanges", 1);
$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":
if($ro_perm) break;
$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":
$objSession->SetVariable("HasChanges", 1);
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: "._unhtmlentities($_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":
if($ro_perm) break;
$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":
if($ro_perm) break;
$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>";
//print_pre($objSession);
//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 )
{
$objUserGroupsList = new clsUserGroupList();
$objUserGroupsList->CopyFromEditTable("PortalUserId");
$objUsers->CopyFromEditTable("PortalUserId");
$objCustomDataList->CopyFromEditTable("CustomDataId");
$objGroups->Clear();
$objImages = new clsImageList();
$objImages->CopyFromEditTable("ImageId");
}
if( GetVar('UserEditStatus') == 2 )
{
$objUserGroupsList = new clsUserGroupList();
$objGroups->PurgeEditTable("PortalUserId");
$objUserGroupsList->PurgeEditTable("PortalUserId");
$objCustomDataList->PurgeEditTable("CustomDataId");
$objGroups->Clear();
}
/* Group Edit */
if( GetVar('GroupEditStatus') == 1 )
{
$objUserGroupsList = new clsUserGroupList();
$objUserGroupsList->CopyFromEditTable("GroupId");
$objGroups->CopyFromEditTable("GroupId");
$objCustomDataList->CopyFromEditTable("CustomDataId");
$objGroups->Clear();
}
if( GetVar('GroupEditStatus') == 2 )
{
$objUserGroupsList = new clsUserGroupList();
$objGroups->PurgeEditTable("GroupId");
$objCustomDataList->PurgeEditTable("CustomDataId");
$objUserGroupsList->PurgeEditTable("PortalUserId");
$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 )
{
$objLanguages->CopyFromEditTable();
$objLanguages->Clear();
$objLanguages->PurgeEditTable();
$Phrases = new clsPhraseList();
$Phrases->CopyFromEditTable();
$Phrases->Clear();
$Phrases->PurgeEditTable();
$Messages = new clsEmailMessageList();
$Messages->CopyFromEditTable();
$Messages->Clear();
}
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>";
?>
\ No newline at end of file
Property changes on: trunk/kernel/action.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.61
\ No newline at end of property
+1.62
\ No newline at end of property
Index: trunk/kernel/include/language.php
===================================================================
--- trunk/kernel/include/language.php (revision 897)
+++ trunk/kernel/include/language.php (revision 898)
@@ -1,758 +1,758 @@
<?php
class clsPhrase extends clsItemDB
{
function clsPhrase($id=NULL)
{
$this->clsItemDB();
$this->tablename = GetTablePrefix()."Phrase";
$this->id_field = "PhraseId";
$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;
}
if($Id)
{
$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;
}
else
return FALSE;
}
function AdminIcon()
{
global $imagesURL;
return $imagesURL."/itemicons/icon16_language_var.gif";
}
}
class clsPhraseList extends clsItemCollection
{
var $Page;
var $PerPageVar;
function clsPhraseList()
{
$this->clsItemCollection();
$this->SourceTable = GetTablePrefix()."Phrase";
$this->classname = "clsPhrase";
$this->PerPageVar = "Perpage_Phrase";
$this->AdminSearchFields = array("p.Phrase","p.Translation");
}
function &AddPhrase($Phrase,$LangId,$Translation,$Type)
{
$tmpphrase = $this->GetPhrase($Phrase, $LangId);
if (!$tmpphrase) {
$p = new clsPhrase();
$p->tablename = $this->SourceTable;
$p->Set(array("Phrase","LanguageId","Translation","PhraseType"),
array($Phrase,$LangId,$Translation,$Type));
$p->Dirty();
$p->Create();
return $p;
}
else {
//echo 'phrase already exists with label <b>'.$Phrase.'</b><br>';
$add_error = "Error";
return $add_error;
/* $tmpphrase->Set(array("Phrase","LanguageId","Translation","PhraseType"),
array($Phrase,$LangId,$Translation,$Type));
$tmpphrase->Dirty();
$tmpphrase->Update();
return $tmpphrase;*/
}
}
function &EditPhrase($id,$Phrase,$LangId,$Translation,$Type)
{
$p = $this->GetItem($id);
$p->Set(array("Phrase","LanguageId","Translation","PhraseType"),
array($Phrase,$LangId,$Translation,$Type));
$p->Dirty();
$p->Update();
return $p;
}
function DeletePhrase($id)
{
$p = $this->GetItem($id);
$p->Delete();
}
function DeleteLanguage($LangId)
{
$sql = "DELETE FROM ".$this->SourceTable." WHERE LanguageId=$LangId";
if( $GLOBALS['debuglevel'] ) echo $sql."<br>\n";
$this->adodbConnection->Execute($sql);
}
function CopyFromEditTable()
{
global $objSession;
$GLOBALS['_CopyFromEditTable']=1;
$edit_table = $objSession->GetEditTable($this->SourceTable);
$sql='REPLACE '.GetTablePrefix().'Phrase SELECT * FROM '.$objSession->GetEditTable('Phrase').' WHERE PhraseId > 0';
$this->adodbConnection->Execute($sql);
$sql='INSERT INTO '.GetTablePrefix().'Phrase SELECT Phrase, Translation, PhraseType, 0, LanguageId FROM '.$objSession->GetEditTable('Phrase').' WHERE PhraseId < 0';
$this->adodbConnection->Execute($sql);
return;
//$idlist = array();
$sql = "SELECT * FROM $edit_table";
//echo "performing mass create/update<br>";
flush();
$this->Clear();
$rs = $this->adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$data = $rs->fields;
$c = $this->AddItemFromArray($data);
$c->Dirty();
if($data["PhraseId"]>0)
{
$c->Update();
}
else
{
$c->debuglevel=0;
$c->UnsetIdField();
$c->Create();
}
$rs->MoveNext();
}
// Phrases deleted from temporary table are marked with LanguageId = 0, when saving we need to actually delete them all
// The idea was taken from Images edit by Kostja
$sql = "DELETE FROM ".$this->SourceTable." WHERE LanguageId = 0";
$this->adodbConnection->Execute($sql);
if( $GLOBALS['debuglevel'] ) echo $sql."<br>\n";
$this->adodbConnection->Execute($sql);
unset($GLOBALS['_CopyFromEditTable']);
}
function PurgeEditTable()
{
global $objSession;
$edit_table = $objSession->GetEditTable($this->SourceTable);
$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
}
function GetPhrase($Phrase,$Lang, $no_db=FALSE)
{
$found = FALSE;
foreach($this->Items as $i)
{
if($i->Get("Phrase")==$Phrase && $i->Get("LanguageId")==$Lang)
{
$found = TRUE;
break;
}
}
if(!$found && !$no_db)
{
$sql = "SELECT * FROM ".$this->SourceTable." WHERE Phrase='$Phrase' AND LanguageId='$Lang'";
//echo $sql."<br>\n";
$rs = $this->adodbConnection->Execute($sql);
if($rs && !$rs->EOF)
{
$data = $rs->fields;
$i = $this->AddItemFromArray($data);
}
else
$i = FALSE;
}
return $i;
}
}
RegisterPrefix("clsLanguage","lang","kernel/include/language.php");
class clsLanguage extends clsParsedItem
{
function clsLanguage($id=NULL)
{
$this->clsParsedItem();
$this->tablename = GetTablePrefix()."Language";
$this->id_field = "LanguageId";
$this->NoResourceId=1;
$this->TagPrefix="lang";
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;
}
function Delete()
{
$p = new clsPhraseList();
//$id = $this->Get("LanguageId");
//$p->DeleteLanguage($id);
parent::Delete();
}
function ParseObject($element)
{
global $m_var_list,$m_var_list_update, $var_list,$var_list_update, $TemplateRoot;
//echo "<PRE>"; print_r($element); echo "</PRE>";
$extra_attribs = ExtraAttributes($element->attributes);
if(strtolower($element->name)==$this->TagPrefix)
{
$field = strtolower($element->attributes["_field"]);
switch($field)
{
case "id":
$ret = $this->Get("LanguageId");
break;
case "packname":
$ret = $this->Get("PackName");
break;
case "localname":
$ret = $this->Get("LocalName");
break;
case "link":
$t = $element->attributes["_template"];
if(strlen($t))
{
$var_list_update["t"] = $t;
}
else
$var_list_update["t"] = $var_list["t"];
$m_var_list_update["lang"] = $this->Get("LanguageId");
$ret = GetIndexURL(2)."?env=".BuildEnv();
unset($var_list_update["t"],$m_var_list_update["lang"]);
break;
case "primary":
$ret = "";
if($this->Get("PrimaryLang")==1)
$ret = "1";
break;
case "icon":
$ret = "";
$icon = $this->Get("IconUrl");
if(strlen($icon)>0)
{
$file = $TemplateRoot."/".$icon;
//echo "File:$file <br>\n";
if(file_exists($file))
$ret = $icon;
}
if(!strlen($ret))
$ret = $element->attributes["_default"];
//echo $ret;
break;
}//switch
}//if
return $ret;
}
function AdminIcon()
{
global $imagesURL;
$file = $imagesURL."/itemicons/icon16_language";
if($this->Get("PrimaryLang")==1)
{
$file .= "_primary.gif";
}
else
{
if($this->Get("Enabled")==0)
{
$file .= "_disabled";
}
$file .= ".gif";
}
return $file;
}
}
class clsLanguageList extends clsItemCollection
{
var $m_Primary;
function clsLanguageList()
{
$this->clsItemCollection();
$this->SourceTable = GetTablePrefix()."Language";
$this->classname = "clsLanguage";
$this->AdminSearchFields = array("PackName","LocalName");
}
function SetPrimary($lang_id)
{
$sql = "UPDATE ".$this->SourceTable." SET PrimaryLang=0 ";
$this->adodbConnection->Execute($sql);
$l = $this->GetItem($lang_id);
$l->Set("PrimaryLang","1");
$l->Update();
$this->m_Primary =$lang_id;
}
function GetPrimary($Field="LanguageId")
{
if(!$this->m_Primary)
{
$sql = "SELECT * FROM ".$this->SourceTable." WHERE PrimaryLang=1";
$rs = $this->adodbConnection->Execute($sql);
if($rs && !$rs->EOF)
{
$l = $rs->fields[$Field];
}
else
$l = 0;
$this->m_Primary=$l;
}
else
$l = $this->m_Primary;
return $l;
}
function LoadAllLanguages()
{
$sql = "SELECT * FROM ".$this->SourceTable;
$this->Query_Item($sql);
}
function &AddLanguage($PackName,$LocalName,$Enabled,$Primary, $IconUrl="",$Datefmt,$TimeFmt,$Dec,$Thousand)
{
$l = new clsLanguage();
$l->tablename = $this->SourceTable;
$l->Set(array("PackName","LocalName","Enabled","PrimaryLang","IconUrl","DateFormat","TimeFormat",
"DecimalPoint","ThousandSep"),
array($PackName,$LocalName,$Enabled,$Primary,$IconUrl,$Datefmt,$TimeFmt,$Dec,$Thousand));
$l->Dirty();
$l->Create();
return $l;
}
- function EditLanguage($id,$PackName,$LocalName,$Enabled,$Primary, $IconUrl="",$Datefmt,$TimeFmt,$Dec,$Thousand)
+ function EditLanguage($id,$PackName,$LocalName,$Enabled,$Primary, $IconUrl="",$Datefmt,$TimeFmt,$Dec,$Thousand,$Charset)
{
$l = $this->GetItem($id);
$l->Set(array("PackName","LocalName","Enabled","PrimaryLang","IconUrl","DateFormat","TimeFormat",
- "DecimalPoint","ThousandSep"),
- array($PackName,$LocalName,$Enabled,$Primary,$IconUrl,$Datefmt,$TimeFmt,$Dec,$Thousand));
+ "DecimalPoint","ThousandSep",'Charset'),
+ array($PackName,$LocalName,$Enabled,$Primary,$IconUrl,$Datefmt,$TimeFmt,$Dec,$Thousand,$Charset));
$l->Update();
return $l;
}
function DeleteLanguage($id)
{
$l = $this->GetItem($id);
$l->Delete();
}
function CopyFromEditTable()
{
global $objSession;
$GLOBALS['_CopyFromEditTable']=1;
$edit_table = $objSession->GetEditTable($this->SourceTable);
$idlist = array();
$sql = "SELECT * FROM $edit_table";
$this->Clear();
$rs = $this->adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$data = $rs->fields;
$c = $this->AddItemFromArray($data);
$c->Dirty();
if($data["LanguageId"]>0)
{
$c->Update();
}
else
{
$oldid = $c->Get("LanguageId");
$c->UnsetIdField();
$c->Create();
$id = $c->Get("LanguageId");
$phrase_table = $objSession->GetEditTable("Phrase");
$message_table = $objSession->GetEditTable("EmailMessage");
$sql = "UPDATE $phrase_table SET LanguageId=$id WHERE LanguageId=$oldid";
$this->adodbConnection->Execute($sql);
$sql = "UPDATE $message_table SET LanguageId=$id WHERE LanguageId=$oldid";
$this->adodbConnection->Execute($sql);
}
$rs->MoveNext();
}
unset($GLOBALS['_CopyFromEditTable']);
}
function ExportPhrases($file,$LangIds=NULL,$PhraseTypes=null)
{
$output = array();
$this->Clear();
$where_parts = Array();
if( isset($LangIds) ) $where_parts[] = 'LanguageId IN ('.$LangIds.')';
$where = count($where_parts) ? ' WHERE '.implode(' AND ', $where_parts) : '';
$this->Query_Item($sql = 'SELECT * FROM '.$this->SourceTable.$where);
$objXML = new xml_doc();
$RootNode =& $objXML->getTagByID($objXML->createTag("LANGUAGES"));
$ret = 0;
if($this->NumItems()>0)
{
$phrase_where = isset($PhraseTypes) ? ' AND PhraseType IN ('.$PhraseTypes.')' : '';
$event_where = isset($PhraseTypes) ? ' AND Type+1 IN ('.$PhraseTypes.')' : '';
foreach($this->Items as $l)
{
$LangRoot =& $objXML->getTagByID($RootNode->addChild($objXML,"LANGUAGE",array("PackName"=>$l->Get("PackName")),""));
$LangRoot->addChild($objXML,"DATEFORMAT",array(),$l->Get("DateFormat"));
$LangRoot->addChild($objXML,"TIMEFORMAT",array(),$l->Get("TimeFormat"));
$LangRoot->addChild($objXML,"DECIMAL",array(),$l->Get("DecimalPoint"));
$LangRoot->addChild($objXML,"THOUSANDS",array(),$l->Get("ThousandSep"));
+ $LangRoot->addChild($objXML,"CHARSET",array(),$l->Get("Charset"));
$PhraseRoot =& $objXML->getTagByID($LangRoot->addChild($objXML,"PHRASES"));
$sql = "SELECT * FROM ".GetTablePrefix()."Phrase WHERE LanguageId=".$l->Get("LanguageId").$phrase_where;
$rs=$this->adodbConnection->Execute($sql);
while($rs && ! $rs->EOF)
{
$PhraseRoot->addChild($objXML,"PHRASE",array("Label"=>$rs->fields["Phrase"],"Type"=>$rs->fields["PhraseType"]),base64_encode($rs->fields["Translation"]));
$rs->MoveNext();
}
$EventRoot =& $objXML->getTagByID($LangRoot->addChild($objXML,"EVENTS"));
$ev = GetTablePrefix()."Events";
$em = GetTablePrefix()."EmailMessage";
$sql = "SELECT $em.*,$ev.Event,$ev.Type FROM $em INNER JOIN $ev ON ($em.EventId=$ev.EventId) WHERE LanguageId=".$l->Get("LanguageId").$event_where;
$rs = $this->adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$EventRoot->AddChild($objXML,"EVENT",array("MessageType"=>$rs->fields["MessageType"],"Event"=>$rs->fields["Event"],"Type"=>$rs->fields["Type"]),base64_encode($rs->fields["Template"]));
$rs->MoveNext();
}
}
$objXML->generate();
$objXML->xml = str_replace("&","&amp;",$objXML->xml);
$fp = @fopen($file,"w");
@fputs($fp,$objXML->xml);
@fclose($fp);
}
return file_exists($file);
}
function ReadImportTable($TableName,$SetEnabled=0,$Types="0,1",$OverwitePhrases=FALSE,
$MaxInserts=100,$Offset=0)
{
global $objPhraseList;
if(!is_object($objPhraseList))
$objPhraseList = new clsPhraseList();
$PhraseList = new clsPhraseList();
$TypeArray = explode(",",$Types);
$Inserts = 0;
$sql = "SELECT * FROM $TableName WHERE PhraseType IN ($Types) LIMIT $Offset,$MaxInserts";
//echo $sql;
//$PhraseList->EnablePaging = false;
$PhraseList->Query_Item($sql);
if($PhraseList->NumItems()>0)
{
foreach($PhraseList->Items as $i)
{
$p = $objPhraseList->GetPhrase($i->Get("Phrase"),$i->Get("LanguageId"));
//echo "<pre>"; print_r($p); echo "</pre>";
if(is_object($p))
{
if($OverwitePhrases)
{
//$p->debuglevel=1;
$p->Set("Translation",$i->Get("Translation"));
//echo $i->Get("Translation")."<br>";
$p->Set("PhraseType",$i->Get("PhraseType"));
$p->Dirty();
$p->Update();
}
}
else {
//$i->debuglevel=1;
$i->Create();
}
$Inserts++;
}
}
$Offset = $Offset + $Inserts;
return $Offset;
}
function PurgeEditTable()
{
global $objSession;
$edit_table = $objSession->GetEditTable($this->SourceTable);
$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
}
-
}
class clsLanguageCache
{
var $m_CachedLanguage;
var $FullLoad = FALSE;
var $cache;
var $adodbConnection;
var $TemplateName;
var $TemplateCache;
var $TemplateDate;
var $ThemeId;
function clsLanguageCache($LangId=NULL)
{
global $objConfig;
$this->m_CachedLanguage = $LangId;
$this->adodbConnection =&GetADODBConnection();
$this->Clear();
}
function Clear()
{
unset($this->cache);
$this->cache = array();
$this->TemplateCache = array();
}
function LoadLanguage($LangId,$Type)
{
$this->Clear();
$this->m_CachedLanguage = $LangId;
$this->FullLoad = TRUE;
$sql = "SELECT Phrase,Translation FROM ".GetTablePrefix()."Phrase WHERE LanguageId=$LangId AND PhraseType=$Type";
$rs = $this->adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$this->cache[$rs->fields["Phrase"]] = $rs->fields["Translation"];
if(ADODB_EXTENSION>0)
{
adodb_movenext($rs);
}
else
$rs->MoveNext();
}
return (count($this->cache)>0);
}
function GetPhrase($Phrase,$Lang)
{
$t = "";
$sql = "SELECT PhraseId,Phrase,Translation FROM ".GetTablePrefix()."Phrase WHERE Phrase='$Phrase' AND LanguageId='$Lang'";
$rs = $this->adodbConnection->Execute($sql);
if($rs && !$rs->EOF)
{
$t = $rs->fields["Translation"];
$this->TemplateCache[] = $rs->fields["PhraseId"];
}
return $t;
}
function LoadTemplateCache($t, $timeout, $ThemeId)
{
$this->TemplateName = $t;
$this->TemplateDate = 0;
$this->ThemeId = $ThemeId;
if($timeout > 0)
{
$sql = "SELECT * FROM ".GetTablePrefix()."PhraseCache WHERE Template='$t' AND ThemeId=$ThemeId";
$rs = $this->adodbConnection->Execute($sql);
if($rs && !$rs->EOF)
{
$this->TemplateCache = explode(',', $rs->fields['PhraseList']);
$t_length = strlen($rs->fields['PhraseList']) ? 1 : 0;
$this->TemplateDate = $rs->fields["CacheDate"];
if(date("U") < $this->TemplateDate + $timeout || !$t_length)
{
$this->TemplateCache = Array();
$this->TemplateDate=0;
}
}
else
$this->TemplateDate = -1;
}
else
$this->TemplateDate=-2;
}
function LoadCachedVars($LangId)
{
if(count($this->TemplateCache))
{
$values = implode(",",$this->TemplateCache);
$this->FullLoad = FALSE;
$this->m_CachedLanguage = $LangId;
$sql = "SELECT Phrase,Translation FROM ".GetTablePrefix()."Phrase WHERE LanguageId=$LangId AND PhraseId IN ($values)";
$rs = $this->adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$this->cache[$rs->fields["Phrase"]] = $rs->fields["Translation"];
if( defined('ADODB_EXTENSION') && constant('ADODB_EXTENSION') > 0 )
adodb_movenext($rs);
else
$rs->MoveNext();
}
}
}
function SaveTemplateCache()
{
if($this->TemplateDate==0 || $this->TemplateDate==-1)
{
$value = implode(",",$this->TemplateCache);
if($this->TemplateDate==0)
{
$sql = "UPDATE ".GetTablePrefix()."PhraseCache SET PhraseList='$value',CacheDate=".date("U");
$sql .=" WHERE Template='".$this->TemplateName."' AND ThemeId=".$this->ThemeId;
}
else
{
$sql = "INSERT IGNORE INTO ".GetTablePrefix()."PhraseCache (Template,PhraseList,CacheDate,ThemeId) VALUES ('";
$sql .= $this->TemplateName."','$value',".date("U").",".$this->ThemeId.")";
}
$this->adodbConnection->Execute($sql);
}
}
//This function returns a translation for a particular phrase
//if translation is not found then !phrase! is returned.
function GetTranslation($phrase,$language)
{
global $objSession, $LogPhraseLookups,$LangList, $MissingList;
$missing = FALSE;
if(!$this->FullLoad)
{
$this->RefreshCacheStatus($language);
if(!isset($this->cache[$phrase]))
{
$this->cache[$phrase] = $this->GetPhrase($phrase,$language);
$translation = $this->cache[$phrase];
//$translation = "";
}
else
$translation = $this->cache[$phrase];
}
else
{
$translation = $this->cache[$phrase];
}
if(!strlen($translation))
{
$missing = TRUE;
if($language != 1)
{
$translation=$this->GetTranslation($phrase,1);
}
else
{
$translation = "!".$phrase."!";
}
}
if($LogPhraseLookups==TRUE)
{
//if(!is_array($LangList))
// $LangList = array();
//$LangList[$phrase] = $LangList;
if($missing)
{
if(!is_array($MissingList))
{
$MissingList = array();
}
if(!in_array($phrase,$MissingList))
$MissingList[] = $phrase;
}
}
return $translation;
}
//This function checks if cache is current for current language
//if not clear it out
function RefreshCacheStatus($language)
{
//First remember what language we are caching
// if(!isset($this->m_CachedLanguage))
// $this->m_CachedLanguage = $language;
//If this is the different language, then clear the cache
// if($this->m_CachedLanguage != $language)
// {
// $this->Clear();
// $this->m_CachedLanguage = $language;
// }
}
}
?>
Property changes on: trunk/kernel/include/language.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.13
\ No newline at end of property
+1.14
\ No newline at end of property
Index: trunk/kernel/include/adodb/drivers/adodb-mysql.inc.php
===================================================================
--- trunk/kernel/include/adodb/drivers/adodb-mysql.inc.php (revision 897)
+++ trunk/kernel/include/adodb/drivers/adodb-mysql.inc.php (revision 898)
@@ -1,564 +1,564 @@
-<?php
-/*
-V3.60 16 June 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.
- Released under both BSD license and Lesser GPL library license.
- Whenever there is any discrepancy between the two licenses,
- the BSD license will take precedence.
- Set tabs to 8.
-
- MySQL code that does not support transactions. Use mysqlt if you need transactions.
- Requires mysql client. Works on Windows and Unix.
-
- 28 Feb 2001: MetaColumns bug fix - suggested by Freek Dijkstra (phpeverywhere@macfreek.com)
-*/
-
-if (! defined("_ADODB_MYSQL_LAYER")) {
- define("_ADODB_MYSQL_LAYER", 1 );
-
-class ADODB_mysql extends ADOConnection {
- var $databaseType = 'mysql';
- var $dataProvider = 'mysql';
- var $hasInsertID = true;
- var $hasAffectedRows = true;
- var $metaTablesSQL = "SHOW TABLES";
- var $metaColumnsSQL = "SHOW COLUMNS FROM %s";
- var $fmtTimeStamp = "'Y-m-d H:i:s'";
- var $hasLimit = true;
- var $hasMoveFirst = true;
- var $hasGenID = true;
- var $upperCase = 'upper';
- var $isoDates = true; // accepts dates in ISO format
- var $sysDate = 'CURDATE()';
- var $sysTimeStamp = 'NOW()';
- var $hasTransactions = false;
- var $forceNewConnect = false;
- var $poorAffectedRows = true;
- var $clientFlags = 0;
- var $dbxDriver = 1;
-
- function ADODB_mysql()
- {
- }
-
- function ServerInfo()
- {
- $arr['description'] = $this->GetOne("select version()");
- $arr['version'] = ADOConnection::_findvers($arr['description']);
- return $arr;
- }
-
- // if magic quotes disabled, use mysql_real_escape_string()
- function qstr($s,$magic_quotes=false)
- {
- if (!$magic_quotes) {
-
- if (ADODB_PHPVER >= 0x4300) {
- if (is_resource($this->_connectionID))
- return "'".mysql_real_escape_string($s,$this->_connectionID)."'";
- }
- if ($this->replaceQuote[0] == '\\'){
- $s = adodb_str_replace(array('\\',"\0"),array('\\\\',"\\\0"),$s);
- }
- return "'".str_replace("'",$this->replaceQuote,$s)."'";
- }
-
- // undo magic quotes for "
- $s = str_replace('\\"','"',$s);
- return "'$s'";
- }
-
- function _insertid()
- {
- return mysql_insert_id($this->_connectionID);
- }
-
- function _affectedrows()
- {
- return mysql_affected_rows($this->_connectionID);
- }
-
- // See http://www.mysql.com/doc/M/i/Miscellaneous_functions.html
- // Reference on Last_Insert_ID on the recommended way to simulate sequences
- var $_genIDSQL = "update %s set id=LAST_INSERT_ID(id+1);";
- var $_genSeqSQL = "create table %s (id int not null)";
- var $_genSeq2SQL = "insert into %s values (%s)";
- var $_dropSeqSQL = "drop table %s";
-
- function CreateSequence($seqname='adodbseq',$startID=1)
- {
- if (empty($this->_genSeqSQL)) return false;
- $u = strtoupper($seqname);
-
- $ok = $this->Execute(sprintf($this->_genSeqSQL,$seqname));
- if (!$ok) return false;
- return $this->Execute(sprintf($this->_genSeq2SQL,$seqname,$startID-1));
- }
-
- function GenID($seqname='adodbseq',$startID=1)
- {
- // post-nuke sets hasGenID to false
- if (!$this->hasGenID) return false;
-
- $getnext = sprintf($this->_genIDSQL,$seqname);
- $rs = @$this->Execute($getnext);
- if (!$rs) {
- $u = strtoupper($seqname);
- $this->Execute(sprintf($this->_genSeqSQL,$seqname));
- $this->Execute(sprintf($this->_genSeq2SQL,$seqname,$startID-1));
- $rs = $this->Execute($getnext);
- }
- $this->genID = mysql_insert_id($this->_connectionID);
-
- if ($rs) $rs->Close();
-
- return $this->genID;
- }
-
- function &MetaDatabases()
- {
- $qid = mysql_list_dbs($this->_connectionID);
- $arr = array();
- $i = 0;
- $max = mysql_num_rows($qid);
- while ($i < $max) {
- $db = mysql_tablename($qid,$i);
- if ($db != 'mysql') $arr[] = $db;
- $i += 1;
- }
- return $arr;
- }
-
-
- // Format date column in sql string given an input format that understands Y M D
- function SQLDate($fmt, $col=false)
- {
- if (!$col) $col = $this->sysTimeStamp;
- $s = 'DATE_FORMAT('.$col.",'";
- $concat = false;
- $len = strlen($fmt);
- for ($i=0; $i < $len; $i++) {
- $ch = $fmt[$i];
- switch($ch) {
- case 'Y':
- case 'y':
- $s .= '%Y';
- break;
- case 'Q':
- case 'q':
- $s .= "'),Quarter($col)";
-
- if ($len > $i+1) $s .= ",DATE_FORMAT($col,'";
- else $s .= ",('";
- $concat = true;
- break;
- case 'M':
- $s .= '%b';
- break;
-
- case 'm':
- $s .= '%m';
- break;
- case 'D':
- case 'd':
- $s .= '%d';
- break;
-
- case 'H':
- $s .= '%H';
- break;
-
- case 'h':
- $s .= '%I';
- break;
-
- case 'i':
- $s .= '%i';
- break;
-
- case 's':
- $s .= '%s';
- break;
-
- case 'a':
- case 'A':
- $s .= '%p';
- break;
-
- default:
-
- if ($ch == '\\') {
- $i++;
- $ch = substr($fmt,$i,1);
- }
- $s .= $ch;
- break;
- }
- }
- $s.="')";
- if ($concat) $s = "CONCAT($s)";
- return $s;
- }
-
-
- // returns concatenated string
- // much easier to run "mysqld --ansi" or "mysqld --sql-mode=PIPES_AS_CONCAT" and use || operator
- function Concat()
- {
- $s = "";
- $arr = func_get_args();
- $first = true;
- /*
- foreach($arr as $a) {
- if ($first) {
- $s = $a;
- $first = false;
- } else $s .= ','.$a;
- }*/
-
- // suggestion by andrew005@mnogo.ru
- $s = implode(',',$arr);
- if (strlen($s) > 0) return "CONCAT($s)";
- else return '';
- }
-
- function OffsetDate($dayFraction,$date=false)
- {
- if (!$date) $date = $this->sysDate;
- return "from_unixtime(unix_timestamp($date)+($dayFraction)*24*3600)";
- }
-
- // returns true or false
- function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
- {
- if (ADODB_PHPVER >= 0x4300)
- $this->_connectionID = @mysql_connect($argHostname,$argUsername,$argPassword,
- $this->forceNewConnect,$this->clientFlags);
- else if (ADODB_PHPVER >= 0x4200)
- $this->_connectionID = @mysql_connect($argHostname,$argUsername,$argPassword,
- $this->forceNewConnect);
- else
- $this->_connectionID = @mysql_connect($argHostname,$argUsername,$argPassword);
-
- if ($this->_connectionID === false) return false;
- if ($argDatabasename) return $this->SelectDB($argDatabasename);
- return true;
- }
-
- // returns true or false
- function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
- {
- if (ADODB_PHPVER >= 0x4300)
- $this->_connectionID = @mysql_pconnect($argHostname,$argUsername,$argPassword,$this->clientFlags);
- else
- $this->_connectionID = @mysql_pconnect($argHostname,$argUsername,$argPassword);
- if ($this->_connectionID === false) return false;
- if ($this->autoRollback) $this->RollbackTrans();
- if ($argDatabasename) return $this->SelectDB($argDatabasename);
- return true;
- }
-
- function _nconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
- {
- $this->forceNewConnect = true;
- $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename);
- }
-
- function &MetaColumns($table)
- {
-
- if ($this->metaColumnsSQL) {
- global $ADODB_FETCH_MODE;
-
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
-
- $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
-
- if (isset($savem)) $this->SetFetchMode($savem);
- $ADODB_FETCH_MODE = $save;
-
- if ($rs === false) return false;
-
- $retarr = array();
- while (!$rs->EOF){
- $fld = new ADOFieldObject();
- $fld->name = $rs->fields[0];
- $type = $rs->fields[1];
-
- // split type into type(length):
- if (preg_match("/^(.+)\((\d+)/", $type, $query_array)) {
- $fld->type = $query_array[1];
- $fld->max_length = $query_array[2];
- } else {
- $fld->max_length = -1;
- $fld->type = $type;
- }
- $fld->not_null = ($rs->fields[2] != 'YES');
- $fld->primary_key = ($rs->fields[3] == 'PRI');
- $fld->auto_increment = (strpos($rs->fields[5], 'auto_increment') !== false);
- $fld->binary = (strpos($fld->type,'blob') !== false);
- if (!$fld->binary) {
- $d = $rs->fields[4];
- if ($d != "" && $d != "NULL") {
- $fld->has_default = true;
- $fld->default_value = $d;
- } else {
- $fld->has_default = false;
- }
- }
-
- $retarr[strtoupper($fld->name)] = $fld;
- $rs->MoveNext();
- }
- $rs->Close();
- return $retarr;
- }
- return false;
- }
-
- // returns true or false
- function SelectDB($dbName)
- {
- $this->databaseName = $dbName;
- if ($this->_connectionID) {
- return @mysql_select_db($dbName,$this->_connectionID);
- }
- else return false;
- }
-
- // parameters use PostgreSQL convention, not MySQL
- function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false, $arg3=false,$secs=0)
- {
- $offsetStr =($offset>=0) ? "$offset," : '';
-
- return ($secs) ? $this->CacheExecute($secs,$sql." LIMIT $offsetStr$nrows",$inputarr,$arg3)
- : $this->Execute($sql." LIMIT $offsetStr$nrows",$inputarr,$arg3);
-
- }
-
-
- // returns queryID or false
- function _query($sql,$inputarr)
- {
- //global $ADODB_COUNTRECS;
- //if($ADODB_COUNTRECS)
- return mysql_query($sql,$this->_connectionID);
- //else return @mysql_unbuffered_query($sql,$this->_connectionID); // requires PHP >= 4.0.6
- }
-
- /* Returns: the last error message from previous database operation */
- function ErrorMsg()
- {
- if (empty($this->_connectionID)) $this->_errorMsg = @mysql_error();
- else $this->_errorMsg = @mysql_error($this->_connectionID);
- return $this->_errorMsg;
- }
-
- /* Returns: the last error number from previous database operation */
- function ErrorNo()
- {
- if (empty($this->_connectionID)) return @mysql_errno();
- else return @mysql_errno($this->_connectionID);
- }
-
-
-
- // returns true or false
- function _close()
- {
- @mysql_close($this->_connectionID);
- $this->_connectionID = false;
- }
-
-
- /*
- * Maximum size of C field
- */
- function CharMax()
- {
- return 255;
- }
-
- /*
- * Maximum size of X field
- */
- function TextMax()
- {
- return 4294967295;
- }
-
-}
-
-/*--------------------------------------------------------------------------------------
- Class Name: Recordset
---------------------------------------------------------------------------------------*/
-
-class ADORecordSet_mysql extends ADORecordSet{
-
- var $databaseType = "mysql";
- var $canSeek = true;
-
- function ADORecordSet_mysql($queryID,$mode=false)
- {
- if ($mode === false) {
- global $ADODB_FETCH_MODE;
- $mode = $ADODB_FETCH_MODE;
- }
- switch ($mode)
- {
- case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break;
- case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break;
- default:
- case ADODB_FETCH_DEFAULT:
- case ADODB_FETCH_BOTH:$this->fetchMode = MYSQL_BOTH; break;
- }
-
- $this->ADORecordSet($queryID);
- }
-
- function _initrs()
- {
- //GLOBAL $ADODB_COUNTRECS;
- // $this->_numOfRows = ($ADODB_COUNTRECS) ? @mysql_num_rows($this->_queryID):-1;
- $this->_numOfRows = @mysql_num_rows($this->_queryID);
- $this->_numOfFields = @mysql_num_fields($this->_queryID);
- }
-
- function &FetchField($fieldOffset = -1)
- {
-
- if ($fieldOffset != -1) {
- $o = @mysql_fetch_field($this->_queryID, $fieldOffset);
- $f = @mysql_field_flags($this->_queryID,$fieldOffset);
- $o->max_length = @mysql_field_len($this->_queryID,$fieldOffset); // suggested by: Jim Nicholson (jnich@att.com)
- //$o->max_length = -1; // mysql returns the max length less spaces -- so it is unrealiable
- $o->binary = (strpos($f,'binary')!== false);
- }
- else if ($fieldOffset == -1) { /* The $fieldOffset argument is not provided thus its -1 */
- $o = @mysql_fetch_field($this->_queryID);
- $o->max_length = @mysql_field_len($this->_queryID); // suggested by: Jim Nicholson (jnich@att.com)
- //$o->max_length = -1; // mysql returns the max length less spaces -- so it is unrealiable
- }
-
- return $o;
- }
-
- function &GetRowAssoc($upper=true)
- {
- if ($this->fetchMode == MYSQL_ASSOC && !$upper) return $this->fields;
- return ADORecordSet::GetRowAssoc($upper);
- }
-
- /* Use associative array to get fields array */
- function Fields($colname)
- {
- // added @ by "Michael William Miller" <mille562@pilot.msu.edu>
- if ($this->fetchMode != MYSQL_NUM) return @$this->fields[$colname];
-
- if (!$this->bind) {
- $this->bind = array();
- for ($i=0; $i < $this->_numOfFields; $i++) {
- $o = $this->FetchField($i);
- $this->bind[strtoupper($o->name)] = $i;
- }
- }
- return $this->fields[$this->bind[strtoupper($colname)]];
- }
-
- function _seek($row)
- {
- if ($this->_numOfRows == 0) return false;
- return @mysql_data_seek($this->_queryID,$row);
- }
-
-
- // 10% speedup to move MoveNext to child class
- function MoveNext()
- {
- //global $ADODB_EXTENSION;if ($ADODB_EXTENSION) return adodb_movenext($this);
-
- if ($this->EOF) return false;
-
- $this->_currentRow++;
- $this->fields = @mysql_fetch_array($this->_queryID,$this->fetchMode);
- if (is_array($this->fields)) return true;
-
- $this->EOF = true;
-
- /* -- tested raising an error -- appears pointless
- $conn = $this->connection;
- if ($conn && $conn->raiseErrorFn && ($errno = $conn->ErrorNo())) {
- $fn = $conn->raiseErrorFn;
- $fn($conn->databaseType,'MOVENEXT',$errno,$conn->ErrorMsg().' ('.$this->sql.')',$conn->host,$conn->database);
- }
- */
- return false;
- }
-
- function _fetch()
- {
- $this->fields = @mysql_fetch_array($this->_queryID,$this->fetchMode);
- return is_array($this->fields);
- }
-
- function _close() {
- @mysql_free_result($this->_queryID);
- $this->_queryID = false;
- }
-
- function MetaType($t,$len=-1,$fieldobj=false)
- {
- if (is_object($t)) {
- $fieldobj = $t;
- $t = $fieldobj->type;
- $len = $fieldobj->max_length;
- }
-
- $len = -1; // mysql max_length is not accurate
- switch (strtoupper($t)) {
- case 'STRING':
- case 'CHAR':
- case 'VARCHAR':
- case 'TINYBLOB':
- case 'TINYTEXT':
- case 'ENUM':
- case 'SET':
- if ($len <= $this->blobSize) return 'C';
-
- case 'TEXT':
- case 'LONGTEXT':
- case 'MEDIUMTEXT':
- return 'X';
-
- // php_mysql extension always returns 'blob' even if 'text'
- // so we have to check whether binary...
- case 'IMAGE':
- case 'LONGBLOB':
- case 'BLOB':
- case 'MEDIUMBLOB':
- return !empty($fieldobj->binary) ? 'B' : 'X';
- case 'YEAR':
- case 'DATE': return 'D';
-
- case 'TIME':
- case 'DATETIME':
- case 'TIMESTAMP': return 'T';
-
- case 'INT':
- case 'INTEGER':
- case 'BIGINT':
- case 'TINYINT':
- case 'MEDIUMINT':
- case 'SMALLINT':
-
- if (!empty($fieldobj->primary_key)) return 'R';
- else return 'I';
-
- default: return 'N';
- }
- }
-
-}
-}
+<?php
+/*
+V3.60 16 June 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.
+ Released under both BSD license and Lesser GPL library license.
+ Whenever there is any discrepancy between the two licenses,
+ the BSD license will take precedence.
+ Set tabs to 8.
+
+ MySQL code that does not support transactions. Use mysqlt if you need transactions.
+ Requires mysql client. Works on Windows and Unix.
+
+ 28 Feb 2001: MetaColumns bug fix - suggested by Freek Dijkstra (phpeverywhere@macfreek.com)
+*/
+
+if (! defined("_ADODB_MYSQL_LAYER")) {
+ define("_ADODB_MYSQL_LAYER", 1 );
+
+class ADODB_mysql extends ADOConnection {
+ var $databaseType = 'mysql';
+ var $dataProvider = 'mysql';
+ var $hasInsertID = true;
+ var $hasAffectedRows = true;
+ var $metaTablesSQL = "SHOW TABLES";
+ var $metaColumnsSQL = "SHOW COLUMNS FROM %s";
+ var $fmtTimeStamp = "'Y-m-d H:i:s'";
+ var $hasLimit = true;
+ var $hasMoveFirst = true;
+ var $hasGenID = true;
+ var $upperCase = 'upper';
+ var $isoDates = true; // accepts dates in ISO format
+ var $sysDate = 'CURDATE()';
+ var $sysTimeStamp = 'NOW()';
+ var $hasTransactions = false;
+ var $forceNewConnect = false;
+ var $poorAffectedRows = true;
+ var $clientFlags = 0;
+ var $dbxDriver = 1;
+
+ function ADODB_mysql()
+ {
+ }
+
+ function ServerInfo()
+ {
+ $arr['description'] = $this->GetOne("select version()");
+ $arr['version'] = ADOConnection::_findvers($arr['description']);
+ return $arr;
+ }
+
+ // if magic quotes disabled, use mysql_real_escape_string()
+ function qstr($s,$magic_quotes=false)
+ {
+ if (!$magic_quotes) {
+
+ if (ADODB_PHPVER >= 0x4300) {
+ if (is_resource($this->_connectionID))
+ return "'".mysql_real_escape_string($s,$this->_connectionID)."'";
+ }
+ if ($this->replaceQuote[0] == '\\'){
+ $s = adodb_str_replace(array('\\',"\0"),array('\\\\',"\\\0"),$s);
+ }
+ return "'".str_replace("'",$this->replaceQuote,$s)."'";
+ }
+
+ // undo magic quotes for "
+ $s = str_replace('\\"','"',$s);
+ return "'$s'";
+ }
+
+ function _insertid()
+ {
+ return mysql_insert_id($this->_connectionID);
+ }
+
+ function _affectedrows()
+ {
+ return mysql_affected_rows($this->_connectionID);
+ }
+
+ // See http://www.mysql.com/doc/M/i/Miscellaneous_functions.html
+ // Reference on Last_Insert_ID on the recommended way to simulate sequences
+ var $_genIDSQL = "update %s set id=LAST_INSERT_ID(id+1);";
+ var $_genSeqSQL = "create table %s (id int not null)";
+ var $_genSeq2SQL = "insert into %s values (%s)";
+ var $_dropSeqSQL = "drop table %s";
+
+ function CreateSequence($seqname='adodbseq',$startID=1)
+ {
+ if (empty($this->_genSeqSQL)) return false;
+ $u = strtoupper($seqname);
+
+ $ok = $this->Execute(sprintf($this->_genSeqSQL,$seqname));
+ if (!$ok) return false;
+ return $this->Execute(sprintf($this->_genSeq2SQL,$seqname,$startID-1));
+ }
+
+ function GenID($seqname='adodbseq',$startID=1)
+ {
+ // post-nuke sets hasGenID to false
+ if (!$this->hasGenID) return false;
+
+ $getnext = sprintf($this->_genIDSQL,$seqname);
+ $rs = @$this->Execute($getnext);
+ if (!$rs) {
+ $u = strtoupper($seqname);
+ $this->Execute(sprintf($this->_genSeqSQL,$seqname));
+ $this->Execute(sprintf($this->_genSeq2SQL,$seqname,$startID-1));
+ $rs = $this->Execute($getnext);
+ }
+ $this->genID = mysql_insert_id($this->_connectionID);
+
+ if ($rs) $rs->Close();
+
+ return $this->genID;
+ }
+
+ function &MetaDatabases()
+ {
+ $qid = mysql_list_dbs($this->_connectionID);
+ $arr = array();
+ $i = 0;
+ $max = mysql_num_rows($qid);
+ while ($i < $max) {
+ $db = mysql_tablename($qid,$i);
+ if ($db != 'mysql') $arr[] = $db;
+ $i += 1;
+ }
+ return $arr;
+ }
+
+
+ // Format date column in sql string given an input format that understands Y M D
+ function SQLDate($fmt, $col=false)
+ {
+ if (!$col) $col = $this->sysTimeStamp;
+ $s = 'DATE_FORMAT('.$col.",'";
+ $concat = false;
+ $len = strlen($fmt);
+ for ($i=0; $i < $len; $i++) {
+ $ch = $fmt[$i];
+ switch($ch) {
+ case 'Y':
+ case 'y':
+ $s .= '%Y';
+ break;
+ case 'Q':
+ case 'q':
+ $s .= "'),Quarter($col)";
+
+ if ($len > $i+1) $s .= ",DATE_FORMAT($col,'";
+ else $s .= ",('";
+ $concat = true;
+ break;
+ case 'M':
+ $s .= '%b';
+ break;
+
+ case 'm':
+ $s .= '%m';
+ break;
+ case 'D':
+ case 'd':
+ $s .= '%d';
+ break;
+
+ case 'H':
+ $s .= '%H';
+ break;
+
+ case 'h':
+ $s .= '%I';
+ break;
+
+ case 'i':
+ $s .= '%i';
+ break;
+
+ case 's':
+ $s .= '%s';
+ break;
+
+ case 'a':
+ case 'A':
+ $s .= '%p';
+ break;
+
+ default:
+
+ if ($ch == '\\') {
+ $i++;
+ $ch = substr($fmt,$i,1);
+ }
+ $s .= $ch;
+ break;
+ }
+ }
+ $s.="')";
+ if ($concat) $s = "CONCAT($s)";
+ return $s;
+ }
+
+
+ // returns concatenated string
+ // much easier to run "mysqld --ansi" or "mysqld --sql-mode=PIPES_AS_CONCAT" and use || operator
+ function Concat()
+ {
+ $s = "";
+ $arr = func_get_args();
+ $first = true;
+ /*
+ foreach($arr as $a) {
+ if ($first) {
+ $s = $a;
+ $first = false;
+ } else $s .= ','.$a;
+ }*/
+
+ // suggestion by andrew005@mnogo.ru
+ $s = implode(',',$arr);
+ if (strlen($s) > 0) return "CONCAT($s)";
+ else return '';
+ }
+
+ function OffsetDate($dayFraction,$date=false)
+ {
+ if (!$date) $date = $this->sysDate;
+ return "from_unixtime(unix_timestamp($date)+($dayFraction)*24*3600)";
+ }
+
+ // returns true or false
+ function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
+ {
+ if (ADODB_PHPVER >= 0x4300)
+ $this->_connectionID = @mysql_connect($argHostname,$argUsername,$argPassword,
+ $this->forceNewConnect,$this->clientFlags);
+ else if (ADODB_PHPVER >= 0x4200)
+ $this->_connectionID = @mysql_connect($argHostname,$argUsername,$argPassword,
+ $this->forceNewConnect);
+ else
+ $this->_connectionID = @mysql_connect($argHostname,$argUsername,$argPassword);
+
+ if ($this->_connectionID === false) return false;
+ if ($argDatabasename) return $this->SelectDB($argDatabasename);
+ return true;
+ }
+
+ // returns true or false
+ function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
+ {
+ if (ADODB_PHPVER >= 0x4300)
+ $this->_connectionID = @mysql_pconnect($argHostname,$argUsername,$argPassword,$this->clientFlags);
+ else
+ $this->_connectionID = @mysql_pconnect($argHostname,$argUsername,$argPassword);
+ if ($this->_connectionID === false) return false;
+ if ($this->autoRollback) $this->RollbackTrans();
+ if ($argDatabasename) return $this->SelectDB($argDatabasename);
+ return true;
+ }
+
+ function _nconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
+ {
+ $this->forceNewConnect = true;
+ $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename);
+ }
+
+ function &MetaColumns($table)
+ {
+
+ if ($this->metaColumnsSQL) {
+ global $ADODB_FETCH_MODE;
+
+ $save = $ADODB_FETCH_MODE;
+ $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
+ if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
+
+ $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
+
+ if (isset($savem)) $this->SetFetchMode($savem);
+ $ADODB_FETCH_MODE = $save;
+
+ if ($rs === false) return false;
+
+ $retarr = array();
+ while (!$rs->EOF){
+ $fld = new ADOFieldObject();
+ $fld->name = $rs->fields[0];
+ $type = $rs->fields[1];
+
+ // split type into type(length):
+ if (preg_match("/^(.+)\((\d+)/", $type, $query_array)) {
+ $fld->type = $query_array[1];
+ $fld->max_length = $query_array[2];
+ } else {
+ $fld->max_length = -1;
+ $fld->type = $type;
+ }
+ $fld->not_null = ($rs->fields[2] != 'YES');
+ $fld->primary_key = ($rs->fields[3] == 'PRI');
+ $fld->auto_increment = (strpos($rs->fields[5], 'auto_increment') !== false);
+ $fld->binary = (strpos($fld->type,'blob') !== false);
+ if (!$fld->binary) {
+ $d = $rs->fields[4];
+ if ($d != "" && $d != "NULL") {
+ $fld->has_default = true;
+ $fld->default_value = $d;
+ } else {
+ $fld->has_default = false;
+ }
+ }
+
+ $retarr[strtoupper($fld->name)] = $fld;
+ $rs->MoveNext();
+ }
+ $rs->Close();
+ return $retarr;
+ }
+ return false;
+ }
+
+ // returns true or false
+ function SelectDB($dbName)
+ {
+ $this->databaseName = $dbName;
+ if ($this->_connectionID) {
+ return @mysql_select_db($dbName,$this->_connectionID);
+ }
+ else return false;
+ }
+
+ // parameters use PostgreSQL convention, not MySQL
+ function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false, $arg3=false,$secs=0)
+ {
+ $offsetStr =($offset>=0) ? "$offset," : '';
+
+ return ($secs) ? $this->CacheExecute($secs,$sql." LIMIT $offsetStr$nrows",$inputarr,$arg3)
+ : $this->Execute($sql." LIMIT $offsetStr$nrows",$inputarr,$arg3);
+
+ }
+
+
+ // returns queryID or false
+ function _query($sql,$inputarr)
+ {
+ //global $ADODB_COUNTRECS;
+ //if($ADODB_COUNTRECS)
+ return mysql_query($sql,$this->_connectionID);
+ //else return @mysql_unbuffered_query($sql,$this->_connectionID); // requires PHP >= 4.0.6
+ }
+
+ /* Returns: the last error message from previous database operation */
+ function ErrorMsg()
+ {
+ if (empty($this->_connectionID)) $this->_errorMsg = @mysql_error();
+ else $this->_errorMsg = @mysql_error($this->_connectionID);
+ return $this->_errorMsg;
+ }
+
+ /* Returns: the last error number from previous database operation */
+ function ErrorNo()
+ {
+ if (empty($this->_connectionID)) return @mysql_errno();
+ else return @mysql_errno($this->_connectionID);
+ }
+
+
+
+ // returns true or false
+ function _close()
+ {
+ @mysql_close($this->_connectionID);
+ $this->_connectionID = false;
+ }
+
+
+ /*
+ * Maximum size of C field
+ */
+ function CharMax()
+ {
+ return 255;
+ }
+
+ /*
+ * Maximum size of X field
+ */
+ function TextMax()
+ {
+ return 4294967295;
+ }
+
+}
+
+/*--------------------------------------------------------------------------------------
+ Class Name: Recordset
+--------------------------------------------------------------------------------------*/
+
+class ADORecordSet_mysql extends ADORecordSet{
+
+ var $databaseType = "mysql";
+ var $canSeek = true;
+
+ function ADORecordSet_mysql($queryID,$mode=false)
+ {
+ if ($mode === false) {
+ global $ADODB_FETCH_MODE;
+ $mode = $ADODB_FETCH_MODE;
+ }
+ switch ($mode)
+ {
+ case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break;
+ case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break;
+ default:
+ case ADODB_FETCH_DEFAULT:
+ case ADODB_FETCH_BOTH:$this->fetchMode = MYSQL_BOTH; break;
+ }
+
+ $this->ADORecordSet($queryID);
+ }
+
+ function _initrs()
+ {
+ //GLOBAL $ADODB_COUNTRECS;
+ // $this->_numOfRows = ($ADODB_COUNTRECS) ? @mysql_num_rows($this->_queryID):-1;
+ $this->_numOfRows = @mysql_num_rows($this->_queryID);
+ $this->_numOfFields = @mysql_num_fields($this->_queryID);
+ }
+
+ function &FetchField($fieldOffset = -1)
+ {
+
+ if ($fieldOffset != -1) {
+ $o = @mysql_fetch_field($this->_queryID, $fieldOffset);
+ $f = @mysql_field_flags($this->_queryID,$fieldOffset);
+ $o->max_length = @mysql_field_len($this->_queryID,$fieldOffset); // suggested by: Jim Nicholson (jnich@att.com)
+ //$o->max_length = -1; // mysql returns the max length less spaces -- so it is unrealiable
+ $o->binary = (strpos($f,'binary')!== false);
+ }
+ else if ($fieldOffset == -1) { /* The $fieldOffset argument is not provided thus its -1 */
+ $o = @mysql_fetch_field($this->_queryID);
+ $o->max_length = @mysql_field_len($this->_queryID); // suggested by: Jim Nicholson (jnich@att.com)
+ //$o->max_length = -1; // mysql returns the max length less spaces -- so it is unrealiable
+ }
+
+ return $o;
+ }
+
+ function &GetRowAssoc($upper=true)
+ {
+ if ($this->fetchMode == MYSQL_ASSOC && !$upper) return $this->fields;
+ return ADORecordSet::GetRowAssoc($upper);
+ }
+
+ /* Use associative array to get fields array */
+ function Fields($colname)
+ {
+ // added @ by "Michael William Miller" <mille562@pilot.msu.edu>
+ if ($this->fetchMode != MYSQL_NUM) return @$this->fields[$colname];
+
+ if (!$this->bind) {
+ $this->bind = array();
+ for ($i=0; $i < $this->_numOfFields; $i++) {
+ $o = $this->FetchField($i);
+ $this->bind[strtoupper($o->name)] = $i;
+ }
+ }
+ return $this->fields[$this->bind[strtoupper($colname)]];
+ }
+
+ function _seek($row)
+ {
+ if ($this->_numOfRows == 0) return false;
+ return @mysql_data_seek($this->_queryID,$row);
+ }
+
+
+ // 10% speedup to move MoveNext to child class
+ function MoveNext()
+ {
+ //global $ADODB_EXTENSION;if ($ADODB_EXTENSION) return adodb_movenext($this);
+
+ if ($this->EOF) return false;
+
+ $this->_currentRow++;
+ $this->fields = @mysql_fetch_array($this->_queryID,$this->fetchMode);
+ if (is_array($this->fields)) return true;
+
+ $this->EOF = true;
+
+ /* -- tested raising an error -- appears pointless
+ $conn = $this->connection;
+ if ($conn && $conn->raiseErrorFn && ($errno = $conn->ErrorNo())) {
+ $fn = $conn->raiseErrorFn;
+ $fn($conn->databaseType,'MOVENEXT',$errno,$conn->ErrorMsg().' ('.$this->sql.')',$conn->host,$conn->database);
+ }
+ */
+ return false;
+ }
+
+ function _fetch()
+ {
+ $this->fields = @mysql_fetch_array($this->_queryID,$this->fetchMode);
+ return is_array($this->fields);
+ }
+
+ function _close() {
+ @mysql_free_result($this->_queryID);
+ $this->_queryID = false;
+ }
+
+ function MetaType($t,$len=-1,$fieldobj=false)
+ {
+ if (is_object($t)) {
+ $fieldobj = $t;
+ $t = $fieldobj->type;
+ $len = $fieldobj->max_length;
+ }
+
+ $len = -1; // mysql max_length is not accurate
+ switch (strtoupper($t)) {
+ case 'STRING':
+ case 'CHAR':
+ case 'VARCHAR':
+ case 'TINYBLOB':
+ case 'TINYTEXT':
+ case 'ENUM':
+ case 'SET':
+ if ($len <= $this->blobSize) return 'C';
+
+ case 'TEXT':
+ case 'LONGTEXT':
+ case 'MEDIUMTEXT':
+ return 'X';
+
+ // php_mysql extension always returns 'blob' even if 'text'
+ // so we have to check whether binary...
+ case 'IMAGE':
+ case 'LONGBLOB':
+ case 'BLOB':
+ case 'MEDIUMBLOB':
+ return !empty($fieldobj->binary) ? 'B' : 'X';
+ case 'YEAR':
+ case 'DATE': return 'D';
+
+ case 'TIME':
+ case 'DATETIME':
+ case 'TIMESTAMP': return 'T';
+
+ case 'INT':
+ case 'INTEGER':
+ case 'BIGINT':
+ case 'TINYINT':
+ case 'MEDIUMINT':
+ case 'SMALLINT':
+
+ if (!empty($fieldobj->primary_key)) return 'R';
+ else return 'I';
+
+ default: return 'N';
+ }
+ }
+
+}
+}
?>
\ No newline at end of file
Property changes on: trunk/kernel/include/adodb/drivers/adodb-mysql.inc.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/tools/phrase_locator.php
===================================================================
--- trunk/tools/phrase_locator.php (revision 897)
+++ trunk/tools/phrase_locator.php (revision 898)
@@ -1,78 +1,88 @@
<?php
+ // change next 2 lines only
+ define('HOST_PREFIX','alex');
+ define('DB_PREFIX', 'Prefix_');
+
+ // don't change anything here
define('DB_USER','dev');
define('DB_PASS','dev-25-sql');
define('DB_HOST','localhost');
- define('DB_BASE','maris_in_portal');
- define('DB_PREFIX', '');
-
- $dir = '/www/maris/in-portal/';
+ define('DB_BASE',HOST_PREFIX.'_in_portal');
+ $dir = '/www/'.HOST_PREFIX.'/in-portal/';
$phrases = Array();
scanDir($dir);
function scanDir($FolderPath)
{
global $phrases;
$FolderHandle = opendir($FolderPath);
if($FolderHandle)
{
while( false !== ($file = readdir($FolderHandle)) )
{
if( $file == '.' || $file == '..' ) continue;
$file = $FolderPath.$file;
if( is_dir($file) )
{
scanDir($file.'/');
}
elseif( is_file($file) && in_array(substr($file,strrpos($file, '.') + 1), Array('php','js','tpl')) )
{
$filedata = file_get_contents($file);
preg_match_all('/\'(lu_.*|la_.*)\'/U',$filedata,$rets);
foreach ($rets[1] as $phrase_name) {
$phrases[strtolower($phrase_name)] = 1;
}
preg_match_all('/"(lu_.*|la_.*)"/U',$filedata,$rets);
foreach ($rets[1] as $phrase_name) {
$phrases[strtolower($phrase_name)] = 1;
}
}
}
closedir($FolderHandle);
}
}
//print_r($phrases);
$mysql_link = mysql_connect(DB_HOST,DB_USER,DB_PASS);
mysql_select_db(DB_BASE,$mysql_link);
$sql = 'SELECT LOWER(Phrase) AS Phrase FROM '.DB_PREFIX.'Phrase WHERE LanguageId = 1';
$rs = mysql_query($sql,$mysql_link);
while( ($row = mysql_fetch_array($rs)) )
{
unset($phrases[ $row['Phrase'] ]); // phrase is translated
}
mysql_free_result($rs);
$ret = Array();
foreach($phrases as $phrase => $dummy_value)
{
$ret[] = $phrase;
}
print_pre($ret);
- $fp = fopen($dir.'new_phrases.txt','w');
- foreach ($ret as $phrase)
+ if( unlink($dir.'new_phrases.txt') )
+ {
+ $fp = fopen($dir.'new_phrases.txt','w');
+ foreach ($ret as $phrase)
+ {
+ fwrite($fp,$phrase."\n");
+ }
+ fclose($fp);
+ }
+ else
{
- fwrite($fp,$phrase."\n");
+ die('Can\'t create file <b>new_phrases.txt</b>');
}
- fclose($fp);
function print_pre($s)
{
echo '<pre>',print_r($s,true),'</pre>';
}
?>
\ No newline at end of file
Property changes on: trunk/tools/phrase_locator.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/themes/default/common/head.tpl
===================================================================
--- trunk/themes/default/common/head.tpl (revision 897)
+++ trunk/themes/default/common/head.tpl (revision 898)
@@ -1,153 +1,153 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- start meta tags -->
-<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
+<meta http-equiv="content-type" content="text/html; charset=<inp:m_regional_option _name="Charset" />" />
<meta name="keywords" content="..." />
<meta name="description" content="..." />
<meta name="robots" content="all" />
<meta name="copyright" content="Copyright &#174; 1997-2003 Intechnic" />
<meta name="author" content="Intechnic Corporation." />
<!-- end meta tags -->
<base href="<inp:m_theme_url/>" />
<!-- start AddToFavorites icon -->
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<!-- end AddToFavorites icon -->
<SCRIPT language="JavaScript" SRC="incs/sniffer2.js" type="text/javascript"></SCRIPT>
<script language="JavaScript" src="incs/scripts.js" type="text/javascript"></script>
<SCRIPT language="JavaScript1.2" type="text/javascript">
function showSeg(el,on)
{
if(is_getElementById)
{
d = document.getElementById(el);
if (is_nav4up) {d.visibility = (on) ? "show" : "hide"}
else {d.style.visibility = (on) ? "visible" : "hidden"}
}
else
{
if (is_ie)
document.alldivs[el].style.visibility = (on) ? "visible" : "hidden";
else if(is_nav)
document.layers[el].bgColor = (on) ? "show" : "hide";
}
//alert(d.id);
}
function hideSeg(el)
{
tid=setTimeout('showSeg("'+el+'",false)',2000);
}
function moveSeg()
{
if(tid)
clearTimeout(tid);
tid=0;
}
tid = 0;
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? 1 : 0;
ver4 = true; //DEBUG!
//alert("nav4: "+is_nav4up+" IE4:"+is_ie4up);
if (is_nav4up || is_ie4up || is_getElementById) {
leftPos = 520; // if option 1 or 3, above, assign null
topPos = 143; // if option 1 or 3, above, assign null
margRight = 0; // for NO right margin, assign 0
padding = 0; // for NO padding, assign 0
backCol = null; // for transparent, assign null
borWid = null; // for no border, assign null
borCol = "#993366"; // overlooked if borWid is null
borSty = "solid"; // overlooked if borWid is null
if(is_ie4up || is_opera)
{
width=200;
}
else
width = 185;
}
semi = ";";
styStr = "<STYLE TYPE='text/css'>"
styStr += ".segment{";
styStr += "cursor: hand;";
styStr += "position:absolute;";
styStr += "visibility:hidden;";
styStr += "left:"+leftPos+"px;";
styStr += "top:"+topPos+"px;";
styStr += "width:" + width + "px" + semi;
if (borWid > 0) {
styStr += "border-width:" + borWid + semi;
styStr += "border-color:" + borCol + semi;
styStr += "border-style:" + borSty + semi;
}
if (is_nav4up) {
if (borWid > 0 && padding <= 3) styStr += "padding: 0;";
if (borWid > 0 && padding > 3) styStr += "padding:" + (padding-3) + semi;
if (borWid == 0) styStr += "padding:" + padding + semi;
}
else {
styStr += "padding:" + padding + semi;
}
if (backCol != null) {
if (is_nav4up) {
if (borWid > 0 && padding <= 3) {
styStr += "layer-background-color:" + backCol + semi;
}
if (borWid > 0 && padding > 3) {
styStr += "background-color:" + backCol + semi;
}
if (borWid == 0) {
styStr += "layer-background-color:" + backCol + semi;
}
}
else {
styStr += "background-color:" + backCol + semi;
}
}
styStr += "}";
styStr += ".last{position:absolute;visibility:hidden}";
styStr += "</STYLE>";
document.write(styStr);
</SCRIPT>
<SCRIPT Languge="JavaScript1.2">
function highlight_link(elementId,highlight_color)
{
d = document.getElementById(elementId);
if(d)
{
d.style.color = highlight_color;
}
}
</SCRIPT>
<title><inp:m_page_title /></title>
<!-- start CSS linked -->
<inp:m_module_stylesheets _Modules="In-Portal,In-News,In-Bulletin,In-Link" _In-PortalCss="incs/inportal_main.css" />
<!-- end CSS linked -->
<!-- start name.js code -->
<!--<script src="incs/js/name.js" type="text/javascript" language="JavaScript1.2" charset="utf-8"></script>-->
<!-- end name.js code -->
</head>
Property changes on: trunk/themes/default/common/head.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property
Index: trunk/themes/inlink2/header.tpl
===================================================================
--- trunk/themes/inlink2/header.tpl (revision 897)
+++ trunk/themes/inlink2/header.tpl (revision 898)
@@ -1,51 +1,53 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-<!-- start meta tags -->
-<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
-<meta name="keywords" content="..." />
-<meta name="description" content="..." />
-<meta name="robots" content="all" />
-<meta name="copyright" content="Copyright &#174; 1997-2003 Intechnic" />
-<meta name="author" content="Intechnic Corporation." />
-<!-- end meta tags -->
-<base href="<inp:m_theme_url/>" />
-
-<!-- start AddToFavorites icon -->
-<link rel="icon" href="/favicon.ico" type="image/x-icon" />
-<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
-<!-- end AddToFavorites icon -->
-
-<LINK rel="stylesheet" href="style.css" type="text/css">
-<inp:m_module_stylesheets _Modules="In-Portal,In-Link" _In-PortalCss="styles.css" />
-</HEAD>
-
-<BODY bgcolor="#FFFFFF" text="#000000">
-<P align="center">
- <A href="<%nav:index%>"><IMG src="images/inlink2_logo.gif" width="175" height="63" border="0"></A>
-</P>
-
-<inp:include _Template="menu_navigation" />
-
-
-<table width="760" align="center" cellpadding="0" cellspacing="0">
-<form method="POST" name="select_theme" action="<inp:m_form_action _Form="m_set_theme"/>">
-<tr>
- <td align="left" nowrap>
- <span class="small"><inp:m_language _Phrase="lu_select_theme" /></span>
- <select class="small" size="1" name="ThemeId">
- <inp:m_list_themes _ItemTemplate="theme_menu/theme_menu_element.tpl" />
- </select>
- <input type="submit" value="<inp:m_language _Phrase="lu_button_ok" />" name="go" class="button"></td>
-
- <td align="right" width="100%" valign="middle">
- <span class="small"><inp:m_lang_field _Field="LocalName" /></span>&nbsp;
- <inp:m_list_languages _ItemTemplate="lang_menu/lang_menu_element.tpl" /></td>
-</tr>
-</form>
-</table>
-
-<HR width="760" size="1" noshade align="center">
-
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+
+<!-- start meta tags -->
+
+<meta http-equiv="content-type" content="text/html; charset=<inp:m_regional_option _name="Charset" />" />
+<meta name="keywords" content="..." />
+<meta name="description" content="..." />
+<meta name="robots" content="all" />
+<meta name="copyright" content="Copyright &#174; 1997-2003 Intechnic" />
+<meta name="author" content="Intechnic Corporation." />
+<!-- end meta tags -->
+<base href="<inp:m_theme_url/>" />
+
+<!-- start AddToFavorites icon -->
+<link rel="icon" href="/favicon.ico" type="image/x-icon" />
+<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
+<!-- end AddToFavorites icon -->
+
+<LINK rel="stylesheet" href="style.css" type="text/css">
+<inp:m_module_stylesheets _Modules="In-Portal,In-Link" _In-PortalCss="styles.css" />
+</HEAD>
+
+<BODY bgcolor="#FFFFFF" text="#000000">
+<P align="center">
+ <A href="<%nav:index%>"><IMG src="images/inlink2_logo.gif" width="175" height="63" border="0"></A>
+</P>
+
+<inp:include _Template="menu_navigation" />
+
+
+<table width="760" align="center" cellpadding="0" cellspacing="0">
+<form method="POST" name="select_theme" action="<inp:m_form_action _Form="m_set_theme"/>">
+<tr>
+ <td align="left" nowrap>
+ <span class="small"><inp:m_language _Phrase="lu_select_theme" /></span>
+ <select class="small" size="1" name="ThemeId">
+ <inp:m_list_themes _ItemTemplate="theme_menu/theme_menu_element.tpl" />
+ </select>
+ <input type="submit" value="<inp:m_language _Phrase="lu_button_ok" />" name="go" class="button"></td>
+
+ <td align="right" width="100%" valign="middle">
+ <span class="small"><inp:m_lang_field _Field="LocalName" /></span>&nbsp;
+ <inp:m_list_languages _ItemTemplate="lang_menu/lang_menu_element.tpl" /></td>
+</tr>
+</form>
+</table>
+
+<HR width="760" size="1" noshade align="center">
+
<inp:include _Template="statistics.tpl" />
\ No newline at end of file
Property changes on: trunk/themes/inlink2/header.tpl
___________________________________________________________________
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/browse.php
===================================================================
--- trunk/admin/browse.php (revision 897)
+++ trunk/admin/browse.php (revision 898)
@@ -1,477 +1,478 @@
<?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. ##
##############################################################
//$pathtoroot="";
define('REQUIRE_LAYER_HEADER', 1);
$b_topmargin = "0";
//$b_header_addon = "<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='images/logo_bg.gif'></div><img src='images/spacer.gif' width=1 height=15><br><div style='z-Index:1; position:relative'>";
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");
}
$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";
$browseURL = $adminURL."/browse";
$cssURL = $adminURL."/include";
$indexURL = $rootURL."index.php";
$m_var_list_update["cat"] = 0;
$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');";
unset($m_var_list_update["cat"]);
$envar = "env=" . BuildEnv();
if($objCatList->CurrentCategoryID()>0)
{
$c = $objCatList->CurrentCat();
$upURL = "javascript:AdminCatNav('".$c->Admin_Parent_Link()."');";
}
else
$upURL = $_SERVER["PHP_SELF"]."?".$envar;
//admin only util
$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot.$admin."/include/elements.php");
//require_once ($pathtoroot."kernel/admin/include/navmenu.php");
require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/browse/toolbar.php");
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value."admin/include/parser.php";
if(file_exists($path))
{
//echo "<!-- $path -->";
@include_once($path);
}
}
if(!defined('IS_INSTALL'))define('IS_INSTALL',0);
if(!IS_INSTALL)
{
if (!admin_login())
{
if(!headers_sent())
setcookie("sid"," ",time()-3600);
$objSession->Logout();
header("Location: ".$adminURL."/login.php");
die();
//require_once($pathtoroot."admin/login.php");
}
}
//Set Section
$section = 'in-portal:browse';
//Set Environment Variable
//echo $objCatList->ItemsOnClipboard()." Categories on the clipboard<br>\n";
//echo $objTopicList->ItemsOnClipboard()." Topics on the clipboard<br>\n";
//echo $objLinkList->ItemsOnClipboard()." Links on the clipboard<br>\n";
//echo $objArticleList->ItemsOnClipboard()." Articles on the clipboard<br>\n";
// save last category visited
$objSession->SetVariable('prev_category', $objSession->GetVariable('last_category') );
$objSession->SetVariable('last_category', $objCatList->CurrentCategoryID() );
/* // for testing
$last_cat = $objSession->GetVariable('last_category');
$prev_cat = $objSession->GetVariable('prev_category');
echo "Last CAT: [$last_cat]<br>";
echo "Prev CAT: [$prev_cat]<br>";
*/
$SearchType = $objSession->GetVariable("SearchType");
if(!strlen($SearchType))
$SearchType = "all";
$SearchLabel = "la_SearchLabel";
if( GetVar('SearchWord') !== false ) $objSession->SetVariable('admin_seach_words', GetVar('SearchWord') );
$SearchWord = $objSession->GetVariable('admin_seach_words');
// where should all edit popups submit changes
$objSession->SetVariable("ReturnScript", basename($_SERVER['PHP_SELF']) );
+$charset = GetRegionalOption('Charset');
/* page header */
print <<<END
<html>
<head>
<title>In-portal</title>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="content-type" content="text/html;charset=$charset">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
imagesPath='$imagesURL'+'/';
</script>
END;
require_once($pathtoroot.$admin."/include/mainscript.php");
print <<<END
<script type="text/javascript">
if (window.opener != null) {
theMainScript.CloseAndRefreshParent();
}
</script>
END;
print <<<END
<script src="$browseURL/toolbar.js"></script>
<script src="$browseURL/checkboxes_new.js"></script>
<script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
<link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
<link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
END;
load_module_styles();
if( !isset($list) ) $list = '';
if(($SearchType=="categories" || $SearchType="all") && strlen($list))
{
int_SectionHeader(NULL,NULL,NULL,admin_language("la_Title_SearchResults"));
}
else
int_SectionHeader();
$filter = false; // always initialize variables before use
if($objSession->GetVariable("SearchWord") != '') {
$filter = true;
}
else {
$bit_combo = $objModules->ExecuteFunction('GetModuleInfo', 'all_bitmask');
$bit_combo = $objModules->MergeReturn($bit_combo);
foreach($bit_combo['VarName'] as $mod_name => $VarName)
{
//echo "VarName: [$VarName] = [".$objConfig->Get($VarName)."], ALL = [".$bit_combo['Bits'][$mod_name]."]<br>";
if( $objConfig->Get($VarName) )
if( $objConfig->Get($VarName) != $bit_combo['Bits'][$mod_name] )
{
$filter = true;
break;
}
}
}
?>
</div>
<!-- alex mark -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<div name="toolBar" id="mainToolBar">
<tb:button action="upcat" alt="<?php echo admin_language("la_ToolTip_Up"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="homecat" alt="<?php echo admin_language("la_ToolTip_Home"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="new_cat" alt="<?php echo admin_language("la_ToolTip_New_Category"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="editcat" alt="<?php echo admin_language("la_ToolTip_Edit_Current_Category"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<?php
foreach($NewButtons as $btn)
{
print "<tb:button action=\"".$btn["Action"]."\" alt=\"".$btn["Alt"]."\" ImagePath=\"".$btn["ImagePath"]."\" ";
if(strlen($btn["Tab"])>0)
print "tab=\"".$btn["Tab"]."\"";
print ">\n";
}
?>
<tb:button action="edit" alt="<?php echo admin_language("la_ToolTip_Edit"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="delete" alt="<?php echo admin_language("la_ToolTip_Delete"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="approve" alt="<?php echo admin_language("la_ToolTip_Approve"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="decline" alt="<?php echo admin_language("la_ToolTip_Decline"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="cut" alt="<?php echo admin_language("la_ToolTip_Cut"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="copy" alt="<?php echo admin_language("la_ToolTip_Copy"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="paste" alt="<?php echo admin_language("la_ToolTip_Paste"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="move_up" alt="<?php echo admin_language("la_ToolTip_Move_Up"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="move_down" alt="<?php echo admin_language("la_ToolTip_Move_Down"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="print" alt="<?php echo admin_language("la_ToolTip_Print"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="view" alt="<?php echo admin_language("la_ToolTip_View"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
</div>
</td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" width="100%" bgcolor="#e0e0da" border="0" class="tableborder_full_a">
<tbody>
<tr>
<td><img height="15" src="<?php echo $imagesURL; ?>/arrow.gif" width="15" align="middle" border="0">
<span class="navbar"><?php $attribs["admin"]=1; print m_navbar($attribs); ?></span>
</td>
<td align="right">
<FORM METHOD="POST" ACTION="<?php echo $_SERVER["PHP_SELF"]."?".$envar; ?>" NAME="admin_search" ID="admin_search"><INPUT ID="SearchScope" NAME="SearchScope" type="hidden" VALUE="<?php echo $objSession->GetVariable("SearchScope"); ?>"><INPUT ID="SearchType" NAME="SearchType" TYPE="hidden" VALUE="<?php echo $objSession->GetVariable("SearchType"); ?>"><INPUT ID="NewSearch" NAME="NewSearch" TYPE="hidden" VALUE="0"><INPUT TYPE="HIDDEN" NAME="Action" value="m_Exec_Search">
<table cellspacing="0" cellpadding="0"><tr>
<td><?php echo admin_language($SearchLabel); ?>&nbsp;</td>
<td><input ID="SearchWord" type="text" value="<?php echo inp_htmlize($SearchWord,1); ?>" name="SearchWord" size="10" style="border-width: 1; border-style: solid; border-color: 999999"></td>
<td><img id="imgSearch" action="search_b" src="<?php echo $imagesURL."/toolbar/";?>/icon16_search.gif" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" src="<?php echo $imagesURL."/toolbar/";?>/arrow16.gif" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search.gif'" style="cursor:hand" width="22" width="22"><!--<img action="search_a" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" src="<?php echo $imagesURL."/toolbar/";?>/arrow16.gif" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16.gif'" style="cursor:hand">-->
<img action="search_c" src="<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset.gif" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="document.all.SearchWord.value = ''; this.action = this.getAttribute('action'); actionHandler(this);" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset.gif'" style="cursor:hand" width="22" width="22">&nbsp;
</td>
</tr></table>
</FORM>
<!--tb:button action="search_b" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="right" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="search_a" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="right" ImagePath="<?php echo $imagesURL."/toolbar/";?>"-->
</td>
</tr>
</tbody>
</table>
<?php if ($filter) { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Filter")); ?>
</td>
</tr>
</table>
<?php } ?>
<br>
<!-- CATEGORY DIVIDER -->
<?php
$OrderBy = $objCatList->QueryOrderByClause(TRUE,TRUE,TRUE);
$objCatList->Clear();
$IsSearch = FALSE;
if($SearchType == 'categories' || $SearchType == 'all')
{
$list = $objSession->GetVariable("SearchWord");
$SearchQuery = $objCatList->AdminSearchWhereClause($list);
if(strlen($SearchQuery))
{
$SearchQuery = " (".$SearchQuery.") ";
if( strlen($CatScopeClause) ) {
$SearchQuery .= " AND ParentId = ".$objCatList->CurrentCategoryID();//" AND ".$CatScopeClause;
}
$objCatList->LoadCategories($SearchQuery.$CategoryFilter,$OrderBy);
$IsSearch = TRUE;
}
else
$objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter,$OrderBy);
}
else
$objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter, $OrderBy);
$TotalItemCount += $objCatList->QueryItemCount;
?>
<?php
$e = $Errors->GetAdminUserErrors();
if(count($e)>0)
{
echo "<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" border=\"0\">";
for($ex = 0; $ex<count($e);$ex++)
{
echo "<tr><td width=\100%\" class=\"error\">".prompt_language($e[$ex])."</td></tr>";
}
echo "</TABLE><br>";
}
?>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td width="138" height="20" nowrap="nowrap" class="active_tab" onclick="toggleCategoriesB(this)" id="cats_tab">
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td id="l_cat" background="<?php echo $imagesURL; ?>/itemtabs/tab_active_l.gif" class="left_tab">
<img src="<?php echo $imagesURL; ?>/itemtabs/divider_up.gif" width="20" height="20" border="0" align="absmiddle">
</td>
<td id="m_cat" nowrap background="<?php echo $imagesURL; ?>/itemtabs/tab_active.gif" class="tab_class">
<?php echo admin_language("la_ItemTab_Categories"); ?>:&nbsp;
</td>
<td id="m1_cat" align="right" valign="top" background="<?php echo $imagesURL; ?>/itemtabs/tab_active.gif" class="tab_class">
<span class="cats_stats">(<?php echo $objCatList->QueryItemCount; ?>)</span>&nbsp;
</td>
<td id="r_cat" background="<?php echo $imagesURL; ?>/itemtabs/tab_active_r.gif" class="right_tab">
<img src="<?php echo $imagesURL; ?>/spacer.gif" width="21" height="20">
</td>
</tr>
</table>
</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<div class="divider" style="" id="categoriesDevider"><img width="1" height="1" src="<?php echo $imagesURL; ?>/spacer.gif"></div>
</DIV>
</div>
<DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index:0" id="firstContainer">
<DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index:2" id="secondContainer">
<!-- CATEGORY OUTPUT START -->
<div id="categories" tabtitle="Categories">
<form id="categories_form" name="categories_form" action="" method="post">
<input type="hidden" name="Action">
<?php
if($IsSearch)
{
$template = "cat_search_element.tpl";
}
else {
$template = "cat_element.tpl";
}
print adListSubCats($objCatList->CurrentCategoryID(),$template);
?>
</form>
</div>
<BR>
<!-- CATEGORY OUTPUT END -->
<?php
print $ItemTabs->TabRow();
if(count($ItemTabs->Tabs))
{
?>
<div class="divider" id="tabsDevider"><img width=1 height=1 src="images/spacer.gif"></div>
<?php
}
?>
</DIV>
<?php
unset($m);
$m = GetModuleArray("admin");
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value."admin/browse.php";
if(file_exists($path))
{
//echo "\n<!-- $path -->\n";
include_once($path);
}
}
?>
<form method="post" action="browse.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>
</DIV>
<!-- END CODE-->
<script language="JavaScript">
InitPage();
cats_on = theMainScript.GetCookie('cats_tab_on');
if (cats_on == 0) {
toggleCategoriesB(document.getElementById('cats_tab'), true);
}
tabs_on = theMainScript.GetCookie('tabs_on');
if (tabs_on == '1' || tabs_on == null) {
if(default_tab.length == 0 || default_tab == 'categories' )
{
cookie_start = theMainScript.GetCookie('active_tab');
if (cookie_start != null) start_tab = cookie_start;
if(start_tab!=null) {
//alert('ok');
toggleTabB(start_tab, true);
}
}
else
{
//alert('ok');
toggleTabB(default_tab,true);
}
}
d = document.getElementById('SearchWord');
if(d)
{
d.onkeyup = function(event) {
if(window.event.keyCode==13)
{
var el = document.getElementById('imgSearch');
el.onclick();
}
}
}
</script>
<?php
$objSession->SetVariable("HasChanges", 0);
int_footer();
?>
\ No newline at end of file
Property changes on: trunk/admin/browse.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/login.php
===================================================================
--- trunk/admin/login.php (revision 897)
+++ trunk/admin/login.php (revision 898)
@@ -1,122 +1,129 @@
<?php
$pathtoimage = $pathtoroot . $admin."/images";
if (function_exists("admin_language"))
{
$login_text = admin_language("la_Login");
$login_button = admin_language("la_Login");
$username_text = admin_language("la_Text_Login");
$password_title = admin_language("la_prompt_Password");
$cancel_button = admin_language("la_Cancel");
}
else
{
$login_text = "Login";
$login_button = "Login";
$username_text = "Username";
$password_title = "Password";
$cancel_button = "Cancel";
}
if( !function_exists('GetVar') )
{
function GetVar($name)
{
return isset($_REQUEST[$name]) ? $_REQUEST[$name] : false;
}
}
//echo "<pre>"; print_r($objSession); echo "</pre>";
if ( GetVar('expired') == 1 && GetVar('logout') != 1) {
if (function_exists("admin_language")) {
$login_error = admin_language("la_text_sess_expired");
}
else {
$login_error = "Session Expired";
}
}
-
+if( function_exists('GetRegionalOption') )
+{
+ $charset = GetRegionalOption('Charset');
+}
+else
+{
+ $charset == 'iso-8859-1';
+}
print<<<END
<html>
<head>
<script language="JavaScript">
function redirect()
{
window.name = 'redirect';
var i = 0;
//var a_parent = window.parent;
while (i < 10) {
if (window.parent.name == 'main_frame') break;
a_parent = window.parent;
i++;
}
page = a_parent.location.href + '?expired=1';
if (i < 10)
setTimeout('a_parent.location.href=page',100);
}
</script>
<title>In-Portal :: Administration Panel</title>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=$charset">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<link rel="stylesheet" href="include/style.css" type="text/css">
<META http-equiv="Pragma" content="no-cache">
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="document.form1.login.focus();">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td valign="middle" align="center">
<div align="center">
<img alt="In-portal" src="images/globe.gif" width="84" height="91" border="0">
<img alt="In-portal" src="images/logo.gif" width="150" height="91" border="0"><br>
<table border="0" cellpadding="2" cellspacing="0" class="tableborder_full" width="222" height="30">
<tr>
<TD align="right" valign="top" class="tablenav" width ="220" nowrap height=30 background="images/tabnav_left.jpg">
<span STYLE="float: left;">
<img src="icons/icon24_lock_login.gif" width="16" height="22" alt="" border="0" align="absmiddle"> $login_text
</span>
<a href="help/manual.pdf"><img src="images/blue_bar_help.gif" border="0"></a>
</TD>
</tr>
</table>
<table width="222" border="0" cellspacing="0" cellpadding="4" class="tableborder">
<form name="form1" method="post" action="index.php" target="_top">
<tr bgcolor="#F0F0F0">
<td class="text">$username_text</td>
<td><input type="text" name="login" class="text"></td>
</tr>
<tr bgcolor="#F0F0F0">
<td class="text">$password_title</td>
<td><input type="password" name="password" class="text"></td>
</tr>
<tr bgcolor="#F0F0F0">
<td colspan="2">
<div align="left">
<input type="submit" name="submit" value="$login_button" class="button">
<input type="reset" name="Cancel" value="$cancel_button" class="button">
<input type=hidden name="adminlogin" value="1" />
</div>
</td>
</tr>
</form>
</table>
<br>
<p class="error">
$login_error</p>
</td>
</tr>
</table>
<script>
var a_parent = window.parent;
redirect();
</script>
</body>
</html>
END;
exit();
?>
\ No newline at end of file
Property changes on: trunk/admin/login.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/tree/tree.php
===================================================================
--- trunk/admin/tree/tree.php (revision 897)
+++ trunk/admin/tree/tree.php (revision 898)
@@ -1,175 +1,177 @@
<?php
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;
}
require_once($pathtoroot."kernel/startup.php");
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
$pathtolocal = $pathtoroot;
$envar = "env=" . BuildEnv();
//include section data; create Section hash
//main In-portal sections
//require_once ($pathtoroot."admin/include/navmenu.php");
//All modules
/*if(!isset($SysData))
$SysData=new SystemConfiguration();
$ModuleList=$SysData->GetModuleList();*/
//$sections = array();
//foreach($mod_prefix as $key => $value)
//{
// $mod = $pathtoroot . $value . "admin/include/navmenu.php";
// include_once($mod);
//}
include_once($pathtoroot.$admin."/include/sections.php");
$ServerName = $objConfig->Get("Site_Name");
$rootLink = $adminURL."/subitems.php?env=".BuildEnv()."&section=in-portal:root";
+$charset = GetRegionalOption('Charset');
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="<?php echo $adminURL."/include/style.css"; ?>">
+<meta http-equiv="content-type" content="text/html;charset=<?php echo $charset; ?>">
<script src="ua.js"></script>
<script src="ftiens4.js"></script>
<script language="javascript">
// Decide if the names are links or just the icons
USETEXTLINKS = 1 //replace 0 with 1 for hyperlinks
// Decide if the tree is to start all open or just showing the root folders
STARTALLOPEN = 0 //replace 0 with 1 to show the whole tree
var foldersTree = gFld('In-Portal','<?php echo $rootLink; ?>');
foldersTree.desc = '<?php echo $ServerName; ?>';
foldersTree.iconSrc='<?php echo $adminURL."/icons/icon24_site.gif"; ?>';
function credits(url)
{
var width = 200;
var height = 200;
var screen_x = (screen.availWidth-width)/2;
var screen_y = (screen.availHeight-height)/2;
window.open(url, 'credits', 'width=280,height=520,left='+screen_x+',top='+screen_y);
}
<?php
$objSections->BuildTree('in-portal:site', 'foldersTree');
$title = "In-Portal v ".$kernel_version."&nbsp;&nbsp;";
?>
</script>
</head>
<body topmargin="0" marginheight="0" marginwidth="0" marginheight="0" bgcolor="#DCEBF6">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<!--<tr><td colspan="2" bgcolor="black"><img alt="" width="1" height="1" src="images/spacer.gif"></td></tr>-->
<tr>
<td background="../images/menu_bar.gif" align="left" class="tree_head" width="80%"> <!-- 60000 -->
&nbsp;<a class="tree_head_credits" href="javascript:credits('<?php echo $rootURL.$admin."/help/credits.php?env=".BuildEnv();?>&destform=popup');"><?php echo $title; ?></a>
</td>
<td background="../images/menu_bar.gif" align="right" class="tree_head" width="20%"> <!-- 40000 -->
<FORM style="display:inline" name="lang_select" method="POST" action="<?php echo $rootURL.$admin."/index.php?env=".BuildEnv(); ?>" TARGET="main_frame">
<SELECT NAME="langselect" style="width: 62px; border: 0px; background-color: #FFFFFF; font-size: 9px; color: black" onchange="document.lang_select.submit()">
<!-- width: 52px; font-size: 8.5px; -->
<?php
$objLanguages->Query_Item("SELECT * FROM ".$objLanguages->SourceTable." WHERE Enabled=1");
foreach($objLanguages->Items as $l)
{
$selected = "";
if($l->Get("LanguageId")==$m_var_list["lang"])
$selected = " SELECTED";
echo "<OPTION onclick=\"this.form.submit();\" value=\"".$l->Get("LanguageId")."\" $selected>".$l->Get("LocalName")."</OPTION>\n";
}
?>
</SELECT>
<input type=hidden name="Action" value="m_lang_select">
</FORM>
</td>
<td background="../images/menu_bar.gif"><img alt="" height="21" width="1" src="../images/spacer.gif"></td>
</tr>
</table>
<table cellpadding="5" cellspacing="0" border="0">
<tr>
<td>
<script>
initializeDocument();
</script>
</td>
</tr>
</table>
</body>
</html>
Property changes on: trunk/admin/tree/tree.php
___________________________________________________________________
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/users/user_addimage.php
===================================================================
--- trunk/admin/users/user_addimage.php (revision 897)
+++ trunk/admin/users/user_addimage.php (revision 898)
@@ -1,352 +1,352 @@
<?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;
//print_r($_GET);
//print_r($_POST);
require_once($pathtoroot."kernel/startup.php");
//admin only util
/* set the destination of the image upload, relative to the root path */
$DestDir = "kernel/images/";
$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";
$cssURL = $adminURL."/include";
$browseURL = $adminURL."/browse";
$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");;
require_once($pathtoroot.$admin."/browse/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);
unset($objEditItems);
$objEditItems = new clsImageList();
$objEditItems->SourceTable = $objSession->GetEditTable("Images");
if(isset($_POST["itemlist"]))
{
if(is_array($_POST["itemlist"]))
{
$ImageId = $_POST["itemlist"][0];
}
else
{
$ImageId = $_POST["itemlist"];
}
$img = $objEditItems->GetItem($ImageId);
// print_r($img);
$action = "m_img_edit";
$name = $img->Get("Name");
}
else
{
$img = new clsImage();
$img->Set("ResourceId",$c->Get("ResourceId"));
$action = "m_img_add";
$name = "'New Image'";
}
$envar = "env=" . BuildEnv() . "&en=$en";
$section = 'in-portal:edituser_image';
$ado = &GetADODBConnection();
-
+$charset = GetRegionalOption('Charset');
/* page header */
print <<<END
<html>
<head>
<title>In-portal</title>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="content-type" content="text/html;charset=$charset">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
imagesPath='$imagesURL'+'/';
</script>
<script src="$browseURL/common.js"></script>
<script src="$browseURL/toolbar.js"></script>
<script src="$browseURL/utility.js"></script>
<script src="$browseURL/checkboxes.js"></script>
<script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
<link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
<link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
END;
$title = GetTitle("la_Text_User", "la_Text_General", $c->Get('PortalUserId'), $c->Get('Login'));//prompt_language("la_Text_Editing")." ".prompt_language("la_Text_User")." '".$c->Get("Login")."' - ".prompt_language("la_Text_Image");
$title .= " '".$name."'";
$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('user','UserEditStatus','".$admin."/users/adduser_images.php',0);",$imagesURL."/toolbar/tool_select.gif");
$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('user','UserEditStatus','".$admin."/users/adduser_images.php',-1);",$imagesURL."/toolbar/tool_cancel.gif");
//echo "<pre>"; print_r($objCatToolBar); echo "</pre>";
int_header($objCatToolBar,NULL,$title);
if ($objSession->GetVariable("HasChanges") == 1) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Save_Item")); ?>
</td>
</tr>
</table>
<?php } ?>
<TABLE cellSpacing="0" cellPadding="2" width="100%" class="tableborder">
<FORM enctype="multipart/form-data" ID="user" NAME="user" method="POST" ACTION="">
<?php int_subsection_title(prompt_language("la_Text_Image")); ?>
<TR <?php int_table_color(); ?> >
<TD><?php echo prompt_language("la_prompt_ImageId"); ?></TD>
<TD><?php if ($img->Get("ImageId") != -1) echo $img->Get("ImageId"); ?></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><SPAN class="text" id="prompt_imgName"><?php echo prompt_language("la_prompt_Name"); ?></SPAN></TD>
<TD><input type=text NAME="imgName" ValidationType="exists" tabindex="1" size="30" VALUE="<?php echo inp_htmlize($img->parsetag("image_name")); ?>"></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><SPAN class="text" id="prompt_imgAlt"><?php echo prompt_language("la_prompt_AltName"); ?></SPAN></TD>
<TD><input type=text NAME="imgAlt" ValidationType="exists" size="30" tabindex="2" VALUE="<?php echo inp_htmlize($img->parsetag("image_alt")); ?>"></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><?php echo prompt_language("la_prompt_Status"); ?></TD>
<TD>
<input type=RADIO NAME="imgEnabled" tabindex="3" <?php if($img->Get("Enabled")==1) echo "CHECKED"; ?> VALUE="1"><?php echo prompt_language("la_Text_Enabled"); ?>
<input type=RADIO NAME="imgEnabled" tabindex="3" <?php if($img->Get("Enabled")==0) echo "CHECKED"; ?> VALUE="0"><?php echo prompt_language("la_Text_Disabled"); ?>
</TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><?php echo prompt_language("la_prompt_Primary"); ?></TD>
<TD><input type=checkbox NAME="imgDefault" tabindex="4" <?php if($img->Get("DefaultImg")==1) echo "CHECKED"; ?> VALUE="1"></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><?php echo prompt_language("la_prompt_Priority"); ?></TD>
<TD><input type=text SIZE="5" NAME="imgPriority" tabindex="5" VALUE="<?php echo $img->Get("Priority"); ?>"></TD>
<TD></TD>
</TR>
<?php int_subsection_title(prompt_language("la_text_Thumbnail_Image")); ?>
<TR <?php int_table_color(); ?> >
<TD><?php echo prompt_language("la_prompt_Location"); ?></TD>
<?php
if($img->Get("LocalThumb")==1 || strlen($img->Get("LocalThumb"))==0)
{
$local="checked";
$remote = "";
}
else
{
$remote="checked";
$local = "";
}
?>
<TD>
<TABLE border=0>
<tr>
<TD>
<input type="radio" name="imgLocalThumb" tabindex="6" <?php echo $local; ?> VALUE="1"><?php echo prompt_language("la_prompt_upload"); ?>:
</td>
<td>
<input type=FILE NAME="imgThumbFile" tabindex="7" VALUE=""> <br />
</td>
</tr>
<tr>
<td>
<input type="radio" name="imgLocalThumb" tabindex="6" <?php echo $remote; ?> VALUE="0"> <?php echo prompt_language("la_prompt_remote_url"); ?>:
</td>
<td>
<input type=text size=32 NAME="imgThumbUrl" tabindex="8" VALUE="<?php echo $img->Get("ThumbUrl"); ?>"> <br />
</td>
</tr>
</table>
</TD>
<TD ALIGN="RIGHT">
<IMG SRC="<?php echo $img->ThumbURL(); ?>">
</TD>
</TR>
<?php int_subsection_title(prompt_language("la_Text_Full_Size_Image")); ?>
<TR <?php int_table_color(); ?>>
<TD><?php echo prompt_language("la_text_Same_As_Thumbnail"); ?></TD>
<?php
if(($img->Get("SameImages")=="1") || !$img->Get("ImageId") || ($img->Get("ImageId") == "-1"))
{
$checked = "CHECKED";
$disabled = "DISABLED=\"true\"";
}
?>
<TD><input type=checkbox id="imgSameImages" NAME="imgSameImages" tabindex="9" VALUE="1" <?php echo $checked; ?> ONCLICK="enableFullImage(this);"></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?>>
<TD><?php echo prompt_language("la_prompt_Location"); ?></TD>
<?php
if($img->Get("LocalImage")==1 || strlen($img->Get("LocalImage"))==0)
{
$local="checked";
$remote = "";
}
else
{
$remote="checked";
$local = "";
}
?>
<TD>
<TABLE border=0>
<tr>
<TD>
<input id="full1" type="radio" name="imgLocalFull" tabindex="10" <?php echo $local; ?> VALUE="1"><?php echo prompt_language("la_prompt_upload"); ?>:
</td>
<td>
<input type=FILE ID="imgFullFile" NAME="imgFullFile" tabindex="11" VALUE=""> <br />
</td>
</tr>
<tr>
<td>
<input id="full2" type="radio" name="imgLocalFull" tabindex="10" <?php echo $remote; ?> VALUE="0"> <?php echo prompt_language("la_prompt_remote_url"); ?>:
</td>
<td>
<input type=text size=32 ID="imgFullUrl" tabindex="12" NAME="imgFullUrl" VALUE="<?php echo $img->Get("Url"); ?>"> <br />
</td>
</tr>
</table>
</td>
<TD ALIGN="RIGHT">
<IMG SRC="<?php echo $img->FullURL(); ?>">
</TD>
</TR>
<input type=hidden NAME="Action" VALUE="<?php echo $action; ?>">
<input type="hidden" name="UserEditStatus" VALUE="0">
<input type="hidden" name="DestDir" VALUE="<?php echo $DestDir; ?>">
<INPUT TYPE="hidden" NAME="ImageId" VALUE="<?php echo $img->Get("ImageId"); ?>">
<input TYPE="HIDDEN" NAME="ResourceId" VALUE="<?php echo $c->Get("ResourceId"); ?>">
</FORM>
</TABLE>
<!-- CODE FOR VIEW MENU -->
<form method="post" action="user_groups.php?<?php echo $envar; ?>" name="viewmenu">
<input type="hidden" name="fieldname" value="">
<input type="hidden" name="varvalue" value="">
<input type="hidden" name="varvalue2" value="">
<input type="hidden" name="Action" value="">
</form>
<script language="JavaScript">
enableFullImage(document.getElementById('imgSameImages'));
MarkAsRequired(document.getElementById("user"));
</script>
<!-- END CODE-->
<?php int_footer(); ?>
Property changes on: trunk/admin/users/user_addimage.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.7
\ No newline at end of property
Index: trunk/admin/relation_select.php
===================================================================
--- trunk/admin/relation_select.php (revision 897)
+++ trunk/admin/relation_select.php (revision 898)
@@ -1,401 +1,402 @@
<?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. ##
##############################################################
//$b_topmargin = "0";
$hideSelectAll = true;
$b_header_addon = "<DIV style='position:relative; z-Index: 1; background-color: #ffffff; padding-top:1px;'><div style='z-Index:1; position:relative'>";
//$pathtoroot="";
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";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
$browseURL = $adminURL."/browse";
$cssURL = $adminURL."/include";
$m_var_list_update["cat"] = 0;
$homeURL = $_SERVER["PHP_SELF"]."?env=".BuildEnv();
unset($m_var_list_update["cat"]);
$envar = "env=" . BuildEnv();
if($objCatList->CurrentCategoryID()>0)
{
$c = $objCatList->CurrentCat();
$upURL = $c->Admin_Parent_Link();
}
else
$upURL = $_SERVER["PHP_SELF"]."?".$envar;
//admin only util
$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot.$admin."/include/elements.php");
//require_once ($pathtoroot."kernel/admin/include/navmenu.php");
require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/browse/toolbar.php");
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value."admin/include/parser.php";
if(file_exists($path))
{
//echo "<!-- $path -->";
@include_once($path);
}
}
//Set Section
$section = 'in-portal:editcategory_relationselect';
$Selector = GetVar('Selector');
if(!$Selector) $Selector = 'checkbox';
//Set Environment Variable
//echo $objCatList->ItemsOnClipboard()." Categories on the clipboard<br>\n";
//echo $objTopicList->ItemsOnClipboard()." Topics on the clipboard<br>\n";
//echo $objLinkList->ItemsOnClipboard()." Links on the clipboard<br>\n";
//echo $objArticleList->ItemsOnClipboard()." Articles on the clipboard<br>\n";
$SearchType = $objSession->GetVariable("SearchType");
if(!strlen($SearchType))
$SearchType = "Categories";
$SearchLabel = "la_SearchLabel";
/* page header */
+$charset = GetRegionalOption('Charset');
print <<<END
<html>
<head>
<title>In-portal</title>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="content-type" content="text/html;charset=$charset">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
imagesPath='$imagesURL'+'/';
</script>
END;
require_once($pathtoroot.$admin."/include/mainscript.php");
load_module_styles();
print <<<END
<script src="$browseURL/toolbar.js"></script>
<script src="$browseURL/checkboxes_new.js"></script>
<script language="JavaScript1.2">
var enableContextMenus= true;
var doubleClickAction = 'select';
function toggleTabB(tabId, atm)
{
var hl = document.getElementById("hidden_line");
var activeTabId;
if (activeTab) activeTabId = activeTab.id;
if (activeTabId == tabId)
{
var devider = document.getElementById("tabsDevider");
devider.style.display = "";
unselectAll(tabId);
var tab = document.getElementById(tabId);
tab.active = false;
activeTab = null;
collapseTab = tab;
toolbar.setTab(null);
showTab();
}
else
{
if (activeTab)
toggleTab(tabId, true)
else
toggleTab(tabId, atm)
if (hl) hl.style.display = "none";
}
tab_hdr = document.getElementById('tab_headers');
if (!tab_hdr) return;
// process all module tabs
var active_str = '';
for(var i = 0; i < tabIDs.length; i++)
{
var tabHeader;
TDs = tab_hdr.getElementsByTagName("TD");
for (var j = 0; j < TDs.length; j++)
if (TDs[j].getAttribute("tabHeaderOf") == tabIDs[i])
{
tabHeader = TDs[j];
break;
}
if (!tabHeader) continue;
var tab = document.getElementById(tabIDs[i]);
if (!tab) continue;
active_str = (tab.active) ? "tab_active" : "tab_inactive";
if (TDs[j].getAttribute("tabHeaderOf") == tabId) {
// module tab is selected
SetBackground('l_' + tabId, "$imagesURL/itemtabs/" + active_str + "_l.gif");
SetBackground('m_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('m1_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('r_' + tabId, "$imagesURL/itemtabs/" + active_str + "_r.gif");
}
else
{
// module tab is not selected
SetBackground('l_' +tabIDs[i], "$imagesURL/itemtabs/" + active_str + "_l.gif");
SetBackground('m_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('m1_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('r_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + "_r.gif");
}
var images = tabHeader.getElementsByTagName("IMG");
if (images.length < 1) continue;
images[0].src = "$imagesURL/itemtabs/" + ((tab.active) ? "divider_up" : "divider_empty") + ".gif";
}
}
function toggleCategoriesB(tabHeader, instant)
{
var categories = document.getElementById('categories');
if (!categories) return;
toggleCategories(instant);
var active_str = '$imagesURL'+'/itemtabs/' + (categories.active ? 'tab_active' : 'tab_inactive');
SetBackground('l_cat', active_str + '_l.gif');
SetBackground('m_cat', active_str + '.gif');
SetBackground('m1_cat', active_str + '.gif');
SetBackground('r_cat', active_str + '_r.gif');
var images = tabHeader.getElementsByTagName("IMG");
if (images.length < 1) return;
images[0].src = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "divider_up" : "divider_dn") + ".gif";
}
</script>
<script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
<link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
<link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
END;
int_SectionHeader();
?>
</DIV>
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<div name="toolBar" id="mainToolBar">
<tb:button action="select" alt="<?php echo admin_language("la_ToolTip_Select"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="stop" alt="<?php echo admin_language("la_ToolTip_Stop"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="upcat" alt="<?php echo admin_language("la_ToolTip_Up"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="homecat" alt="<?php echo admin_language("la_ToolTip_Home"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="view" alt="<?php echo admin_language("la_ToolTip_View"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
</div>
</td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" width="100%" bgcolor="#e0e0da" border="0" class="tableborder_full_a">
<tbody>
<tr>
<td><img height="15" src="<?php echo $imagesURL; ?>/arrow.gif" width="15" align="middle" border="0">
- <span class="navbar"><?php print m_navbar(1); ?></span>
+ <span class="navbar"><?php print m_navbar( Array('admin' => 1) ); ?></span>
</td>
<td align="right">
<FORM METHOD="POST" ACTION="<?php echo $_SERVER["PHP_SELF"]."?".$envar; ?>" NAME="admin_search" ID="admin_search">
<INPUT ID="SearchScope" NAME="SearchScope" type="hidden" VALUE="<?php echo $objSession->GetVariable("SearchScope"); ?>">
<INPUT ID="SearchType" NAME="SearchType" TYPE="hidden" VALUE="<?php echo $objSession->GetVariable("SearchType"); ?>">
<INPUT ID="NewSearch" NAME="NewSearch" TYPE="hidden" VALUE="0"><INPUT TYPE="HIDDEN" NAME="Action" value="m_Exec_Search">
<input type="hidden" name="Selector" value="<?php echo $Selector; ?>">
<table cellspacing="0" cellpadding="0"><tr>
<td><?php echo admin_language($SearchLabel); ?>&nbsp;</td>
<td><input ID="SearchWord" type="text" name="SearchWord" size="10" style="border-width: 1; border-style: solid; border-color: #999999"></td>
<td><img action="search_b" src="<?php echo $imagesURL."/toolbar/";?>/icon16_search.gif" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" src="<?php echo $imagesURL."/toolbar/";?>/arrow16.gif" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search.gif'" style="cursor:hand" width="22" width="22"><img action="search_a" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" src="<?php echo $imagesURL."/toolbar/";?>/arrow16.gif" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16.gif'" style="cursor:hand">
<img action="search_c" src="<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset.gif" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset.gif'" style="cursor:hand" width="22" width="22">&nbsp;
</td>
</tr></table>
</FORM>
<!--tb:button action="search_b" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="right" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="search_a" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="right" ImagePath="<?php echo $imagesURL."/toolbar/";?>"-->
</td>
</tr>
</tbody>
</table>
<br>
<!-- CATEGORY DIVIDER -->
<?php
$objCatList->Clear();
$OrderBy = $objCatList->QueryOrderByClause(TRUE,TRUE,TRUE);
if($SearchType=="categories" || $SearchType="all")
{
$list = $objSession->GetVariable("SearchWord");
$SearchQuery = $objCatList->AdminSearchWhereClause($list);
if(strlen($SearchQuery))
{
$SearchQuery = " (".$SearchQuery.") ";
$objCatList->LoadCategories($SearchQuery.$CategoryFilter,$OrderBy);
}
else
$objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter,$OrderBy);
}
else
$objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter,$OrderBy);
?>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td width="138" height="20" nowrap="nowrap" class="active_tab" onclick="toggleCategoriesB(this)" id="cats_tab">
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td id="l_cat" background="<?php echo $imagesURL; ?>/itemtabs/tab_active_l.gif" class="left_tab">
<img src="<?php echo $imagesURL; ?>/itemtabs/divider_up.gif" width="20" height="20" border="0" align="absmiddle">
</td>
<td id="m_cat" nowrap background="<?php echo $imagesURL; ?>/itemtabs/tab_active.gif" class="tab_class">
<?php echo admin_language("la_ItemTab_Categories"); ?>:&nbsp;
</td>
<td id="m1_cat" align="right" valign="top" background="<?php echo $imagesURL; ?>/itemtabs/tab_active.gif" class="tab_class">
<span class="cats_stats">(<?php echo $objCatList->QueryItemCount; ?>)</span>&nbsp;
</td>
<td id="r_cat" background="<?php echo $imagesURL; ?>/itemtabs/tab_active_r.gif" class="right_tab">
<img src="<?php echo $imagesURL; ?>/spacer.gif" width="21" height="20">
</td>
</tr>
</table>
</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<div class="divider" style="" id="categoriesDevider"><img width=1 height=1 src="images/spacer.gif"></div>
</DIV>
<DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index:0" id="firstContainer">
<DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index: 2" id="secondContainer">
<!-- CATEGORY OUTPUT START -->
<div id="categories" tabtitle="Categories">
<form id="categories_form" name="categories_form" action="" method="post">
<input type="hidden" name="Action">
<?php print adListSubCats($objCatList->CurrentCategoryID(),"cat_select_element.tpl"); ?>
</form>
</div>
<!-- CATEGORY OUTPUT END -->
<br>
<?php
print $ItemTabs->TabRow();
?>
<div class="divider" id="tabsDevider"><img width=1 height=1 src="images/spacer.gif"></div>
</DIV>
<?php
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value."admin/relation_select.php";
if(file_exists($path))
{
echo "\n<!-- $path -->\n";
include_once($path);
}
}
?>
<form 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>
</DIV>
<!-- END CODE-->
<script language="JavaScript">
<?php
if( GetVar('Selector') == 'radio' )
echo " var single_select = true;";
?>
InitPage();
//toggleTabB(start_tab, true);
</script>
<?php int_footer(); ?>
Property changes on: trunk/admin/relation_select.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/category/addpermission_modules.php
===================================================================
--- trunk/admin/category/addpermission_modules.php (revision 897)
+++ trunk/admin/category/addpermission_modules.php (revision 898)
@@ -1,293 +1,294 @@
<?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;
}
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";
$cssURL = $adminURL."/include";
$browseURL = $adminURL."/browse";
//$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."/browse/toolbar.php");
require_once($pathtoroot.$admin."/listview/listview.php");
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot. $value."admin/include/parser.php";
if(file_exists($path))
{
include_once($path);
}
}
unset($objEditItems);
$objEditItems = new clsCatList();
$objEditItems->SourceTable = $objSession->GetEditTable("Category");
//Multiedit init
$en = (int)$_GET["en"];
$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable);
$itemcount=$objEditItems->NumItems();
if(isset($_GET["en"]))
{
$c = $objEditItems->GetItemByIndex($en);
}
else
{
$c = new clsCategory($m_var_list["cat"]);
}
if(!is_object($c))
{
$c = new clsCategory();
$c->Set("CategoryId",0);
}
if($itemcount>1)
{
if ($en+1 == $itemcount)
$en_next = -1;
else
$en_next = $en+1;
if ($en == 0)
$en_prev = -1;
else
$en_prev = $en-1;
}
$action = "m_edit_permissions";
$envar = "env=" . BuildEnv() . "&en=$en";
//$section = 'in-portal:editcategory_permissions';
$section = 'in-portal:catperm_modules';
if(count($_POST))
{
if($_POST["Action"]=="m_edit_permissions")
{
$GroupId = $_POST["GroupId"];
$g = $objGroups->GetItem($GroupId);
}
else
{
if(!is_array($_POST["itemlist"]))
{
$g = $objGroups->GetItemByField("ResourceId", $_POST["itemlist"]);
if(is_object($g))
$GroupId = $g->Get("GroupId");
}
else
{
$g = $objGroups->GetItemByField("ResourceId", $_POST["itemlist"][0]);
$GroupId = $g->Get("GroupId");
}
}
}
else
{
$GroupId = $_GET["GroupId"];
$g = $objGroups->GetItem($GroupId);
}
$objPermList = new clsPermList($c->Get("CategoryId"),$GroupId);
$ado = &GetADODBConnection();
$sql = "SELECT DISTINCT(ModuleId) FROM ".GetTablePrefix()."PermissionConfig";
$rs = $ado->Execute($sql);
$Modules = array();
while($rs && !$rs->EOF)
{
$data = $rs->fields;
$Modules[] = $data["ModuleId"];
$rs->MoveNext();
}
/* page header */
+$charset = GetRegionalOption('Charset');
print <<<END
<html>
<head>
<title>In-portal</title>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="content-type" content="text/html;charset=$charset">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
imagesPath='$imagesURL'+'/';
</script>
<script src="$browseURL/common.js"></script>
<script src="$browseURL/toolbar.js"></script>
<script src="$browseURL/utility.js"></script>
<script src="$browseURL/checkboxes.js"></script>
<script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
<link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
<link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
END;
//int_SectionHeader();
if($c->Get("CategoryId")!=0)
{
$title = admin_language("la_Text_Editing")." ".admin_language("la_Text_Category")." '".$c->Get("Name")."' - ".admin_language("la_tab_Permissions");
$title .= " ".admin_language("la_text_for")." '".$g->parsetag("group_name")."'";
}
else
{
$title = admin_language("la_Text_Editing")." ".admin_language("la_Text_Root")." ".admin_language("la_Text_Category")." - "."' - ".admin_language("la_tab_Permissions");
$title .= " ".admin_language("la_text_for")." '".$g->parsetag("group_name")."'";
}
$objListToolBar = new clsToolBar();
$objListToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('category','CatEditStatus','$admin/category/addcategory_permissions.php',0);",$imagesURL."/toolbar/tool_select.gif");
$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('category','CatEditStatus','".$admin."/category/addcategory_permissions.php',-1);", $imagesURL."/toolbar/tool_cancel.gif");
$sec =& $objSections->GetSection($section);
if($c->Get("CategoryId")==0)
{
$sec->Set("left",NULL);
$sec->Set("right",NULL);
}
int_header($objListToolBar,NULL,$title);
if ($objSession->GetVariable("HasChanges") == 1) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Save_Item")); ?>
</td>
</tr>
</table>
<?php } ?>
<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"><?php echo admin_language("la_Prompt_CategoryPermissions"); ?></span>
</td>
</TR>
</TBODY>
</TABLE>
<TABLE CELLPADDING=0 CELLSPACING=0 class="tableborder" width="100%">
<TBODY>
<FORM ID="category" NAME="category" method="POST" ACTION="">
<?php
for($i=0;$i<count($Modules);$i++)
{
$module = $Modules[$i];
if($module != "Admin" && $module != "Front")
{
echo "<TR ".int_table_color_ret().">";
echo "<TD><IMG src=\"".$imagesURL."/itemicons/icon16_permission.gif\"> ";
$getvar = "?env=".BuildEnv()."&module=$module&GroupId=$GroupId&en=".GetVar('en');
echo "<A class=\"NAV_URL\" HREF=\"".$adminURL."/category/addpermission.php$getvar\">$module</A></TD>";
echo "</TR>";
}
}
?>
</TBODY>
</TABLE>
<input type="hidden" name="ParentId" value="<?php echo $c->Get("ParentId"); ?>">
<input type="hidden" name="CategoryId" value="<?php echo $c->parsetag("cat_id"); ?>">
<input type="hidden" name="GroupId" value ="<?php echo $GroupId; ?>">
<input type="hidden" name="Action" value="<?php echo $action; ?>">
<input type="hidden" name="CatEditStatus" VALUE="0">
</FORM>
<FORM NAME="save_edit_buttons" ID="save_edit_buttons" method="POST" ACTION="">
<tr <?php int_table_color(); ?>>
<td colspan="3">
<input type=hidden NAME="Action" VALUE="save_cat_edit">
</td>
</tr>
</FORM>
<!-- CODE FOR VIEW MENU -->
<form method="post" action="user_groups.php?<?php echo $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>
<!-- END CODE-->
<?php int_footer(); ?>
Property changes on: trunk/admin/category/addpermission_modules.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/category/addimage.php
===================================================================
--- trunk/admin/category/addimage.php (revision 897)
+++ trunk/admin/category/addimage.php (revision 898)
@@ -1,355 +1,356 @@
<?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;
//print_r($_GET);
//print_r($_POST);
require_once($pathtoroot."kernel/startup.php");
//admin only util
/* set the destination of the image upload, relative to the root path */
$DestDir = "kernel/images/";
$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";
$cssURL = $adminURL."/include";
$browseURL = $adminURL."/browse";
//$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
//require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/browse/toolbar.php");
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($objEditCat);
$objEditCat = new clsCatList();
$objEditCat->SourceTable = $objSession->GetEditTable("Category");
//Multiedit init
$en = (int)$_GET["en"];
$objEditCat->Query_Item("SELECT * FROM ".$objEditCat->SourceTable);
$itemcount=$objEditCat->NumItems();
$c = $objEditCat->GetItemByIndex($en);
unset($objEditItems);
$objEditItems = new clsImageList();
$objEditItems->SourceTable = $objSession->GetEditTable("Images");
if(isset($_POST["itemlist"]))
{
if(is_array($_POST["itemlist"]))
{
$ImageId = $_POST["itemlist"][0];
}
else
{
$ImageId = $_POST["itemlist"];
}
$img = $objEditItems->GetItem($ImageId);
$img->Pending=TRUE;
$action = "m_img_edit";
$name = $img->Get("Name");
}
else
{
$img = new clsImage();
$img->Set("ResourceId",$c->Get("ResourceId"));
$img->Set("ImageId",$img->FieldMin("ImageId")-1);
$img->Pending=TRUE;
$img->tablename = $objEditItems->SourceTable;
$action = "m_img_add";
$name = "'New Image'";
}
$envar = "env=" . BuildEnv() . "&en=$en";
$section = 'in-portal:cat_imageedit';
$ado = &GetADODBConnection();
/* page header */
+$charset = GetRegionalOption('Charset');
print <<<END
<html>
<head>
<title>In-portal</title>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="content-type" content="text/html;charset=$charset">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
imagesPath='$imagesURL'+'/';
</script>
<script src="$browseURL/common.js"></script>
<script src="$browseURL/toolbar.js"></script>
<script src="$browseURL/utility.js"></script>
<script src="$browseURL/checkboxes.js"></script>
<script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
<link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
<link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
END;
$objListToolBar = new clsToolBar();
$objListToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","edit_submit('category','CatEditStatus','".$admin."/category/addcategory_images.php',0);",$imagesURL."/toolbar/tool_select.gif");
$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('category','CatEditStatus','".$admin."/category/addcategory_images.php',-1);", $imagesURL."/toolbar/tool_cancel.gif");
$title = prompt_language("la_Text_Editing")." ".prompt_language("la_Text_Category")." '".$c->Get("Name")."' - ".prompt_language("la_Text_Image");
$title .= " '".$name."'";
int_header($objListToolBar,NULL,$title);
if ($objSession->GetVariable("HasChanges") == 1) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Save_Item")); ?>
</td>
</tr>
</table>
<?php } ?>
<TABLE cellSpacing="0" cellPadding="2" width="100%" class="tableborder">
<FORM enctype="multipart/form-data" ID="category" NAME="category" method="POST" ACTION="">
<?php int_subsection_title(prompt_language("la_Text_Image")); ?>
<TR <?php int_table_color(); ?> >
<TD><?php echo prompt_language("la_prompt_ImageId"); ?></TD>
<TD><?php if ($img->Get("ImageId") != -1) echo $img->Get("ImageId"); ?></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><SPAN class="text" id="prompt_imgName"><?php echo prompt_language("la_prompt_Name"); ?></SPAN></TD>
<TD><input type=text tabindex="1" ValidationType="exists" NAME="imgName" size="30" VALUE="<?php echo inp_htmlize($img->parsetag("image_name")); ?>"></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><SPAN class="text" id="prompt_imgAlt"><?php echo prompt_language("la_prompt_AltName"); ?></SPAN></TD>
<TD><input type=text ValidationType="exists" tabindex="2" NAME="imgAlt" size="30" VALUE="<?php echo inp_htmlize($img->parsetag("image_alt")); ?>"></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><?php echo prompt_language("la_prompt_Status"); ?></TD>
<TD>
<input type=RADIO NAME="imgEnabled" tabindex="3" <?php if($img->Get("Enabled")==1) echo "CHECKED"; ?> VALUE="1"><?php echo prompt_language("la_Text_Enabled"); ?>
<input type=RADIO NAME="imgEnabled" tabindex="3" <?php if($img->Get("Enabled")==0) echo "CHECKED"; ?> VALUE="0"><?php echo prompt_language("la_Text_Disabled"); ?>
</TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><?php echo prompt_language("la_prompt_Primary"); ?></TD>
<TD><input type=checkbox NAME="imgDefault" tabindex="4" <?php if($img->Get("DefaultImg")==1) echo "CHECKED"; ?> VALUE="1"></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><?php echo prompt_language("la_prompt_Priority"); ?></TD>
<TD><input type=text SIZE="5" NAME="imgPriority" tabindex="5" VALUE="<?php echo $img->Get("Priority"); ?>"></TD>
<TD></TD>
</TR>
<?php int_subsection_title(prompt_language("la_text_Thumbnail_Image")); ?>
<TR <?php int_table_color(); ?> >
<TD><?php echo prompt_language("la_prompt_Location"); ?></TD>
<?php
if($img->Get("LocalThumb")==1 || strlen($img->Get("LocalThumb"))==0)
{
$local="checked";
$remote = "";
}
else
{
$remote="checked";
$local = "";
}
?>
<TD>
<TABLE border=0>
<tr>
<TD>
<input type="radio" name="imgLocalThumb" tabindex="6" <?php echo $local; ?> VALUE="1"><?php echo prompt_language("la_prompt_upload"); ?>:
</td>
<td>
<input type=FILE NAME="imgThumbFile" tabindex="7" VALUE=""> <br />
</td>
</tr>
<tr>
<td>
<input type="radio" name="imgLocalThumb" tabindex="6" <?php echo $remote; ?> VALUE="0"> <?php echo prompt_language("la_prompt_remote_url"); ?>:
</td>
<td>
<input type=text size=32 NAME="imgThumbUrl" tabindex="8" VALUE=""> <br />
</td>
</tr>
</table>
</TD>
<TD ALIGN="RIGHT">
<IMG SRC="<?php echo $img->ThumbURL(); ?>">
</TD>
</TR>
<?php int_subsection_title(prompt_language("la_Text_Full_Size_Image")); ?>
<TR <?php int_table_color(); ?>>
<TD><?php echo prompt_language("la_text_Same_As_Thumbnail"); ?></TD>
<?php
if(($img->Get("SameImages")=="1") || !$img->Get("ImageId") || ($img->Get("ImageId") == "-1"))
{
$checked = "CHECKED";
$disabled = "DISABLED=\"true\"";
}
?>
<TD><input type=checkbox id="imgSameImages" NAME="imgSameImages" tabindex="9" VALUE="1" <?php echo $checked; ?> ONCLICK="enableFullImage(this);"></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?>>
<TD><?php echo prompt_language("la_prompt_Location"); ?></TD>
<?php
if($img->Get("LocalImage")==1 || strlen($img->Get("LocalImage"))==0)
{
$local="checked";
$remote = "";
}
else
{
$remote="checked";
$local = "";
}
?>
<TD>
<TABLE border=0>
<tr>
<TD>
<input id="full1" type="radio" name="imgLocalFull" tabindex="10" <?php echo $local; ?> VALUE="1"><?php echo prompt_language("la_prompt_upload"); ?>:
</td>
<td>
<input type=FILE ID="imgFullFile" NAME="imgFullFile" tabindex="11" VALUE=""> <br />
</td>
</tr>
<tr>
<td>
<input id="full2" type="radio" name="imgLocalFull" tabindex="10" <?php echo $remote; ?> VALUE="0"> <?php echo prompt_language("la_prompt_remote_url"); ?>:
</td>
<td>
<input type=text size=32 ID="imgFullUrl" NAME="imgFullUrl" tabindex="12" VALUE=""> <br />
</td>
</tr>
</table>
</td>
<TD ALIGN="RIGHT">
<IMG SRC="<?php echo $img->FullURL(); ?>">
</TD>
</TR>
<input type=hidden NAME="Action" VALUE="<?php echo $action; ?>">
<input type="hidden" name="CatEditStatus" VALUE="0">
<input type="hidden" name="DestDir" VALUE="<?php echo $DestDir; ?>">
<INPUT TYPE="hidden" NAME="ImageId" VALUE="<?php echo $img->Get("ImageId"); ?>">
<input TYPE="HIDDEN" NAME="ResourceId" VALUE="<?php echo $c->Get("ResourceId"); ?>">
</FORM>
</TABLE>
<!-- CODE FOR VIEW MENU -->
<form method="post" action="user_groups.php?<?php echo $envar; ?>" name="viewmenu">
<input type="hidden" name="fieldname" value="">
<input type="hidden" name="varvalue" value="">
<input type="hidden" name="varvalue2" value="">
<input type="hidden" name="Action" value="">
</form>
<script language="JavaScript">
enableFullImage(document.getElementById('imgSameImages'));
MarkAsRequired(document.getElementById("category"));
</script>
<!-- END CODE-->
<?php int_footer(); ?>
Property changes on: trunk/admin/category/addimage.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/category/addpermission.php
===================================================================
--- trunk/admin/category/addpermission.php (revision 897)
+++ trunk/admin/category/addpermission.php (revision 898)
@@ -1,405 +1,406 @@
<?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;
}
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";
$cssURL = $adminURL."/include";
$browseURL = $adminURL."/browse";
//$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."/browse/toolbar.php");
require_once($pathtoroot.$admin."/listview/listview.php");
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot. $value."admin/include/parser.php";
if(file_exists($path))
{
include_once($path);
}
}
unset($objEditItems);
$objEditItems = new clsCatList();
$objEditItems->SourceTable = $objSession->GetEditTable("Category");
//Multiedit init
$en = (int)$_GET["en"];
$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable);
$itemcount=$objEditItems->NumItems();
$c = $objEditItems->GetItemByIndex($en);
if(!is_object($c))
{
$c = new clsCategory();
$c->Set("CategoryId",0);
}
if($itemcount>1)
{
if ($en+1 == $itemcount)
$en_next = -1;
else
$en_next = $en+1;
if ($en == 0)
$en_prev = -1;
else
$en_prev = $en-1;
}
$action = "m_edit_permissions";
$envar = "env=" . BuildEnv() . "&en=$en";
$section = 'in-portal:catperm_setperm';
$Module = $_GET["module"];
$GroupId = $_GET["GroupId"];
$g = $objGroups->GetItem($GroupId);
$objPermList = new clsPermList($c->Get("CategoryId"),$GroupId);
$objPermList->LoadPermTree($c);
$objParentPerms = new clsPermList($c->Get("ParentId"),$GroupId);
$p = $objCatList->GetCategory($c->Get("ParentId"));
$objParentPerms->LoadPermTree($p);
$ado = &GetADODBConnection();
/* page header */
+$charset = GetRegionalOption('Charset');
print <<<END
<html>
<head>
<title>In-portal</title>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="content-type" content="text/html;charset=$charset">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
imagesPath='$imagesURL'+'/';
</script>
<script src="$browseURL/common.js"></script>
<script src="$browseURL/toolbar.js"></script>
<script src="$browseURL/utility.js"></script>
<script src="$browseURL/checkboxes.js"></script>
<script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
<link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
<link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
END;
//int_SectionHeader();
//$back_url = $rootURL."admin/category/addpermission_modules.php?env=".BuildEnv()."&GroupId=$GroupId";
$back_url = "javascript:do_edit_save('category','CatEditStatus','".$admin."/category/addpermission_modules.php',0);";
if($c->Get("CategoryId")>0)
{
$title = prompt_language("la_Text_Editing")." ".prompt_language("la_Text_Category")." '".$c->Get("Name")."' - ".prompt_language("la_tab_Permissions");
$title .= " ".prompt_language("la_text_for")." '".$g->parsetag("group_name")."'";
}
else
{
$title = prompt_language("la_Text_Editing")." ".prompt_language("la_Text_Root")." ".prompt_language("la_Text_Category")." - "."' - ".prompt_language("la_tab_Permissions");
$title .= " ".prompt_language("la_text_for")." '".$g->parsetag("group_name")."'";
}
$objListToolBar = new clsToolBar();
$objListToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('category','CatEditStatus','".$admin."/category/addpermission_modules.php',0);",$imagesURL."/toolbar/tool_select.gif");
//$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('category','admin/category/addpermission_modules.php',-1);", $imagesURL."/toolbar/tool_cancel.gif");
$objListToolBar->Add("img_cancel", "la_Cancel",$back_url,"swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","", $imagesURL."/toolbar/tool_cancel.gif");
$sec =& $objSections->GetSection($section);
if($c->Get("CategoryId")==0)
{
$sec->Set("left",NULL);
$sec->Set("right",NULL);
}
int_header($objListToolBar,NULL,$title);
if ($objSession->GetVariable("HasChanges") == 1) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Save_Item")); ?>
</td>
</tr>
</table>
<?php } ?>
<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="navbar"><A CLASS="control_link" HREF="<?php echo $back_url; ?>">
<?php echo prompt_language("la_Prompt_CategoryPermissions")."</A>&gt;"; ?></span>
<SPAN CLASS="NAV_CURRENT_ITEM"><?php echo $Module; ?></SPAN>
</td>
</TR>
</TBODY>
</TABLE>
<TABLE CELLPADDING=0 CELLSPACING=0 class="tableborder" width="100%">
<FORM ID="category" NAME="category" method="POST" ACTION="">
<TBODY>
<TR class="subsectiontitle">
<?php
echo "<TD>".prompt_language("la_prompt_Description")."</TD>";
if($c->Get("CategoryId")!=0)
{
echo "<TD>".prompt_language("la_ColHeader_PermInherited")."</TD>";
}
echo "<TD>".prompt_language("la_ColHeader_PermAccess")."</TD>\n";
if($c->Get("CategoryId")!=0)
{
echo "<td>".prompt_language("la_ColHeader_InheritFrom")."</TD>";
}
?>
</TR>
<?php
if($c->Get("CategoryId")>0)
{
$ParentCatList = "0".$c->Get("ParentPath");
}
else
$ParentCatList = "0".$c->GetParentField("ParentPath","","");
$ParentCats = explode("|",$ParentCatList);
$ParentCats = array_reverse($ParentCats);
$sql = "SELECT * FROM ".GetTablePrefix()."PermissionConfig WHERE ModuleId='$Module'";
$rs = $ado->Execute($sql);
while($rs && !$rs->EOF)
{
$perm = $rs->fields;
$Permission = $perm["PermissionName"];
$Desc = $perm["Description"];
echo "<TR ".int_table_color_ret().">\n";
echo "<TD>".prompt_language("$Desc")." [$Permission]</TD>";
$p = $objPermList->GetPermByName($Permission);
$checked = "";
$MatchCatPath = "";
if(is_object($p))
{
//echo $p->Get("Permission")." Found<br>\n";
if($p->Inherited)
{
$checked = " CHECKED";
$MatchCatPath = "";
if($c->Get("CategoryId")>0)
{
$MatchedCat = $objPermList->GetDefinedCategory($Permission,$GroupId);
}
else
$MatchedCat = $objParentPerms->GetDefinedCategory($Permission,$GroupId);
if(is_numeric($MatchedCat))
{
if($MatchedCat!=0)
{
$mcat = $objCatList->GetCategory($MatchedCat);
$MatchCatPath = language($objConfig->Get("Root_Name")).">".$mcat->Get("CachedNavbar");
}
else
$MatchCatPath = language($objConfig->Get("Root_Name"));
}
else
$MatchCatPath = "";
}
}
else
$checked = " CHECKED";
if($c->Get("CategoryId")!=0)
{
echo " <TD><INPUT access=\"chk".$Permission."\" ONCLICK=\"SetAccessEnabled(this); \" TYPE=CHECKBOX name=\"inherit[]\" VALUE=\"".$Permission."\" $checked></TD>\n";
}
else
{
if(is_object($p))
$p->Inherited = FALSE;
}
$checked = "";
$imgsrc="red";
if(is_object($p))
{
if($p->Get("PermissionValue"))
{
$checked = " CHECKED";
$imgsrc = "green";
$current = "true";
}
else
{
$imgsrc = "red";
$current = "false";
}
$disabled = "";
if($p->Inherited)
{
if($c->Get("CategoryId")!=0)
{
$InheritValue = $current;
$UnInheritValue = "false";
$disabled = "DISABLED=\"true\"";
}
else
{
$disabled = "";
$UnInheritValue = "false";
$InheritValue="false";
}
}
else
{
$disabled = "";
if($p->Get("PermissionValue"))
{
$InheritValue = "false"; //need to look this up!
}
else
$InheritValue = "false";
$UnInheritValue = $current;
}
}
else
{
if($c->Get("CategoryId")!=0)
{
$disabled = "DISABLED=\"true\"";
$InheritValue = "false";
$UnInheritValue = "false";
$Matched = FALSE;
$MatchCatPath = "";
$MatchedCat = $objPermList->GetDefinedCategory($Permission,$GroupId);
if(is_numeric($MatchedCat))
{
if($MatchedCat>0)
{
$mcat = $objCatList->GetCategory($MatchedCat);
$MatchCatPath =language($objConfig->Get("Root_Name")).">".$mcat->Get("CachedNavbar");
}
else
$MatchCatPath = language($objConfig->Get("Root_Name"));
}
else
$MatchCatPath = "";
}
else
{
$disabled = "";
$UnInheritValue = "false";
$InheritValue="false";
}
}
echo " <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>\n";
if($c->Get("CategoryId")!=0)
echo "<TD>$MatchCatPath</TD>";
echo "</TR>\n";
$rs->MoveNext();
}
?>
</TBODY>
<INPUT TYPE="HIDDEN" NAME="Action" VALUE="m_edit_permissions">
<input type="hidden" NAME="GroupId" VALUE="<?php echo $GroupId; ?>">
<input TYPE="HIDDEN" NAME="CategoryId" VALUE="<?php echo $c->Get("CategoryId"); ?>">
<input type="hidden" name="CatEditStatus" VALUE="0">
<input TYPE="HIDDEN" NAME="Module" VALUE="<?php echo $Module; ?>">
</FORM>
</TABLE>
<!-- CODE FOR VIEW MENU -->
<form method="post" action="user_groups.php?<?php echo $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>
<!-- END CODE-->
<?php int_footer(); ?>
Property changes on: trunk/admin/category/addpermission.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/category/addrelation.php
===================================================================
--- trunk/admin/category/addrelation.php (revision 897)
+++ trunk/admin/category/addrelation.php (revision 898)
@@ -1,276 +1,277 @@
<?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";
$cssURL = $adminURL."/include";
$browseURL = $adminURL."/browse";
//$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
//require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/browse/toolbar.php");
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($objEditCat);
$objEditCat = new clsCatList();
$objEditCat->SourceTable = $objSession->GetEditTable("Category");
//Multiedit init
$en = (int)$_GET["en"];
$objEditCat->Query_Item("SELECT * FROM ".$objEditCat->SourceTable);
$itemcount=$objEditCat->NumItems();
$c = $objEditCat->GetItemByIndex($en);
unset($objEditItems);
$objEditItems = new clsRelationshipList();
$objEditItems->SourceTable = $objSession->GetEditTable("Relationship");
if(isset($_POST["itemlist"]))
{
if(is_array($_POST["itemlist"]))
{
$RelationId = $_POST["itemlist"][0];
}
else
{
$RelationId = $_POST["itemlist"];
}
$Rel = new clsRelationship();
$Rel->tablename = $objEditItems->SourceTable;
$Rel->LoadExpanded($RelationId);
$action = "m_edit_relation";
}
else
{
$Rel = new clsRelationship();
$Rel->Set("SourceType","1");
$Rel->Set("SourceId",$c->Get("ResourceId"));
$Rel->Set("TargetId",$_POST["TargetId"]);
$Rel->Set("TargetType",$_POST["TargetType"]);
$Rel->Set("Type","0");
$Rel->Set("Enabled","1");
$action = "m_add_relation";
}
$item = $Rel->GetTargetItemData();
$envar = "env=" . BuildEnv() . "&en=$en";
$section = 'in-portal:editcategory_relation';
$ado = &GetADODBConnection();
/* page header */
+$charset = GetRegionalOption('Charset');
print <<<END
<html>
<head>
<title>In-portal</title>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="content-type" content="text/html;charset=$charset">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
imagesPath='$imagesURL'+'/';
</script>
<script src="$browseURL/common.js"></script>
<script src="$browseURL/toolbar.js"></script>
<script src="$browseURL/utility.js"></script>
<script src="$browseURL/checkboxes.js"></script>
<script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
<link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
<link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
END;
$title = prompt_language("la_Text_Editing")." ".prompt_language("la_Text_Category")." '".$c->Get("Name")."' - ".prompt_language("la_Text_Relation");
$title .= " ".prompt_language("la_Text_to")." '".$item["TitleField"]."'";
$objCatToolBar = new clsToolBar();
$objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('category','CatEditStatus','".$admin."/category/addcategory_relations.php',0);",$imagesURL."/toolbar/tool_select.gif");
$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('category','CatEditStatus','".$admin."/category/addcategory_relations.php',-1);",$imagesURL."/toolbar/tool_cancel.gif");
int_header($objCatToolBar,NULL,$title);
if ($objSession->GetVariable("HasChanges") == 1) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Save_Item")); ?>
</td>
</tr>
</table>
<?php } ?>
<TABLE cellSpacing="0" cellPadding="2" width="100%" class="tableborder">
<FORM ID="category" NAME="category" method="POST" ACTION="">
<?php int_subsection_title("Relation"); ?>
<TR <?php int_table_color(); ?> >
<TD>
<span class="text"><?php echo prompt_language("la_prompt_RelationId"). ":</span></TD><TD>".$Rel->Get("RelationshipId"); ?>
</TD>
<TD>&nbsp;</TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><span class="text"><?php echo prompt_language("la_prompt_Item"); ?></SPAN></TD>
<TD>
<IMG src="<?php echo $Rel->Admin_Icon(); ?>" align="absmiddle"><SPAN id="TargetName"><?php echo $item["TitleField"]; ?></SPAN> <SPAN ID="TargetTypeName">(<?php echo prompt_language("la_Text_".$item["SourceTable"]); ?>)</SPAN>
</TD>
<TD>&nbsp;</TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><span class="text"><?php echo prompt_language("la_prompt_Type"); ?></SPAN></TD>
<TD>
<?php
$Recip = "";
$OneWay = "";
if($Rel->Get("Type")=="1")
{
$Recip = " CHECKED";
}
else
$OneWay = " CHECKED";
?>
<input type="radio" name="RelType" VALUE=1 <?php echo $Recip; ?>><?php echo prompt_language("la_Text_Reciprocal"); ?>
<input type="radio" name="RelType" VALUE=0 <?php echo $OneWay; ?>><?php echo prompt_language("la_Text_OneWay"); ?>
</TD>
<TD>&nbsp;</TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><span class="text"><?php echo prompt_language("la_prompt_Enabled"); ?></SPAN></TD>
<TD>
<?php
$checked = "";
if($Rel->Get("Enabled")=="1")
{
$checked = " CHECKED";
}
?>
<input type="checkbox" VALUE="1" name="Enabled" <?php echo $checked; ?>>
</TD>
<TD>&nbsp;</TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><span class="text"><?php echo prompt_language("la_prompt_Priority"); ?></SPAN></TD>
<TD>
<INPUT TYPE="TEXT" SIZE="5" NAME="priority" VALUE="<?php echo $Rel->Get("Priority"); ?>">
</TD>
<TD>&nbsp;</TD>
</TR>
<input type="hidden" name="TargetId" value ="<?php echo $Rel->Get("TargetId"); ?>">
<input type="hidden" name="TargetType" value ="<?php echo $Rel->Get("TargetType"); ?>">
<input type="hidden" name="SourceType" value ="<?php echo $Rel->Get("SourceType"); ?>">
<input type="hidden" name="SourceId" value ="<?php echo $c->Get("ResourceId"); ?>">
<INPUT TYPE="hidden" NAME="RelationshipId" VALUE="<?php echo $Rel->Get("RelationshipId"); ?>">
<input type="hidden" name="Action" value="<?php echo $action; ?>">
<input type="hidden" name="CatEditStatus" VALUE="0">
</FORM>
</TABLE>
<FORM NAME="save_edit_buttons" ID="save_edit_buttons" method="POST" ACTION="">
<tr <?php int_table_color(); ?>>
<td colspan="3">
<input type=hidden NAME="Action" VALUE="save_cat_edit">
</td>
</tr>
</FORM>
<!-- CODE FOR VIEW MENU -->
<form method="post" action="user_groups.php?<?php echo $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>
<!-- END CODE-->
<?php int_footer(); ?>
Property changes on: trunk/admin/category/addrelation.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/subitems.php
===================================================================
--- trunk/admin/subitems.php (revision 897)
+++ trunk/admin/subitems.php (revision 898)
@@ -1,186 +1,187 @@
<?php
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");
//echo "Admin: $admin <br>\n";
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL=$rootURL.$admin;
$imagesURL = $adminURL."/images";
$cssURL = $adminURL."/include";
$jsURL = $adminURL."/include/subitems";
//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");
$section = $_GET["section"];
$sectionname = explode(":", $section);
$sectionname = $sectionname[sizeof($sectionname)-1];
$incs = array();
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$inc = $pathtoroot.$value."admin/include/summary/".$sectionname.".php";
//echo "<pre>". $inc ."</pre><BR>";
if(file_exists($inc))
$incs[] = $inc;
}
$envar = BuildEnv();
+$charset = GetRegionalOption('Charset');
print <<<END
<html>
<head>
<title>In-portal</title>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="content-type" content="text/html;charset=$charset">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
imagesPath='$imagesURL'+'/';
clear_checkboxes=0;
</script>
END;
require_once($pathtoroot.$admin."/include/mainscript.php");
print <<<END
<script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
<link rel="stylesheet" type="text/css" href="$cssURL/subitems.css">
<script src="$jsURL/listitems.js"></script>
<script src="$jsURL/imgbuttons.js"></script>
<script src="$jsURL/navboxes.js"></script>
END;
int_SectionHeader();
?>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td valign="top">
<table cellspacing="0" cellpadding="2" border="0" width="100%" CLASS="tableborder_full">
<?php
$parent = $objSections->GetSection($section);
$sub = $objSections->GetSection($parent->Get("child"));
while(is_object($sub))
{
echo "<tr isListItem=\"true\" ". int_table_color_ret(). ">\n";
echo " <td class=\"subitem_icon\">";
echo " <img ALIGN=\"left\" src=\"".$sub->IconURL(2)."\" border=\"0\">";
echo " </td>";
echo " <td class=\"subitem_description\"><a href=\"".$sub->URL()."\" class=\"dLink\">";
$lang_tag = "la_Description_".$sub->Get("key");
echo admin_language($sub->Get("name"))."</A>";
echo prompt_language($lang_tag); //$sub->Get("description");
echo " </td>\n";
echo "</tr>\n";
$sub = $objSections->GetSection($sub->Get("right"));
}
?>
</TABLE>
</TD>
<?php
if(count($incs)>0)
{
?>
<td width="1"><img src="<?php echo $imagesURL; ?>/spacer.gif" width="4" height="1"></td>
<td width="269" valign="top" class="boxContainer">
<?php
// including each module summaries here
for($i=0;$i<count($incs);$i++)
include($incs[$i]);
?>
</TD>
<?php
}
?>
</TR>
</TABLE>
<?php
if(count($incs)>0)
{
?>
<script>
init();
</script>
<?php
}
?>
<form ID="viewmenu" NAME="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>
<?php int_footer(); ?>
Property changes on: trunk/admin/subitems.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 897)
+++ trunk/admin/include/elements.php (revision 898)
@@ -1,620 +1,624 @@
<?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(!defined('IS_INSTALL'))define('IS_INSTALL',0);
if(!IS_INSTALL)
{
if (!admin_login())
{
if(!headers_sent()) {
setcookie("sid"," ",time()-3600);
}
$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(),$OtherSection = '')
{
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);
+
+ $ExtraTitle = str_replace(Array('<','>'),Array('&lt;','&gt;'),$ExtraTitle);
+ //$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>\n\t<head>\n\t\t<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";
+ {
+ $charset = GetRegionalOption('Charset');
+ print "<meta http-equiv=\"content-type\" content=\"text/html;charset=$charset\">\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
{
+ $charset = GetRegionalOption('Charset');
print "<html><head><title>In-Portal </title>";
- print "<meta http-equiv=\"content-type\" content=\"text/html;charset=iso-8859-1\">";
+ print "<meta http-equiv=\"content-type\" content=\"text/html;charset=$charset\">";
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,false,$OtherSection);
//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";
// TOOLBAR:
+ $charset = GetRegionalOption('Charset');
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=\"content-type\" content=\"text/html;charset=$charset\">";
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,'','', 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();
}
if( defined('REQUIRE_LAYER_HEADER') ) echo '</div>';
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, $item_name = false)
{
//gets correct caption for editing windows with tabs
//echo "In: $item_phrase, $tab_phrase, $id";
$is_new = (isset($_REQUEST['new']) && ($_REQUEST['new'] == 1)) || $id <= 0 ? 1 : 0;
$text = $is_new ? 'la_Text_Adding' : 'la_Text_Editing';
$text = admin_language($text).' '.admin_language($item_phrase);
if($is_new == 0) {
if ($item_name == false) {
$text .= ' #'.$id;
}
else {
if ($item_name != '') {
$text .= " '".$item_name."'";
}
}
}
if ($tab_phrase != '') {
$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.17
\ No newline at end of property
+1.18
\ No newline at end of property
Index: trunk/admin/advanced_view.php
===================================================================
--- trunk/admin/advanced_view.php (revision 897)
+++ trunk/admin/advanced_view.php (revision 898)
@@ -1,377 +1,378 @@
<?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. ##
##############################################################
//$pathtoroot="";
define('REQUIRE_LAYER_HEADER', 1);
$b_topmargin = "0";
//$b_header_addon = "<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='images/logo_bg.gif'></div><img src='images/spacer.gif' width=1 height=15><br><div style='z-Index:1; position:relative'>";
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");
}
$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";
$browseURL = $adminURL."/browse";
$cssURL = $adminURL."/include";
$indexURL = $rootURL."index.php";
$m_var_list_update["cat"] = 0;
$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');";
unset($m_var_list_update["cat"]);
//admin only util
$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot.$admin."/include/elements.php");
//require_once ($pathtoroot."kernel/admin/include/navmenu.php");
require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/browse/toolbar.php");
$mod_prefixes = Array();
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value."admin/include/parser.php";
if(file_exists($path))
{
//echo "<!-- $path -->";
$mod_prefixes[] = $key;
@include_once($path);
}
}
if(!defined('IS_INSTALL'))define('IS_INSTALL',0);
if(!IS_INSTALL)
{
if (!admin_login())
{
if(!headers_sent())
setcookie("sid"," ",time()-3600);
$objSession->Logout();
header("Location: ".$adminURL."/login.php");
die();
//require_once($pathtoroot."admin/login.php");
}
}
//Set Section
$section = 'in-portal:advanced_view';
//Set Environment Variable
// save last category visited
$objSession->SetVariable('prev_category', $objSession->GetVariable('last_category') );
$objSession->SetVariable('last_category', $objCatList->CurrentCategoryID() );
$objSession->SetVariable("HasChanges", 0);
// where should all edit popups submit changes
$objSession->SetVariable("ReturnScript", basename($_SERVER['PHP_SELF']) );
// common "Advanced View" tab php functions: begin
function GetAdvView_SearchWord($prefix)
{
global $objSession;
return $objSession->GetVariable($prefix.'_adv_view_search');
}
function SaveAdvView_SearchWord($prefix)
{
global $objSession;
$SearchWord = $objSession->GetVariable($prefix.'_adv_view_search');
if( isset($_REQUEST['SearchWord']) )
{
$SearchWord = $_REQUEST['SearchWord'];
$objSession->SetVariable($prefix.'_adv_view_search', $SearchWord);
}
}
function ResetAdvView_SearchWord($prefix)
{
global $objSession;
$objSession->SetVariable($prefix.'_adv_view_search', '');
}
function ShowSearchForm($prefix, $envar, $TabID)
{
global $imagesURL;
$btn_prefix = $imagesURL.'/toolbar/icon16_search';
$SearchWord = GetAdvView_SearchWord($prefix);
echo '<form method="post" action="'.$_SERVER["PHP_SELF"].'?'.$envar.'" name="'.$prefix.'_adv_view_search" id="'.$prefix.'_adv_view_search">
<input type="hidden" name="Action" value="">
<table cellspacing="0" cellpadding="0">
<tr>
<td>'.admin_language('la_SearchLabel').'&nbsp;</td>
<td><input id="'.$prefix.'_SearchWord" type="text" value="'.inp_htmlize($SearchWord,1).'" name="SearchWord" size="10" style="border-width: 1; border-style: solid; border-color: 999999"></td>
<td>
<img
id="'.$TabID.'_imgSearch"
src="'.$btn_prefix.'.gif"
alt="'.admin_language("la_ToolTip_Search").'"
align="absMiddle"
onclick="SubmitSearch(\''.$prefix.'_adv_view_search\',\''.$prefix.'_adv_view_search\');"
onmouseover="this.src=\''.$btn_prefix.'_f2.gif\'"
onmouseout="this.src=\''.$btn_prefix.'.gif\'"
style="cursor:hand"
width="22"
height="22"
>
<img
id="imgSearchReset"
src="'.$btn_prefix.'_reset.gif"
alt="'.admin_language("la_ToolTip_Search").'"
align="absMiddle"
onclick="SubmitSearch(\''.$prefix.'_adv_view_search\',\''.$prefix.'_adv_view_search_reset\');"
onmouseover="this.src=\''.$btn_prefix.'_reset_f2.gif\'"
onmouseout="this.src=\''.$btn_prefix.'_reset.gif\'"
style="cursor:hand"
width="22"
height="22"
>&nbsp;
</td>
</tr>
</table>
</form>
<script language="javascript">
document.getElementById("'.$prefix.'_SearchWord").onkeydown = getKey;
</script>
';
}
// common "Advanced View" tab php functions: end
/* page header */
+$charset = GetRegionalOption('Charset');
print <<<END
<html>
<head>
<title>In-portal</title>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="content-type" content="text/html;charset=$charset">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
imagesPath='$imagesURL'+'/';
</script>
END;
require_once($pathtoroot.$admin."/include/mainscript.php");
print <<<END
<script type="text/javascript">
if (window.opener != null) {
theMainScript.CloseAndRefreshParent();
}
</script>
END;
print <<<END
<script src="$browseURL/toolbar.js"></script>
<script src="$browseURL/checkboxes_new.js"></script>
<script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
<link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
<link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
END;
load_module_styles();
if( !isset($list) ) $list = '';
int_SectionHeader();
$filter = false;
$bit_combo = $objModules->ExecuteFunction('GetModuleInfo', 'all_bitmask');
$bit_combo = $objModules->MergeReturn($bit_combo);
foreach($bit_combo['VarName'] as $mod_name => $VarName)
{
//echo "VarName: [$VarName] = [".$objConfig->Get($VarName)."], ALL = [".$bit_combo['Bits'][$mod_name]."]<br>";
if( $objConfig->Get($VarName) )
if( $objConfig->Get($VarName) != $bit_combo['Bits'][$mod_name] )
{
$filter = true;
break;
}
}
?>
</div>
<!-- alex mark -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<div name="toolBar" id="mainToolBar">
<tb:button action="edit" alt="<?php echo admin_language("la_ToolTip_Edit"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="delete" alt="<?php echo admin_language("la_ToolTip_Delete"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="approve" alt="<?php echo admin_language("la_ToolTip_Approve"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="decline" alt="<?php echo admin_language("la_ToolTip_Decline"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="print" alt="<?php echo admin_language("la_ToolTip_Print"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="view" alt="<?php echo admin_language("la_ToolTip_View"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
</div>
</td>
</tr>
</tbody>
</table>
<?php if ($filter) { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Filter")); ?>
</td>
</tr>
</table>
<?php } ?>
<br>
<!-- CATEGORY DIVIDER -->
</DIV>
</div>
<DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index:0" id="firstContainer">
<DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index:2" id="secondContainer">
<?php
print $ItemTabs->TabRow();
if(count($ItemTabs->Tabs))
{
?>
<div class="divider" id="tabsDevider"><img width=1 height=1 src="images/spacer.gif"></div>
<?php
}
?>
</DIV>
<?php
unset($m);
$m = GetModuleArray("admin");
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value."admin/advanced_view.php";
//echo "Including File: $path<br>";
if(file_exists($path))
{
//echo "\n<!-- $path -->\n";
include_once($path);
}
}
?>
<form method="post" action="advanced_view.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>
</DIV>
<!-- END CODE-->
<script language="JavaScript">
InitPage();
if(default_tab.length == 0)
{
cookie_start = theMainScript.GetCookie('active_tab');
if (cookie_start != null) start_tab = cookie_start;
if(start_tab!=null) toggleTabB(start_tab, true);
}
else
{
toggleTabB(default_tab,true);
}
</script>
<?php
$objSession->SetVariable("HasChanges", 0);
int_footer();
?>
\ No newline at end of file
Property changes on: trunk/admin/advanced_view.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.11
\ No newline at end of property
+1.12
\ No newline at end of property
Index: trunk/admin/head.php
===================================================================
--- trunk/admin/head.php (revision 897)
+++ trunk/admin/head.php (revision 898)
@@ -1,129 +1,129 @@
<?php
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");
$localURL=$rootURL."kernel/";
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
$pathtolocal = $pathtoroot;
//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");
//print_r($objSession);
$userid= $objSession->Get("PortalUserId");
if($userid!=-1)
{
$userobj=$objUsers->GetItem($userid);
$loginname= $userobj->Get("Login");
}
else
$loginname = "root";
$logout = $rootURL."admin/";
$mainpage = $rootURL."admin/subitems.php?"."env=".BuildEnv()."&section=in-portal:root";
$objLang = $objLanguages->GetItem($m_var_list["lang"]);
-
+ $charset = GetRegionalOption('Charset');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>HEAD</title>
-<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+<meta http-equiv="content-type" content="text/html;charset=<?php echo $charset; ?>">
<meta name="generator" content="Notepad">
<link rel="stylesheet" type="text/css" href="include/style.css">
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" bgcolor="#FFFFFF">
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
<tr>
<td valign="bottom">
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="90">
<tr>
<td rowspan="3" valign="top"><a href="<?php echo $mainpage; ?>" target="main"><img alt="In-portal" src="images/globe.gif" width="84" height="91" border="0"></a></td>
<td rowspan="3" valign="top"><a href="<?php echo $mainpage; ?>" target="main"><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="bottom"><img alt="" src="images/spacer.gif" width="1" height="10" align="absmiddle">
<?php echo prompt_language("la_Logged_in_as")." "; ?><B><?php echo $loginname." "; ?></B>
<a href="<?php echo $logout."login.php?logout=1"; ?>" target="_parent"><img src="images/blue_bar_logout.gif" height="16" WIDTH="16" align="absmiddle" BORDER="0"></A></td>
</tr>
<tr>
<td><img alt="" src="images/blocks2.gif" width="400" height="1"></td>
</tr> <tr>
<td bgcolor="black" colspan="4"><img alt="" src="images/spacer.gif" width="1" height="1"></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
\ No newline at end of file
Property changes on: trunk/admin/head.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/help/credits.php
===================================================================
--- trunk/admin/help/credits.php (revision 897)
+++ trunk/admin/help/credits.php (revision 898)
@@ -1,190 +1,191 @@
<?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;
//print_r($_GET);
//print_r($_POST);
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";
$cssURL = $adminURL."/include";
$browseURL = $adminURL."/browse";
//$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
//require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/browse/toolbar.php");
require_once($pathtoroot.$admin."/listview/listview.php");
$ado = &GetADODBConnection();
$title = "In-Portal ".language("la_Credits_Title");
+$charset = GetRegionalOption('Charset');
/* page header */
print <<<END
<html>
<head>
<title>$title</title>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="content-type" content="text/html;charset=$charset">
<meta http-equiv="Pragma" content="no-cache">
<!--
<script src="$adminURL/include/dw_scrollObj.js" type="text/javascript"></script>
<script src="$adminURL/include/dw_hoverscroll.js" type="text/javascript"></script>
-->
<script language="JavaScript">
imagesPath='$imagesURL'+'/';
function initScrollLayer()
{
var i = 0;
x = 4;
function scrolldiv() {
document.getElementById('scrollImg').scrollTop += x;
i++;
if (i > 100) {
if (x > 0) {
x = -4;
}
else {
x = 4;
}
i = 0;
}
//alert('again');
window.setTimeout(scrolldiv, 150);
}
window.setTimeout(scrolldiv, 500);
}
</script>
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
</head>
END;
if ((int)$m_var_list["lang"])
{
$objLanguages->Query_Item("SELECT * FROM ".$objLanguages->SourceTable." WHERE Enabled=1 AND LanguageId=".(int)$m_var_list["lang"]);
foreach ($objLanguages->Items as $l)
{
$lang_name = " ".$l->Get("LocalName");
}
}
?>
<!-- onload="initScrollLayer()" -->
<body onload="initScrollLayer()" marginheight="0" marginwidth="0" marginleft="0" margintop="0" bgcolor="white" style="background-repeat: no-repeat;" background="<?php echo $imagesURL."/about.jpg";?>">
<TABLE cellSpacing="0" cellPadding="0" width="100%" height="100%">
<tr>
<TD align="center" width="0%">
<TABLE cellSpacing="0" cellPadding="0" width="95%">
<tr>
<TD align="center" width="95%" class="small">
<BR><BR><BR><BR><BR><BR><BR><BR><BR><br><br><br>
<span class="text">In-Portal <?php echo language("la_Text_Version").":".$kernel_version.$lang_name; ?></SPAN>
<BR><BR>
<div id="wn">
<div class="small" id="content" width="432" height="146" align="center">
<div id="scrollImg" style="position: relative; overflow: hidden; height: 190px; width: 270px">
<?php
$inc_path = $pathtoroot.$admin.'/help/';
include $inc_path.'credits.txt';
?>
<br><br>
</div>
<?php
echo '<hr>';
include $inc_path.'legal_warning.txt';
?>
</div>
</div>
<BR><BR>
<input type="button" value="<?php echo language("la_button_ok"); ?>" onclick="window.close()"></TD>
</TR>
</table>
</TD>
</TR>
</TABLE>
<!-- END CODE-->
<?php int_footer(); ?>
Property changes on: trunk/admin/help/credits.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/cat_select.php
===================================================================
--- trunk/admin/cat_select.php (revision 897)
+++ trunk/admin/cat_select.php (revision 898)
@@ -1,385 +1,386 @@
<?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. ##
##############################################################
$b_header_addon = "<DIV style='position:relative; z-Index: 1; background-color: #ffffff; padding-top:1px;'><div style='z-Index:1; position:relative'>";
$pathtoroot="";
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;
}
require_once($pathtoroot."kernel/startup.php");
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$cssURL = $adminURL."/include";
$imagesURL = $adminURL."/images";
$browseURL = $adminURL."/browse";
$destform = $_GET["destform"];
$destfield = $_GET["destfield"];
RegisterEnv("destform",$destform);
RegisterEnv("destfield",$destfield);
RegisterEnv("source",$_GET["source"]);
$envar = "env=" . BuildEnv();
$m_var_list_update["cat"] = 0;
//$homeURL = $_SERVER["PHP_SELF"]."?".$envar;
$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');";
if( $GLOBALS['debuglevel'] ) echo $homeURL."<br>\n";
unset($m_var_list_update["cat"]);
if($objCatList->CurrentCategoryID()>0)
{
$c = $objCatList->CurrentCat();
$upURL = $c->Admin_Parent_Link();
}
else
$upURL = $_SERVER["PHP_SELF"]."?".$envar;
//admin only util
$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot.$admin."/include/elements.php");
//require_once ($pathtoroot."kernel/admin/include/navmenu.php");
require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/browse/toolbar.php");
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value."admin/include/parser.php";
if(file_exists($path))
{
//echo "<!-- $path -->";
@include_once($path);
}
}
//Set Section
$section = 'in-portal:catselect';
//Set Environment Variable
//echo $objCatList->ItemsOnClipboard()." Categories on the clipboard<br>\n";
//echo $objTopicList->ItemsOnClipboard()." Topics on the clipboard<br>\n";
//echo $objLinkList->ItemsOnClipboard()." Links on the clipboard<br>\n";
//echo $objArticleList->ItemsOnClipboard()." Articles on the clipboard<br>\n";
$SearchType = $objSession->GetVariable("SearchType");
if(!strlen($SearchType))
$SearchType = "Categories";
$SearchLabel = "la_SearchLabel";
/* page header */
+$charset = GetRegionalOption('Charset');
print <<<END
<html>
<head>
<title>In-portal</title>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="content-type" content="text/html;charset=$charset">
<meta http-equiv="Pragma" content="no-cache">
END;
require_once($pathtoroot.$admin."/include/mainscript.php");
print <<<END
<script src="$browseURL/toolbar.js"></script>
<script src="$browseURL/checkboxes_new.js"></script>
<script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
<script language="JavaScript1.2">
var enableContextMenus= true;
var doubleClickAction = 'select';
function toggleTabB(tabId, atm)
{
var hl = document.getElementById("hidden_line");
var activeTabId;
if (activeTab) activeTabId = activeTab.id;
if (activeTabId == tabId)
{
var devider = document.getElementById("tabsDevider");
devider.style.display = "";
unselectAll(tabId);
var tab = document.getElementById(tabId);
tab.active = false;
activeTab = null;
collapseTab = tab;
toolbar.setTab(null);
showTab();
}
else
{
if (activeTab)
toggleTab(tabId, true)
else
toggleTab(tabId, atm)
if (hl) hl.style.display = "none";
}
tab_hdr = document.getElementById('tab_headers');
if (!tab_hdr) return;
// process all module tabs
var active_str = '';
for(var i = 0; i < tabIDs.length; i++)
{
var tabHeader;
TDs = tab_hdr.getElementsByTagName("TD");
for (var j = 0; j < TDs.length; j++)
if (TDs[j].getAttribute("tabHeaderOf") == tabIDs[i])
{
tabHeader = TDs[j];
break;
}
if (!tabHeader) continue;
var tab = document.getElementById(tabIDs[i]);
if (!tab) continue;
active_str = (tab.active) ? "tab_active" : "tab_inactive";
if (TDs[j].getAttribute("tabHeaderOf") == tabId) {
// module tab is selected
SetBackground('l_' + tabId, "$imagesURL/itemtabs/" + active_str + "_l.gif");
SetBackground('m_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('m1_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('r_' + tabId, "$imagesURL/itemtabs/" + active_str + "_r.gif");
}
else
{
// module tab is not selected
SetBackground('l_' +tabIDs[i], "$imagesURL/itemtabs/" + active_str + "_l.gif");
SetBackground('m_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('m1_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + ".gif");
SetBackground('r_' + tabIDs[i], "$imagesURL/itemtabs/" + active_str + "_r.gif");
}
var images = tabHeader.getElementsByTagName("IMG");
if (images.length < 1) continue;
images[0].src = "$imagesURL/itemtabs/" + ((tab.active) ? "divider_up" : "divider_empty") + ".gif";
}
}
function toggleCategoriesB(tabHeader, instant)
{
var categories = document.getElementById('categories');
if (!categories) return;
toggleCategories(instant);
var active_str = '$imagesURL'+'/itemtabs/' + (categories.active ? 'tab_active' : 'tab_inactive');
SetBackground('l_cat', active_str + '_l.gif');
SetBackground('m_cat', active_str + '.gif');
SetBackground('m1_cat', active_str + '.gif');
SetBackground('r_cat', active_str + '_r.gif');
var images = tabHeader.getElementsByTagName("IMG");
if (images.length < 1) return;
images[0].src = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "divider_up" : "divider_dn") + ".gif";
}
</script>
<link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
<link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
END;
int_SectionHeader();
?>
</div>
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<div name="toolBar" id="mainToolBar">
<tb:button action="select" alt="<?php echo admin_language("la_ToolTip_Select"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="stop" alt="<?php echo admin_language("la_ToolTip_Cancel"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="upcat" alt="<?php echo admin_language("la_ToolTip_Up"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="homecat" alt="<?php echo admin_language("la_ToolTip_Home"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="view" alt="<?php echo admin_language("la_ToolTip_View"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
</div>
</td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" width="100%" bgcolor="#e0e0da" border="0" class="tableborder_full_a">
<tbody>
<tr>
<td><img height="15" src="<?php echo $imagesURL; ?>/arrow.gif" width="15" align="middle" border="0">
<span class="navbar"><?php print m_navbar( Array('admin' => 1) ); ?></span>
</td>
<td align="right">
<FORM METHOD="POST" ACTION="<?php echo $_SERVER["PHP_SELF"]."?".$envar; ?>" NAME="admin_search" ID="admin_search"><INPUT ID="SearchScope" NAME="SearchScope" type="hidden" VALUE="<?php echo $objSession->GetVariable("SearchScope"); ?>"><INPUT ID="SearchType" NAME="SearchType" TYPE="hidden" VALUE="<?php echo $objSession->GetVariable("SearchType"); ?>"><INPUT ID="NewSearch" NAME="NewSearch" TYPE="hidden" VALUE="0"><INPUT TYPE="HIDDEN" NAME="Action" value="m_Exec_Search">
<table cellspacing="0" cellpadding="0"><tr>
<td><?php echo admin_language($SearchLabel); ?>&nbsp;</td>
<td><input ID="SearchWord" type="text" name="SearchWord" size="10" style="border-width: 1; border-style: solid; border-color: #999999"></td>
<td><img action="search_b" src="<?php echo $imagesURL."/toolbar/";?>/icon16_search.gif" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" src="<?php echo $imagesURL."/toolbar/";?>/arrow16.gif" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search.gif'" style="cursor:hand" width="22" width="22"><img action="search_a" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" src="<?php echo $imagesURL."/toolbar/";?>/arrow16.gif" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16.gif'" style="cursor:hand">
<img action="search_c" src="<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset.gif" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset.gif'" style="cursor:hand" width="22" width="22">&nbsp;
</td>
</tr></table>
</FORM>
<!--tb:button action="search_b" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="right" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
<tb:button action="search_a" alt="<?php echo admin_language("la_ToolTip_Search"); ?>" align="right" ImagePath="<?php echo $imagesURL."/toolbar/";?>"-->
</td>
</tr>
</tbody>
</table>
<br>
<!-- CATEGORY DIVIDER -->
<?php
$OrderBy = $objCatList->QueryOrderByClause(TRUE,TRUE,TRUE);
$objCatList->Clear();
if($SearchType=="categories" || $SearchType="all")
{
$list = $objSession->GetVariable("SearchWord");
$SearchQuery = $objCatList->AdminSearchWhereClause($list);
if(strlen($SearchQuery))
{
$SearchQuery = " (".$SearchQuery.") ";
if(strlen($CatScopeClause))
$SearchQuery .= " AND ".$CatScopeClause;
$objCatList->LoadCategories($SearchQuery.$CategoryFilter,$OrderBy);
}
else
$objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter,$OrderBy);
}
else
$objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter,$OrderBy);
?>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td width="138" height="20" nowrap="nowrap" class="active_tab" onclick="toggleCategoriesB(this)" id="cats_tab">
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td id="l_cat" background="<?php echo $imagesURL; ?>/itemtabs/tab_active_l.gif" class="left_tab">
<img src="<?php echo $imagesURL; ?>/itemtabs/divider_up.gif" width="20" height="20" border="0" align="absmiddle">
</td>
<td id="m_cat" nowrap background="<?php echo $imagesURL; ?>/itemtabs/tab_active.gif" class="tab_class">
<?php echo admin_language("la_ItemTab_Categories"); ?>:&nbsp;
</td>
<td id="m1_cat" align="right" valign="top" background="<?php echo $imagesURL; ?>/itemtabs/tab_active.gif" class="tab_class">
<span class="cats_stats">(<?php echo $objCatList->QueryItemCount; ?>)</span>&nbsp;
</td>
<td id="r_cat" background="<?php echo $imagesURL; ?>/itemtabs/tab_active_r.gif" class="right_tab">
<img src="<?php echo $imagesURL; ?>/spacer.gif" width="21" height="20">
</td>
</tr>
</table>
</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<div class="divider" style="" id="categoriesDevider"><img width=1 height=1 src="images/spacer.gif"></div>
</DIV>
<DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index:0" id="firstContainer">
<DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index: 2" id="secondContainer">
<!-- CATEGORY OUTPUT START -->
<div id="categories" tabtitle="Categories">
<form id="categories_form" name="categories_form" action="" method="post">
<input type="hidden" name="Action">
<?php print adListSubCats($objCatList->CurrentCategoryID(),"cat_select_element.tpl"); ?>
</form>
</div>
<BR>
<!-- CATEGORY OUTPUT END -->
</DIV>
<form method="post" action="cat_select.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>
</DIV>
<!-- END CODE-->
<script language="JavaScript">
<?php
//if($_GET["Selector"]=="radio")
echo " var single_select = true;";
?>
InitPage();
</script>
<?php int_footer(); ?>
Property changes on: trunk/admin/cat_select.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.7
\ No newline at end of property
Index: trunk/admin/index.php
===================================================================
--- trunk/admin/index.php (revision 897)
+++ trunk/admin/index.php (revision 898)
@@ -1,153 +1,152 @@
<?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. ##
##############################################################
$pathtoroot = "";
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;
}
}
if (!file_exists($pathtoroot."/config.php")) {
echo "In-Portal is probably not installed, or configuration file is missing.<br>";
echo "Please use the installation script to fix the problem.<br><br>";
echo "<a href='install.php'>Go to installation script</a><br><br>";
flush();
die();
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
$pathtoroot = $pathtoroot.$pathchar;
}
//echo "<PRE>"; print_r($_POST); echo "</PRE>";
require_once($pathtoroot."/kernel/startup.php");
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = substr($path,strlen($pathtoroot));
$objConfig->Set("AdminDirectory",$admin,0,TRUE);
$objConfig->Save();
//echo "Setting admin to $admin <br>\n";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
$browseURL = $adminURL."/browse";
$cssURL = $adminURL."/include";
if (!admin_login())
{
if(!headers_sent())
setcookie("sid"," ",time()-3600);
$objSession->Logout();
-
require_once($pathtoroot.$admin."/login.php");
}
$envar = "env=" . BuildEnv();
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
$pathtolocal = $pathtoroot;
-
+$charset = GetRegionalOption('Charset');
?>
<html>
<head>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="content-type" content="text/html;charset=<?php echo $charset; ?>">
<meta name="generator" content="kwrite">
<link rel="stylesheet" type="text/css" href="include/style.css">
<title>In-portal Administration</title>
</head>
<script type="text/javascript">
window.name = 'main_frame';
</script>
<script language="JavaScript1.2">
lala = navigator.appVersion.substring(0,1);
if (navigator.appName == "Netscape") {
if (lala != "5") {
document.write("<frameset rows='96,*' framespacing='0' scrolling='no' frameborder='0'>");
} else {
document.write("<frameset rows='95,*' framespacing='0' scrolling='no' frameborder='0'>");
}
} else {
document.write("<frameset rows='94,*' framespacing='0' scrolling='no' frameborder='0'>");
}
</script>
<!--<frameset rows="92,*" border="0">-->
<frame src="head.php?<?php echo $envar; ?>" name="head" scrolling="no" noresize>
<frameset cols="200,*" border="0">
<frame src="tree/tree.php?<?php echo $envar; ?>" name="menu" target="_main" noresize scrolling="auto" marginwidth="0" marginheight="0">
<frame src="subitems.php?<?php echo $envar."&section=in-portal:root"; ?>" name="main" marginwidth="0" marginheight="0" frameborder="NO" noresize scrolling="auto">
</frameset>
</frameset>
<noframes>
<body bgcolor="#ffffff">
<p></p>
</body>
</noframes>
</html>
\ No newline at end of file
Property changes on: trunk/admin/index.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/config/addlang.php
===================================================================
--- trunk/admin/config/addlang.php (revision 897)
+++ trunk/admin/config/addlang.php (revision 898)
@@ -1,652 +1,339 @@
<?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)
-
+ $path=dirname(realpath(__FILE__));
+ if(strlen($path))
{
-
- $p = $parent;
-
+ /* 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
-
- $p = "";
-
- }
-
- }
-
- if(!strlen($pathtoroot))
-
- $pathtoroot = ".".$pathchar;
-
- }
-
- else
-
- {
-
- $pathtoroot = ".".$pathchar;
-
- }
-
+ {
+ $pathtoroot = ".".$pathchar;
+ }
}
-
-
$sub = substr($pathtoroot,strlen($pathchar)*-1);
-
if($sub!=$pathchar)
-
{
-
- $pathtoroot = $pathtoroot.$pathchar;
-
+ $pathtoroot = $pathtoroot.$pathchar;
}
-
//echo $pathtoroot;
-
//print_r($_GET);
-
//print_r($_POST);
-
require_once($pathtoroot."kernel/startup.php");
-
//admin only util
-
-
/* set the destination of the image upload, relative to the root path */
-
$DestDir = "kernel/images/";
-
-
$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";
-
$browseURL = $adminURL."/browse";
-
-
$pathtolocal = $pathtoroot."kernel/";
-
require_once ($pathtoroot.$admin."/include/elements.php");
-
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
-
require_once ($pathtolocal."admin/include/navmenu.php");
-
require_once($pathtoroot.$admin."/browse/toolbar.php");
-
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);
-
- }
-
+ $path = $pathtoroot. $value."admin/include/parser.php";
+ if(file_exists($path))
+ {
+ include_once($path);
+ }
}
-
-
$objMessages = new clsEmailMessageList();
-
-
unset($objEditItems);
-
-
$objEditItems = new clsLanguageList();
-
$objEditItems->SourceTable = $objSession->GetEditTable("Language");
-
$objEditItems->EnablePaging = FALSE;
-
$objPhraseList = new clsPhraseList();
-
$objPhraseList->EnablePaging = FALSE;
-
if ($_GET["new"] == 1)
-
{
-
$c = new clsLanguage(NULL);
-
$c->Set("DecimalPoint",".");
-
$c->Set("ThousandSep",",");
-
$c->Set("DateFormat","m-d-Y");
-
$c->Set("TimeFormat","g:i:s a");
-
$en = 0;
-
$action = "m_lang_add";
-
$name = prompt_language("la_Text_New");
-
$objLanguages->CreateEmptyEditTable("LanguageId");
-
$objPhraseList->CreateEmptyEditTable("PhraseId");
-
$objMessages->CreateEmptyEditTable($_POST["itemlist"]);
-
}
-
else
-
{
-
$en = (int)$_GET["en"];
-
-
if (isset($_POST["itemlist"]))
-
{
-
$objLanguages->CopyToEditTable("LanguageId",$_POST["itemlist"]);
-
$objPhraseList->CopyToEditTable("LanguageId",$_POST["itemlist"]);
-
$objMessages->CopyToEditTable("LanguageId",$_POST["itemlist"]);
-
}
-
$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_lang_edit";
-
$name = $c->Get("LocalName");
-
}
-
-
$section = "in-portal:lang_general";
-
-
$envar = "env=".BuildEnv();
-
-
$title = $title = GetTitle("la_Text_Pack", "la_tab_General", $c->Get('LanguageId'), $c->Get('LocalName'));///prompt_language("la_Text_Configuration")." - ".$name."' ".prompt_language("la_Text_Pack")." - ".prompt_language("la_tab_General");
-
-
//Display header
-
$sec = $objSections->GetSection($section);
-
$objListToolbar = new clsToolBar();
-
$objListToolbar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","edit_submit('language','LangEditStatus','".$admin."/config/config_lang.php',1);",$imagesURL."/toolbar/tool_select.gif");
-
$objListToolbar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('language','LangEditStatus','".$admin."/config/config_lang.php',2);",$imagesURL."/toolbar/tool_cancel.gif");
-
-
if ( isset($en_prev) || isset($en_next) )
-
{
-
$url = $admin."/config/addlang.php";
-
$objListToolbar->Add("divider");
-
$form = "language";
-
if($en_prev>-1)
-
{
-
$MouseOver="swap('moveleft','toolbar/tool_prev_f2.gif');";
-
$MouseOut="swap('moveleft', 'toolbar/tool_prev.gif');";
-
$onClick= $sec->Get("onclick");
-
$var="env=".BuildEnv()."&en=$en_prev";
-
$link = "javascript:edit_submit('$form','$url',0,'$var');";
-
$objListToolbar->Add("moveleft",admin_language("la_ToolTip_Previous")." ".admin_language("la_Text_Category"),$link,$MouseOver,$MouseOut,"","toolbar/tool_prev.gif");
-
}
-
else
-
{
-
$MouseOver="";
-
$MouseOut="";
-
$onClick="";
-
$link="#";
-
$objListToolbar->Add("moveleft",admin_language("la_ToolTip_Previous")." ".admin_language("la_Text_Category"),"#","","","","toolbar/tool_prev_f3.gif");
-
-
}
-
if($en_next>-1)
-
{
-
$MouseOver="swap('moveright','toolbar/tool_next_f2.gif');";
-
$MouseOut="swap('moveright', 'toolbar/tool_next.gif');";
-
$onClick=$sec->Get("onclick");
-
$var="env=".BuildEnv()."&en=$en_next";
-
$link = "javascript:edit_submit('$form','$url',0,'$var');";
-
$objListToolbar->Add("moveright",admin_language("la_ToolTip_Next")." ".admin_language("la_Text_Category"),$link,$MouseOver,$MouseOut,"","toolbar/tool_next.gif");
-
}
-
else
-
{
-
$objListToolbar->Add("moveright",admin_language("la_ToolTip_Next")." ".admin_language("la_Text_Category"),$link,$MouseOver,$MouseOut,"","toolbar/tool_next_f3.gif");
-
}
-
}
-
-
int_header($objListToolbar,NULL,$title);
-
if ($objSession->GetVariable("HasChanges") == 1) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Save_Item")); ?>
</td>
</tr>
</table>
<?php } ?>
-
<FORM enctype="multipart/form-data" ID="language" NAME="language" method="POST" ACTION="">
-
<TABLE cellSpacing="0" cellPadding="2" width="100%" class="tableborder">
-
<?php int_subsection_title(prompt_language("la_tab_General")); ?>
-
<?php $c->Data=inp_htmlize($c->Data);?>
-
<TR <?php int_table_color(); ?> >
-
<TD class="text"><?php echo prompt_language("la_prompt_LanguageId"); ?></TD>
-
<TD><?php echo $c->Get("LanguageId"); ?></TD>
-
<TD></TD>
-
</TR>
-
-
<TR <?php int_table_color(); ?> >
-
<TD><SPAN id="prompt_packname" class="text"><?php echo prompt_language("la_prompt_PackName"); ?></SPAN></TD>
-
<TD><input type=text ValidationType="exists" tabindex="1" NAME="packname" VALUE="<?php echo $c->Get("PackName"); ?>"></TD>
-
<TD></TD>
-
</TR>
-
-
<TR <?php int_table_color(); ?> >
-
<TD><SPAN id="prompt_localname"><?php echo prompt_language("la_prompt_LocalName"); ?></SPAN></TD>
-
<TD><input type=text ValidationType="exists" tabindex="2" NAME="localname" VALUE="<?php echo $c->Get("LocalName"); ?>"></TD>
-
<TD></TD>
-
</TR>
-
-
-
+<!-- charset: begin -->
+<TR <?php int_table_color(); ?> >
+ <TD><SPAN id="prompt_theme_charset"><?php echo prompt_language("la_prompt_charset"); ?></SPAN></TD>
+ <TD><input type=text NAME="charset" tabindex="3" VALUE="<?php echo $c->Get("Charset"); ?>"></TD>
+ <TD></TD>
+</TR>
+<!-- charset: end -->
<TR <?php int_table_color(); ?> >
-
<TD><SPAN id="prompt_theme_icon"><?php echo prompt_language("la_prompt_icon_url"); ?></SPAN></TD>
-
<TD><input type=text NAME="icon" tabindex="3" VALUE="<?php echo $c->Get("IconUrl"); ?>"></TD>
-
<TD></TD>
-
</TR>
-
-
<TR <?php int_table_color(); ?> >
-
<TD><SPAN id="prompt_dateformat"><?php echo prompt_language("la_prompt_lang_dateformat"); ?></SPAN></TD>
-
<TD><input type=text NAME="date_format" tabindex="4" VALUE="<?php echo $c->Get("DateFormat"); ?>">
-
<?php if(strlen($c->Get("DateFormat"))) echo prompt_language("la_Text_example").":".date($c->Get("DateFormat")); ?>
-
</TD>
-
<TD></TD>
-
</TR>
-
-
<TR <?php int_table_color(); ?> >
-
<TD><SPAN id="prompt_timeformat"><?php echo prompt_language("la_prompt_lang_timeformat"); ?></SPAN></TD>
-
<TD><input type=text NAME="time_format" tabindex="5" VALUE="<?php echo $c->Get("TimeFormat"); ?>">
-
<?php if(strlen($c->Get("TimeFormat"))) echo prompt_language("la_Text_example").":".date($c->Get("TimeFormat")); ?>
-
</TD>
-
<TD></TD>
-
</TR>
-
-
<TR <?php int_table_color(); ?> >
-
<TD><SPAN id="prompt_lang_decimal"><?php echo prompt_language("la_prompt_decimal"); ?></SPAN></TD>
-
<TD><input type=text ValidationType="exists" tabindex="6" NAME="decimal" VALUE="<?php echo $c->Get("DecimalPoint"); ?>"></TD>
-
<TD></TD>
-
</TR>
-
-
<TR <?php int_table_color(); ?> >
-
<TD><SPAN id="prompt_lang_thousand"><?php echo prompt_language("la_prompt_thousand"); ?></SPAN></TD>
-
<TD><input type=text NAME="thousand" tabindex="7" VALUE="<?php echo $c->Get("ThousandSep"); ?>"></TD>
-
<TD></TD>
-
</TR>
-
-
<tr <?php int_table_color(); ?>>
-
<td valign="top" class="text"><?php echo prompt_language("la_prompt_Enabled"); ?></td>
-
<td>
-
<input type="checkbox" name="enabled" tabindex="8" class="text" value="1" <?php if($c->Get("Enabled") == 1) echo "checked"; ?>>
-
</td>
-
<td class="text">&nbsp;</td>
-
</tr>
-
-
<tr <?php int_table_color(); ?>>
-
<td valign="top" class="text"><?php echo prompt_language("la_prompt_Primary"); ?></td>
-
<td>
-
<input type="checkbox" name="primary" tabindex="9" class="text" value="1" <?php if($c->Get("PrimaryLang") == 1) echo "checked"; ?>>
-
</td>
-
<td class="text">&nbsp;</td>
-
</tr>
-
<tr <?php int_table_color(); ?>>
-
<td valign="top" class="text"><?php echo prompt_language("la_prompt_CopyLabels"); ?></td>
-
<td>
-
<input type="checkbox" name="importlabels" tabindex="10" class="text" value="1">
-
<SELECT NAME="srcpack">
-
<OPTION VALUE="0">--<?php echo prompt_language("la_prompt_Select_Source"); ?>
-
<?php
-
$ado = &GetADODBConnection();
-
$sql = "SELECT * FROM ".GetTablePrefix()."Language";
-
$rs = $ado->Execute($sql);
-
while($rs && !$rs->EOF)
-
{
-
echo "<OPTION VALUE=\"".$rs->fields["LanguageId"]."\">".$rs->fields["PackName"]."\n";
-
$rs->MoveNext();
-
}
-
?>
-
</SELECT>
-
-
</td>
-
<td class="text">
-
</td>
-
<input type=hidden NAME="Action" VALUE="<?php echo $action; ?>">
-
<INPUT TYPE="hidden" NAME="LanguageId" VALUE="<?php echo $c->Get("LanguageId"); ?>">
-
<input type="hidden" name="LangEditStatus" VALUE="0">
-
</tr>
-
-
</TABLE>
-
</FORM>
-
<!-- CODE FOR VIEW MENU -->
-
<form 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>
-
<!-- END CODE-->
-
<?php int_footer(); ?>
\ No newline at end of file
Property changes on: trunk/admin/config/addlang.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.7
\ No newline at end of property
+1.8
\ No newline at end of property
Index: trunk/admin/config/email_edit.php
===================================================================
--- trunk/admin/config/email_edit.php (revision 897)
+++ trunk/admin/config/email_edit.php (revision 898)
@@ -1,252 +1,253 @@
<?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;
//print_r($_GET);
//print_r($_POST);
require_once($pathtoroot."kernel/startup.php");
//admin only util
/* set the destination of the image upload, relative to the root path */
$DestDir = "kernel/images/";
$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";
$cssURL = $adminURL."/include";
$browseURL = $adminURL."/browse";
//$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
//require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/browse/toolbar.php");
//require_once($pathtoroot.$admin."/listview/listview.php");
require_once($pathtoroot.$admin."/editor/FCKeditor/fckeditor.php");
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot. $value."admin/include/parser.php";
if(file_exists($path))
{
include_once($path);
}
}
$objLangEdit = new clsLanguageList();
$objLangEdit->SourceTable = $objSession->GetEditTable("Language");
$objLangEdit->EnablePaging = FALSE;
$en = (int)$_GET["en"];
$objLangEdit->Query_Item("SELECT * FROM ".$objLangEdit->SourceTable);
$itemcount=$objLangEdit->NumItems();
$l = $objLangEdit->GetItemByIndex($en);
$LangId = $l->Get("LanguageId");
unset($objEditItems);
$objEditItems = new clsEmailMessageList();
$objEditItems->SourceTable = $objSession->GetEditTable("EmailMessage");
$objEditItems->EnablePaging = FALSE;
if(is_array($_POST["itemlist"]))
{
$EventId = $_POST["itemlist"][0];
}
else
{
$EventId = $_POST["itemlist"];
}
$m = $objEditItems->GetMessage($EventId,$LangId);
$objEvents = new clsEventList();
$ev = $objEvents->GetItem($EventId);
if($m===FALSE)
{
$m = new clsEmailMessage();
$m->tablename = $objEditItems->SourceTable;
$m->Set("EventId",$EventId);
$m->Set("LanguageId",$LangId);
$id = (int)GetMinValue($m->tablename,"EmailMessageId");
$m->Set("EmailMessageId",$id-1);
$m->Create();
$m->Set("EmailMessageId",$id-1);
$m->headers = explode("\n",$objConfig->Get("Smtp_DefaultHeaders"));
}
else
{
$m->ReadTemplate();
}
$subject = $m->subject;
if(strlen($subject))
$subject = substr($subject,strpos($subject,":")+2);
$action = "m_emailevent_edit";
$envar = "env=" . BuildEnv() . "&en=$en";
$section = 'in-portal:lang_email';
$ado = &GetADODBConnection();
/* page header */
+$charset = GetRegionalOption('Charset');
print <<<END
<html>
<head>
<title>In-portal</title>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="content-type" content="text/html;charset=$charset">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
imagesPath='$imagesURL'+'/';
</script>
<script src="$browseURL/common.js"></script>
<script src="$browseURL/toolbar.js"></script>
<script src="$browseURL/utility.js"></script>
<script src="$browseURL/checkboxes.js"></script>
<script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
<link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
<link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
END;
$objListToolBar = new clsToolBar();
$objListToolBar->Add("msg_save", "la_Save","#","swap('msg_save','toolbar/tool_select_f2.gif');", "swap('msg_save', 'toolbar/tool_select.gif');","edit_submit('language','LangEditStatus','".$admin."/config/addlang_email.php',0);",$imagesURL."/toolbar/tool_select.gif");
$objListToolBar->Add("msg_cancel", "la_Cancel","#","swap('msg_cancel','toolbar/tool_cancel_f2.gif');", "swap('msg_cancel', 'toolbar/tool_cancel.gif');","msg_submit('language','".$admin."/config/addlang_email.php');", $imagesURL."/toolbar/tool_cancel.gif");
$title = prompt_language("la_Text_Editing")." ".prompt_language("la_Text_MailEvent")." '".prompt_language($ev->Get("Description"))."'";
if($ev->Get("Type")==0)
{
$title .= " - ".prompt_language("la_Text_User");
}
else
$title .= " - ".prompt_language("la_Text_Admin");
int_header($objListToolBar,NULL,$title);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
<form ID="language" name="langage" action="" method=POST>
<input type="hidden" name="LangEditStatus" VALUE="0">
<INPUT TYPE="HIDDEN" NAME="Action" VALUE="m_emailevent_edit">
<INPUT TYPE="HIDDEN" NAME="MessageId" VALUE="<?php echo $m->Get("EmailMessageId"); ?>">
<?php int_subsection_title(prompt_language("la_tab_General")); ?>
<tr <?php int_table_color(); ?>>
<td valign="top"><span class="text"><?php echo prompt_language("la_prompt_Subject"); ?></span></td>
<td>
<input type="text" tabindex="1" name="subject" class="text" size="60" value="<?php echo htmlspecialchars($subject); ?>">
</td>
<td></td>
</tr>
<TR <?php int_table_color(); ?>>
<td valign="top"><span class="text"><?php echo prompt_language("la_prompt_sendmethod"); ?></SPAN></TD>
<TD><span class="text">
<input type="RADIO" tabindex="2" NAME="sendhtml" VALUE="0" <?php if($m->Get("MessageType")!="html") echo "CHECKED"; ?>><?php echo prompt_language("la_prompt_plaintext"); ?>
<INPUT TYPE="RADIO" tabindex="2" NAME="sendhtml" VALUE="1" <?php if($m->Get("MessageType")=="html") echo "CHECKED"; ?>><?php echo prompt_language("la_prompt_html"); ?>
</span>
</td>
<td></td>
</TR>
<tr <?php int_table_color(); ?>>
<td valign="top"><span class="text"><?php echo prompt_language("la_prompt_headers"); ?></span></td>
<td>
<textarea name="headers" tabindex="3" id="headers" rows="5" cols="60"><?php echo implode("\n",$m->headers); ?></textarea>
</td>
<td></td>
</tr>
<?php int_subsection_title(prompt_language("la_tab_Message")); ?>
<tr <?php int_table_color(); ?>>
<td valign="top" COLSPAN=3>
<?php
// $oFCKeditor = new FCKeditor();
// $oFCKeditor->Value = $m->body;
// $oFCKeditor->CreateFCKeditor( 'messageBody', '100%',300 ) ;
?>
<TEXTAREA name="messageBody" rows=20 cols=85><?php echo $m->body; ?></TEXTAREA>
</td>
</tr>
</FORM>
</TABLE>
<?php int_footer(); ?>
Property changes on: trunk/admin/config/email_edit.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/config/importlang_progress.php
===================================================================
--- trunk/admin/config/importlang_progress.php (revision 897)
+++ trunk/admin/config/importlang_progress.php (revision 898)
@@ -1,337 +1,344 @@
<?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;
$FrontEnd=2;
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-link/";
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");
include_once($pathtoroot."kernel/include/xml.php");
$section = "in-portal:lang_import";
$ado = &GetADODBConnection();
$MaxInserts = 200;
$PhraseTable = "ses_".$objSession->GetSessionKey()."_".GetTablePrefix()."ImportPhrases";
$EventTable = "ses_".$objSession->GetSessionKey()."_".GetTablePrefix()."ImportEvents";
$OverWrite = $_POST['overwrite'];
if(count($_POST)>0)
{
$Offset = 0;
$CurrentLang=0;
$file = $_FILES["lang_file"];
if(is_array($file))
{
if((int)$file["size"]>0)
{
$filename = $pathtoroot.$admin."/export/".$file["name"];
move_uploaded_file($file["tmp_name"],$filename)?1:0;
@chmod($filename, 0666);
if(file_exists($filename))
{
/* parse xml file */
$fp = @fopen($filename,"r");
$xml = @fread($fp,filesize($filename));
@fclose($fp);
$objInXML = new xml_doc($xml);
$objInXML->parse();
$ado->Execute("DROP TABLE IF EXISTS $PhraseTable");
$ado->Execute("DROP TABLE IF EXISTS $EventTable");
$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 = "ALTER TABLE $EventTable ADD `Type` INT(11) default 0";
//$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();
}
$objInXML->getTag(0,$name,$attribs,$contents,$tags);
if(is_array($tags))
{
foreach($tags as $t)
{
$LangRoot =& $objInXML->getTagByID($t);
$PackName = $LangRoot->attributes["PACKNAME"];
$l = $objLanguages->GetItemByField("PackName",$PackName);
if(is_object($l))
{
$LangId = $l->Get("LanguageId");
}
else
{
$l = new clsLanguage();
$l->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);
+ mysql_query($psql,$ado->_connectionID);
+ //$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 'CHARSET':
+ $Charset = $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);
+ mysql_query($esql,$ado->_connectionID);
+ //$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->Set('Charset', (isset($Charset)&&$Charset)?$Charset:'iso-8859-1');
$l->Update();
}
}
}
$Types = implode(",",$_POST["langtypes"]);
$objSession->SetVariable("lang_types",$Types);
$objSession->SetVariable("lang_overwrite",(int)$_POST["overwrite"]);
$Total = $Types?TableCount($PhraseTable,"PhraseType IN ($Types)",0):0;
$objSession->SetVariable("phrase_total",$Total);
$Total = TableCount($EventTable,"",0);
$objSession->SetVariable("event_total",$Total);
$Offset = 0;
$Status = 0;
//unlink($filename);
}
}
}
}
}
else
{
$Offset = (int)$_GET["Offset"];
$Status = (int)$_GET["Status"];
$OverWrite = $objSession->GetVariable("lang_overwrite");
$Types = $objSession->GetVariable("lang_types");
if($Status==0)
{
$Total = $objSession->GetVariable("phrase_total");
}
else
$Total = $objSession->GetVariable("event_total");
}
//echo $Total;
if ($Total == "") {
$url = $adminURL."/config/importlang.php?env=".BuildEnv()."&importerror=1";
Header("Location: $url");
//reload($url);
}
$title = admin_language("la_Text_LangImport")." - ".admin_language("la_Step")." 2";
int_header(NULL,NULL, $title);
?>
<TABLE cellSpacing="0" cellPadding="2" width="100%" class="tableborder">
<?php
if($Status==0)
{
$Total = $objSession->GetVariable("phrase_total");
stats(prompt_language("la_lang_import_progress"),$Offset,$Total);
$Offset = $objLanguages->ReadImportTable($PhraseTable,1,$Types,$OverWrite,$MaxInserts,$Offset);
if($Offset<$Total)
{
$url = $_SERVER["PHP_SELF"]."?env=".BuildEnv()."&Offset=$Offset&Status=0";
}
else
{
if($objSession->GetVariable("event_total")>0)
{
$url = $_SERVER["PHP_SELF"]."?env=".BuildEnv()."&Offset=0&Status=1";
}
else
{
$ado->Execute("DROP TABLE IF EXISTS $PhraseTable");
$ado->Execute("DROP TABLE IF EXISTS $EventTable");
$url = $adminURL."/config/config_lang.php?env=".BuildEnv();
}
}
reload($url);
}
else
{
$Total = $objSession->GetVariable("event_total");
$Offset = $objMessageList->ReadImportTable($EventTable,$OverWrite,$MaxInserts,$Offset);
if($Offset<$Total)
{
$url = $_SERVER["PHP_SELF"]."?env=".BuildEnv()."&Offset=$Offset&Status=1";
}
else
{
$ado->Execute("DROP TABLE IF EXISTS $PhraseTable");
$ado->Execute("DROP TABLE IF EXISTS $EventTable");
$url = $adminURL."/config/config_lang.php?env=".BuildEnv();
}
stats(prompt_language("la_event_import_progress"),$Offset,$Total);
reload($url);
}
function stats($caption,$myprogress,$totalnum)
{
global $rootURL, $CancelURL, $PageTitle;
if($totalnum>0)
{
$pct=round(($myprogress/ $totalnum)*100);
}
else
$pct = 100;
$o .="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\" class=\"tableborder\">";
echo "\n";
$o .= int_subsection_title_ret($caption." - ".$pct."%");
$o .= "<TR><TD align=\"middle\"><br />";
$o .= " <TABLE CLASS=\"tableborder_full\" width=\"75%\">";
$o .=" <TR border=1><TD width=\"".$pct."%\" STYLE=\"background:url('".$rootURL."admin/images/progress_bar_segment.gif');\">&nbsp;</TD>";
$comp_pct = 100-$pct;
$o .= " <TD bgcolor=#FFFFFF width=\"".$comp_pct."%\"></TD></TR>";
$o .= " </TABLE>";
$o .= " <BR /><input type=button VALUE=\"".admin_language("la_Cancel")."\" CLASS=\"button\" ONCLICK=\"document.location='".$CancelURL."config_lang.php?env=".BuildEnv()."&action=cancel';\">";
echo $o."\n";
echo "</TD></TR></TABLE>";
}
function reload($url)
{
print "<script language=\"javascript\">" ;
print "setTimeout(\"document.location='$url';\",100);";
print " </script>";
//echo "<A HREF=\"$url\">Next </A>";
}
?>
<?php int_footer(); ?>
Property changes on: trunk/admin/config/importlang_progress.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.7
\ No newline at end of property
Index: trunk/admin/config/addcustomfield.php
===================================================================
--- trunk/admin/config/addcustomfield.php (revision 897)
+++ trunk/admin/config/addcustomfield.php (revision 898)
@@ -1,260 +1,261 @@
<?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;
//print_r($_GET);
//print_r($_POST);
require_once($pathtoroot."kernel/startup.php");
//admin only util
/* set the destination of the image upload, relative to the root path */
$DestDir = "kernel/images/";
$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";
$cssURL = $adminURL."/include";
$browseURL = $adminURL."/browse";
$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/browse/toolbar.php");
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);
}
}
$FieldType = (int)$_GET["DataType"];
if($FieldType==0)
$FieldType = (int)$_POST["DataType"];
$objCustomFields = new clsCustomFieldList($FieldType);
//$objEditItems->SourceTable = $objSession->GetEditTable("Images");
if(isset($_POST["itemlist"]))
{
if(is_array($_POST["itemlist"]))
{
$FieldId = $_POST["itemlist"][0];
}
else
{
$FieldId = $_POST["itemlist"];
}
$c = $objCustomFields->GetItem($FieldId);
$action = "m_customfield_edit";
$name = $c->Get("FieldName");
}
else
{
$c = new clsCustomField();
$c->Set("Type",$DataType);
$action = "m_customfield_add";
$name = prompt_language("la_Text_NewField");
}
$section = $_GET["section"];
if(strlen($section)==0)
$section = $_POST["section"];
$section_env = "section=$section&DataType=$FieldType";
$envar = "$section_env&env=".BuildEnv();
$ado = &GetADODBConnection();
/* page header */
+$charset = GetRegionalOption('Charset');
print <<<END
<html>
<head>
<title>In-portal</title>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="content-type" content="text/html;charset=$charset">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
imagesPath='$imagesURL'+'/';
</script>
<script src="$browseURL/common.js"></script>
<script src="$browseURL/toolbar.js"></script>
<script src="$browseURL/utility.js"></script>
<script src="$browseURL/checkboxes.js"></script>
<script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
<link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
<link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
END;
$title = GetTitle("la_Text_CustomField", '', $FieldId, $name);//prompt_language("la_Text_Editing")." ".prompt_language("la_Text_CustomField")." ".prompt_language("la_text_for")." ".prompt_language("la_Text_DataType_".$_GET["DataType"]);
$title .= " ".prompt_language("la_text_for")." ".prompt_language("la_Text_DataType_".$_GET["DataType"]);
$objCatToolBar = new clsToolBar();
$objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","submit_form('customfield','','".$admin."/config/edit_customfields.php',0,'&$section_env');",$imagesURL."/toolbar/tool_select.gif");
$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","submit_form('customfield','','".$admin."/config/edit_customfields.php',-1,'&$section_env');",$imagesURL."/toolbar/tool_cancel.gif");
int_header($objCatToolBar,NULL,$title);
?>
<FORM enctype="multipart/form-data" ID="customfield" NAME="customfield" method="POST" ACTION="">
<TABLE cellSpacing="0" cellPadding="2" width="100%" class="tableborder">
<?php int_subsection_title(prompt_language("la_tab_General")); ?>
<TR <?php int_table_color(); ?> >
<TD><?php echo prompt_language("la_prompt_FieldId"); ?></TD>
<TD><?php echo $c->Get("CustomFieldId"); ?></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><SPAN id="prompt_fieldname"><?php echo prompt_language("la_prompt_FieldName"); ?></SPAN></TD>
<TD><input ValidationType="exists" tabindex="1" type=text NAME="fieldname" VALUE="<?php echo $c->Get("FieldName"); ?>"></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><SPAN id="prompt_fieldlabel"><?php echo prompt_language("la_prompt_FieldLabel"); ?></SPAN></TD>
<td><?php if(strlen($c->Get("FieldName"))) echo "lu_fieldcustom__".$c->Get("FieldName"); ?>:
<?php echo prompt_language("lu_fieldcustom__".$c->Get("FieldName"),0); ?>
</td>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<td colspan="3">
<input type=hidden NAME="Action" VALUE="<?php echo $action; ?>">
<INPUT TYPE="hidden" NAME="CustomFieldId" VALUE="<?php echo $c->Get("CustomFieldId"); ?>">
<input TYPE="HIDDEN" NAME="DataType" VALUE="<?php echo $_GET["DataType"]; ?>">
</td>
</tr>
<?php int_subsection_title(prompt_language("la_tab_AdminUI")); ?>
<TR <?php int_table_color(); ?> >
<TD><SPAN id="prompt_generaltab"><?php echo prompt_language("la_prompt_showgeneraltab"); ?></SPAN></TD>
<TD><input type=checkbox NAME="generaltab" tabindex="2" VALUE="1" <?php if ($c->Get("OnGeneralTab")) echo "CHECKED"; ?>></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><SPAN id="prompt_heading"><?php echo prompt_language("la_prompt_heading"); ?></SPAN></TD>
<TD><input type=text NAME="heading" tabindex="3" VALUE="<?php echo $c->Get("Heading"); ?>"></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><SPAN id="prompt_fieldprompt"><?php echo prompt_language("la_prompt_FieldPrompt"); ?></SPAN></TD>
<TD><input type=text NAME="fieldprompt" tabindex="4" VALUE="<?php echo $c->Get("Prompt"); ?>"></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD><SPAN id="prompt_input_type"><?php echo prompt_language("la_prompt_InputType"); ?></SPAN></TD>
<td>
<SELECT name="input_type" tabindex="5">
<option VALUE="text" <?php if($c->Get("ElementType")=="text") echo "SELECTED"; ?>><?php echo admin_language("la_type_text"); ?></OPTION>
<option VALUE="select" <?php if($c->Get("ElementType")=="select") echo "SELECTED"; ?>><?php echo admin_language("la_type_select"); ?></OPTION>
<option VALUE="radio" <?php if($c->Get("ElementType")=="radio") echo "SELECTED"; ?>><?php echo admin_language("la_type_radio"); ?></OPTION>
<option VALUE="password" <?php if($c->Get("ElementType")=="password") echo "SELECTED"; ?>><?php echo admin_language("la_type_password"); ?></OPTION>
<option VALUE="textarea" <?php if($c->Get("ElementType")=="textarea") echo "SELECTED"; ?>><?php echo admin_language("la_type_textarea"); ?></OPTION>
<option VALUE="label" <?php if($c->Get("ElementType")=="label") echo "SELECTED"; ?>><?php echo admin_language("la_type_label"); ?></OPTION>
</SELECT>
</td>
<td></td>
</TR>
<TR <?php int_table_color(); ?> >
<TD><SPAN id="prompt_valuelist"><?php echo prompt_language("la_prompt_valuelist"); ?></SPAN></TD>
<TD><input type=text tabindex="6" NAME="valuelist" VALUE="<?php echo $c->Get("ValueList"); ?>"></TD>
<TD></TD>
</TR>
<TR <?php int_table_color(); ?> >
<TD></TD>
<td><?php echo prompt_language("la_valuelist_help"); ?></td>
<td></td>
</tr>
</FORM>
</TABLE>
<!-- CODE FOR VIEW MENU -->
<form method="post" action="user_groups.php?<?php echo $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>
<!-- END CODE-->
<?php int_footer(); ?>
Property changes on: trunk/admin/config/addcustomfield.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/prerequisit_errors.php
===================================================================
--- trunk/admin/install/prerequisit_errors.php (revision 897)
+++ trunk/admin/install/prerequisit_errors.php (revision 898)
@@ -1,133 +1,140 @@
<?php
define('THIS_FILE', 'admin/install/prerequisit_errors.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['HTTP_HOST'].$_SERVER['SCRIPT_NAME']);
$rootURL = str_replace('/install','',$rootURL);
$tmp = explode('/', $rootURL);
if( $tmp[ count($tmp) - 1 ] == $admin) unset( $tmp[ count($tmp) - 1 ] );
$rootURL = implode('/', $tmp).'/';
unset($tmp);
$prerequisit_path = $pathtoroot.$pathchar.$_GET['module'].$pathchar."admin".$pathchar."install".$pathchar."prerequisit.php";
function print_pre($s)
{
echo '<pre>'.print_r($s, true).'</pre>';
}
-
+if( function_exists('GetRegionalOption') )
+{
+ $charset = GetRegionalOption('Charset');
+}
+else
+{
+ $charset = 'iso-8859-1';
+}
?>
<html>
<head>
<title>In-Portal - Module Errors</title>
- <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
+ <meta http-equiv="content-type" content="text/html;charset=<?php echo $charset; ?>">
<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; ?>install/ic_install.gif" align="absmiddle">&nbsp;Module Errors<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; ?>inst_bg.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($prerequisit_path) )
{
$pathtoroot .= $pathchar;
$show_errors = true;
include_once($prerequisit_path);
}
?>
</h3> </div>
</td>
</tr>
</table>
</body>
</html>
\ No newline at end of file
Property changes on: trunk/admin/install/prerequisit_errors.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/admin/install/upgrades/inportal_upgrade_v1.0.10.sql
===================================================================
--- trunk/admin/install/upgrades/inportal_upgrade_v1.0.10.sql (revision 897)
+++ trunk/admin/install/upgrades/inportal_upgrade_v1.0.10.sql (revision 898)
@@ -1,15 +1,16 @@
ALTER TABLE Category DROP INDEX ResourceId, ADD UNIQUE ResourceId (ResourceId);
ALTER TABLE PortalGroup DROP INDEX ResourceId, ADD UNIQUE ResourceId (ResourceId);
ALTER TABLE PortalUser DROP INDEX ResourceId, ADD UNIQUE ResourceId (ResourceId);
ALTER TABLE PortalUser ADD PassResetTime BIGINT(20);
INSERT INTO Events VALUES (67, 'USER.PSWDC', '1', '0', 'In-Portal:Users', 'la_event_user.pswd_confirm', '0');
INSERT INTO ConfigurationAdmin VALUES ('Users_AllowReset', 'la_Text_General', 'la_prompt_allow_reset', 'text', NULL, NULL, 3, 0);
INSERT INTO ConfigurationValues VALUES ('Users_AllowReset', '180', 'In-Portal:Users', 'in-portal:configure_users');
INSERT INTO ConfigurationValues VALUES ('Search_MinKeyword_Length', '3', 'In-Portal', '');
+ALTER TABLE Language ADD Charset varchar(20) NOT NULL default '';
UPDATE Modules SET Version = '1.0.10' WHERE Name = 'In-Portal';
\ No newline at end of file
Property changes on: trunk/admin/install/upgrades/inportal_upgrade_v1.0.10.sql
___________________________________________________________________
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/inportal_schema.sql
===================================================================
--- trunk/admin/install/inportal_schema.sql (revision 897)
+++ trunk/admin/install/inportal_schema.sql (revision 898)
@@ -1,611 +1,612 @@
CREATE TABLE BanRules (
RuleId int(11) NOT NULL auto_increment,
RuleType tinyint(4) NOT NULL default '0',
ItemField varchar(255) default NULL,
ItemVerb tinyint(4) NOT NULL default '0',
ItemValue varchar(255) NOT NULL default '',
ItemType int(11) NOT NULL default '0',
Priority int(11) NOT NULL default '0',
Status tinyint(4) NOT NULL default '1',
ErrorTag varchar(255) default NULL,
PRIMARY KEY (RuleId)
)
# --------------------------------------------------------
CREATE TABLE Category (
CategoryId int(11) NOT NULL auto_increment,
Type int(11) NOT NULL default '0',
ParentId int(11) NOT NULL default '0',
Name varchar(255) NOT NULL default '',
Description text NOT NULL,
CreatedOn double NOT NULL default '0',
EditorsPick tinyint(4) default NULL,
Status tinyint(4) NOT NULL default '0',
Pop tinyint(4) default NULL,
Priority int(11) default NULL,
MetaKeywords varchar(255) default NULL,
CachedDescendantCatsQty int(11) default NULL,
CachedNavbar text NOT NULL,
CreatedById int(11) NOT NULL default '0',
ResourceId int(11) default NULL,
ParentPath text NOT NULL,
MetaDescription varchar(255) default NULL,
HotItem int(11) NOT NULL default '2',
NewItem int(11) NOT NULL default '2',
PopItem int(11) NOT NULL default '2',
Modified double NOT NULL default '0',
ModifiedById int(11) NOT NULL default '0',
PRIMARY KEY (CategoryId),
KEY ParentId (ParentId),
UNIQUE KEY ResourceId (ResourceId),
KEY Modified (Modified),
KEY Priority (Priority),
KEY sorting (Name,Priority)
)
# --------------------------------------------------------
CREATE TABLE CategoryItems (
CategoryId int(11) NOT NULL default '0',
ItemResourceId int(11) NOT NULL default '0',
PrimaryCat tinyint(4) NOT NULL default '0',
PRIMARY KEY (CategoryId,ItemResourceId),
KEY ItemResourceId (ItemResourceId),
KEY PrimaryCat (PrimaryCat)
)
# --------------------------------------------------------
CREATE TABLE ConfigurationAdmin (
VariableName varchar(80) NOT NULL default '',
heading varchar(255) default NULL,
prompt varchar(255) default NULL,
element_type varchar(20) NOT NULL default '',
validation varchar(255) default NULL,
ValueList text default NULL,
DisplayOrder int(11) NOT NULL default '0',
Install int(11) NOT NULL default '1',
PRIMARY KEY (VariableName)
)
# --------------------------------------------------------
CREATE TABLE ConfigurationValues (
VariableName varchar(255) NOT NULL default '',
VariableValue varchar(255) default NULL,
ModuleOwner varchar(20) default 'In-Portal',
Section varchar(255) NOT NULL default '',
PRIMARY KEY (VariableName)
)
# --------------------------------------------------------
CREATE TABLE CountCache (
ListType int(11) NOT NULL default '0',
ItemType int(11) NOT NULL default '-1',
Value int(11) NOT NULL default '0',
CountCacheId int(11) NOT NULL auto_increment,
LastUpdate int(11) NOT NULL default '0',
ExtraId varchar(50) default NULL,
TodayOnly tinyint(4) NOT NULL default '0',
PRIMARY KEY (CountCacheId)
)
# --------------------------------------------------------
CREATE TABLE CustomField (
CustomFieldId int(11) NOT NULL auto_increment,
Type int(11) NOT NULL default '0',
FieldName varchar(255) NOT NULL default '',
FieldLabel varchar(40) default NULL,
Heading varchar(60) default NULL,
Prompt varchar(60) default NULL,
ElementType varchar(50) NOT NULL default '',
ValueList varchar(255) default NULL,
DisplayOrder int(11) NOT NULL default '0',
OnGeneralTab tinyint(4) NOT NULL default '0',
PRIMARY KEY (CustomFieldId),
KEY Type (Type)
)
# --------------------------------------------------------
CREATE TABLE CustomMetaData (
CustomDataId int(11) NOT NULL auto_increment,
ResourceId int(11) NOT NULL default '0',
CustomFieldId int(11) NOT NULL default '0',
Value text NOT NULL,
PRIMARY KEY (CustomDataId)
)
# --------------------------------------------------------
CREATE TABLE EmailMessage (
EmailMessageId int(10) NOT NULL auto_increment,
Template longtext,
MessageType enum('html','text') NOT NULL default 'text',
LanguageId int(11) NOT NULL default '0',
EventId int(11) NOT NULL default '0',
PRIMARY KEY (EmailMessageId)
)
# --------------------------------------------------------
CREATE TABLE EmailQueue (
Subject text NOT NULL,
toaddr text NOT NULL,
fromaddr text NOT NULL,
message blob,
headers blob,
queued timestamp NOT NULL
)
# --------------------------------------------------------
CREATE TABLE EmailSubscribers (
EmailMessageId int(11) NOT NULL default '0',
PortalUserId int(11) NOT NULL default '0'
)
# --------------------------------------------------------
CREATE TABLE Events (
EventId int(11) NOT NULL auto_increment,
Event varchar(40) NOT NULL default '',
Enabled int(11) NOT NULL default '1',
FromUserId int(11) NOT NULL default '0',
Module varchar(40) NOT NULL default '',
Description varchar(255) NOT NULL default '',
Type int(11) NOT NULL default '0',
PRIMARY KEY (EventId)
)
# --------------------------------------------------------
CREATE TABLE Favorites (
FavoriteId int(11) NOT NULL auto_increment,
PortalUserId int(11) NOT NULL default '0',
ResourceId int(11) NOT NULL default '0',
ItemTypeId int(11) NOT NULL default '0',
Modified int(11) NOT NULL default '0',
PRIMARY KEY (FavoriteId),
UNIQUE KEY main (PortalUserId,ResourceId)
)
# --------------------------------------------------------
CREATE TABLE IdGenerator (
lastid int(11) default NULL
)
# --------------------------------------------------------
CREATE TABLE Images (
ImageId int(11) NOT NULL auto_increment,
ResourceId int(11) NOT NULL default '0',
Url varchar(255) NOT NULL default '',
Name varchar(255) NOT NULL default '',
AltName varchar(255) default NULL,
ImageIndex int(11) NOT NULL default '0',
LocalImage tinyint(4) NOT NULL default '1',
LocalPath varchar(240) NOT NULL default '',
Enabled int(11) NOT NULL default '1',
DefaultImg int(11) NOT NULL default '0',
ThumbUrl varchar(255) default NULL,
Priority int(11) NOT NULL default '0',
ThumbPath varchar(255) default NULL,
LocalThumb tinyint(4) NOT NULL default '0',
SameImages tinyint(4) NOT NULL default '0',
PRIMARY KEY (ImageId),
KEY ResourceId (ResourceId)
)
# --------------------------------------------------------
CREATE TABLE ItemRating (
RatingId int(11) NOT NULL auto_increment,
IPAddress varchar(255) NOT NULL default '',
CreatedOn double NOT NULL default '0',
RatingValue int(11) NOT NULL default '0',
ItemId int(11) NOT NULL default '0',
PRIMARY KEY (RatingId)
)
# --------------------------------------------------------
CREATE TABLE ItemReview (
ReviewId int(11) NOT NULL auto_increment,
CreatedOn double NOT NULL default '0',
ReviewText longtext NOT NULL,
IPAddress varchar(255) NOT NULL default '',
ItemId int(11) NOT NULL default '0',
CreatedById int(11) NOT NULL default '0',
ItemType tinyint(4) NOT NULL default '0',
Priority int(11) NOT NULL default '0',
Status tinyint(4) NOT NULL default '0',
TextFormat int(11) NOT NULL default '0',
Module varchar(255) NOT NULL default '',
PRIMARY KEY (ReviewId)
)
# --------------------------------------------------------
CREATE TABLE ItemTypes (
ItemType int(11) NOT NULL default '0',
Module varchar(50) NOT NULL default '',
SourceTable varchar(100) NOT NULL default '',
TitleField varchar(50) default NULL,
CreatorField varchar(255) NOT NULL default '',
PopField varchar(255) default NULL,
RateField varchar(255) default NULL,
LangVar varchar(255) NOT NULL default '',
PrimaryItem int(11) NOT NULL default '0',
EditUrl varchar(255) NOT NULL default '',
ClassName varchar(40) NOT NULL default '',
ItemName varchar(50) NOT NULL default '',
PRIMARY KEY (ItemType),
KEY Module (Module)
)
# --------------------------------------------------------
CREATE TABLE Language (
LanguageId int(11) NOT NULL auto_increment,
PackName varchar(40) NOT NULL default '',
LocalName varchar(40) NOT NULL default '',
Enabled int(11) NOT NULL default '0',
PrimaryLang int(11) NOT NULL default '0',
IconURL varchar(255) default NULL,
DateFormat varchar(50) NOT NULL default '',
TimeFormat varchar(50) NOT NULL default '',
DecimalPoint char(2) NOT NULL default '.',
ThousandSep char(1) NOT NULL default ',',
+ Charset varchar(20) NOT NULL default '',
PRIMARY KEY (LanguageId)
)
# --------------------------------------------------------
CREATE TABLE Modules (
Name varchar(255) NOT NULL default '',
Path varchar(255) NOT NULL default '',
Var varchar(10) NOT NULL default '',
Version varchar(10) NOT NULL default '',
Loaded tinyint(4) NOT NULL default '1',
LoadOrder tinyint(4) NOT NULL default '0',
TemplatePath varchar(255) NOT NULL default '',
RootCat int(11) NOT NULL default '0',
BuildDate double NOT NULL default '0',
PRIMARY KEY (Name)
)
# --------------------------------------------------------
CREATE TABLE PermCache (
PermCacheId int(11) NOT NULL auto_increment,
CategoryId int(11) NOT NULL default '0',
PermId int(11) NOT NULL default '0',
ACL varchar(255) NOT NULL default '',
DACL varchar(255) NOT NULL default '',
PRIMARY KEY (PermCacheId),
KEY CategoryId (CategoryId),
KEY PermId (PermId)
)
# --------------------------------------------------------
CREATE TABLE PermissionConfig (
PermissionConfigId int(11) NOT NULL auto_increment,
PermissionName varchar(30) NOT NULL default '',
Description varchar(255) NOT NULL default '',
ErrorMessage varchar(255) NOT NULL default '',
ModuleId varchar(20) NOT NULL default '0',
PRIMARY KEY (PermissionConfigId),
KEY PermissionName (PermissionName)
)
# --------------------------------------------------------
CREATE TABLE Permissions (
PermissionId int(11) NOT NULL auto_increment,
Permission varchar(30) NOT NULL default '',
GroupId int(11) default '0',
PermissionValue int(11) NOT NULL default '0',
Type tinyint(4) NOT NULL default '0',
CatId int(11) NOT NULL default '0',
PRIMARY KEY (PermissionId)
)
# --------------------------------------------------------
CREATE TABLE PersistantSessionData (
PortalUserId int(11) NOT NULL default '0',
VariableName varchar(255) NOT NULL default '',
VariableValue text NOT NULL,
KEY UserId (PortalUserId),
KEY VariableName (VariableName)
)
# --------------------------------------------------------
CREATE TABLE Phrase (
Phrase varchar(255) NOT NULL default '',
Translation varchar(255) NOT NULL default '',
PhraseType int(11) NOT NULL default '0',
PhraseId int(11) NOT NULL auto_increment,
LanguageId int(11) NOT NULL default '0',
PRIMARY KEY (PhraseId),
INDEX Phrase_Index (Phrase)
)
# --------------------------------------------------------
CREATE TABLE PhraseCache (
Template varchar(40) NOT NULL default '',
PhraseList text NOT NULL,
CacheDate int(11) NOT NULL default '0',
ThemeId int(11) NOT NULL default '0',
PRIMARY KEY (Template)
)
# --------------------------------------------------------
CREATE TABLE PortalGroup (
GroupId int(11) NOT NULL auto_increment,
Name varchar(255) NOT NULL default '',
Description varchar(255) default NULL,
CreatedOn double NOT NULL default '0',
System tinyint(4) NOT NULL default '0',
Personal tinyint(4) NOT NULL default '0',
Enabled tinyint(4) NOT NULL default '1',
ResourceId int(11) NOT NULL default '0',
PRIMARY KEY (GroupId),
UNIQUE KEY Name (Name),
UNIQUE KEY ResourceId (ResourceId),
KEY Personal (Personal),
KEY Enabled (Enabled)
)
# --------------------------------------------------------
CREATE TABLE PortalUser (
PortalUserId int(11) NOT NULL auto_increment,
Login varchar(255) default NULL,
Password varchar(255) default NULL,
FirstName varchar(255) default NULL,
LastName varchar(255) default NULL,
Email varchar(255) NOT NULL default '',
CreatedOn double NOT NULL default '0',
Phone varchar(20) default NULL,
Street varchar(255) default NULL,
City varchar(20) default NULL,
State varchar(20) default NULL,
Zip varchar(20) default NULL,
Country varchar(20) NOT NULL default '',
ResourceId int(11) NOT NULL default '0',
Status tinyint(4) NOT NULL default '2',
Modified int(11) NOT NULL default '0',
dob double NOT NULL default '0',
tz int(11) default NULL,
ip varchar(20) default NULL,
IsBanned tinyint(1) NOT NULL default '0',
PassResetTime bigint(20),
PRIMARY KEY (PortalUserId),
UNIQUE KEY Login (Login),
UNIQUE KEY ResourceId (ResourceId),
KEY CreatedOn (CreatedOn)
)
# --------------------------------------------------------
CREATE TABLE Relationship (
RelationshipId int(11) NOT NULL auto_increment,
SourceId int(11) default NULL,
TargetId int(11) default NULL,
SourceType tinyint(4) NOT NULL default '0',
TargetType tinyint(4) NOT NULL default '0',
Type int(11) NOT NULL default '0',
Enabled int(11) NOT NULL default '1',
Priority int(11) NOT NULL default '0',
PRIMARY KEY (RelationshipId),
KEY RelSource (SourceId),
KEY RelTarget (TargetId)
)
# --------------------------------------------------------
CREATE TABLE SearchConfig (
TableName varchar(40) NOT NULL default '',
FieldName varchar(40) NOT NULL default '',
SimpleSearch tinyint(4) NOT NULL default '0',
AdvancedSearch tinyint(4) NOT NULL default '0',
Description varchar(255) default NULL,
DisplayName varchar(80) default NULL,
ModuleName varchar(20) default NULL,
ConfigHeader varchar(255) default NULL,
DisplayOrder int(11) NOT NULL default '0',
SearchConfigId int(11) NOT NULL auto_increment,
Priority int(11) NOT NULL default '0',
FieldType varchar(20) NOT NULL default 'text',
ForeignField varchar(255) default NULL,
JoinClause varchar(255) default NULL,
IsWhere text,
IsNotWhere text,
ContainsWhere text,
NotContainsWhere text,
CustomFieldId int(11) NOT NULL default '0',
PRIMARY KEY (SearchConfigId)
)
# --------------------------------------------------------
CREATE TABLE SearchLog (
SearchLogId int(11) NOT NULL auto_increment,
Keyword varchar(255) NOT NULL default '',
Indices bigint(20) NOT NULL default '0',
SearchType int(11) NOT NULL default '0',
PRIMARY KEY (SearchLogId)
)
# --------------------------------------------------------
CREATE TABLE SessionData (
SessionKey varchar(50) NOT NULL default '',
VariableName varchar(255) NOT NULL default '',
VariableValue text NOT NULL,
KEY SessionKey (SessionKey),
KEY VariableName (VariableName)
)
# --------------------------------------------------------
CREATE TABLE SpamControl (
ItemResourceId int(11) NOT NULL default '0',
IPaddress varchar(20) NOT NULL default '',
Expire double NOT NULL default '0',
PortalUserId int(11) NOT NULL default '0',
DataType varchar(20) default NULL
)
# --------------------------------------------------------
CREATE TABLE StatItem (
StatItemId int(11) NOT NULL auto_increment,
Module varchar(20) NOT NULL default '',
ValueSQL varchar(255) default NULL,
ResetSQL varchar(255) default NULL,
ListLabel varchar(255) NOT NULL default '',
Priority int(11) NOT NULL default '0',
AdminSummary int(11) NOT NULL default '0',
PRIMARY KEY (StatItemId)
)
# --------------------------------------------------------
CREATE TABLE Theme (
ThemeId int(11) NOT NULL auto_increment,
Name varchar(40) NOT NULL default '',
Enabled int(11) NOT NULL default '1',
Description varchar(255) default NULL,
PrimaryTheme int(11) NOT NULL default '0',
CacheTimeout int(11) NOT NULL default '0',
PRIMARY KEY (ThemeId)
)
# --------------------------------------------------------
CREATE TABLE ThemeFiles (
FileId int(11) NOT NULL auto_increment,
ThemeId int(11) NOT NULL default '0',
FileName varchar(255) NOT NULL default '',
FilePath varchar(255) NOT NULL default '',
Description varchar(255) default NULL,
FileType int(11) NOT NULL default '0',
PRIMARY KEY (FileId),
KEY theme (ThemeId)
)
# --------------------------------------------------------
CREATE TABLE UserGroup (
PortalUserId int(11) NOT NULL default '0',
GroupId int(11) NOT NULL default '0',
PrimaryGroup tinyint(4) NOT NULL default '1',
PRIMARY KEY (PortalUserId,GroupId),
KEY GroupId (GroupId),
KEY PrimaryGroup (PrimaryGroup)
)
# --------------------------------------------------------
CREATE TABLE UserSession (
SessionKey varchar(50) NOT NULL default '',
CurrentTempKey varchar(50) default NULL,
PrevTempKey varchar(50) default NULL,
LastAccessed double NOT NULL default '0',
PortalUserId varchar(255) NOT NULL default '',
Language varchar(255) NOT NULL default '',
Theme varchar(255) NOT NULL default '',
GroupId int(11) NOT NULL default '0',
IpAddress varchar(20) NOT NULL default '0.0.0.0',
Status int(11) NOT NULL default '1',
GroupList varchar(255) default NULL,
tz int(11) default NULL,
PRIMARY KEY (SessionKey),
KEY UserId (PortalUserId),
KEY LastAccessed (LastAccessed)
)
# --------------------------------------------------------
CREATE TABLE SuggestMail (
email varchar(255) NOT NULL default '',
sent double,
PRIMARY KEY (email)
)
# --------------------------------------------------------
CREATE TABLE SysCache (
SysCacheId int(11) NOT NULL auto_increment,
Name varchar(255) NOT NULL default '',
Value mediumtext,
Expire double NOT NULL default '0',
Module varchar(20) default NULL,
Context varchar(255) default NULL,
GroupList varchar(255) NOT NULL default '',
PRIMARY KEY (SysCacheId),
KEY Name (Name)
)
# --------------------------------------------------------
CREATE TABLE TagLibrary (
TagId int(11) NOT NULL auto_increment,
name varchar(255) NOT NULL default '',
description text,
example text,
scope varchar(20) NOT NULL default 'global',
PRIMARY KEY (TagId)
)
# --------------------------------------------------------
CREATE TABLE TagAttributes (
AttrId int(11) NOT NULL auto_increment,
TagId int(11) NOT NULL default '0',
Name varchar(255) NOT NULL default '',
AttrType varchar(20) default NULL,
DefValue varchar(255) default NULL,
Description TEXT,
Required int(11) NOT NULL default '0',
PRIMARY KEY (AttrId)
)
# --------------------------------------------------------
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)
)
\ No newline at end of file
Property changes on: trunk/admin/install/inportal_schema.sql
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.9
\ No newline at end of property
+1.10
\ No newline at end of property
Index: trunk/globals.php
===================================================================
--- trunk/globals.php (revision 897)
+++ trunk/globals.php (revision 898)
@@ -1,1524 +1,1542 @@
<?php
$vars = parse_portal_ini($pathtoroot."config.php");
while($key = key($vars))
{
$key = "g_".$key;
global $$key;
$$key = current($vars); //variable variables
next($vars);
}
/*list the tables which contain item data */
$ItemTables = array();
$KeywordIgnore = array();
global $debuglevel;
$debuglevel = 0;
//$GLOBALS['debuglevel'] = 0;
/*New, Hot, Pop field values */
define('NEVER', 0);
define('ALWAYS', 1);
define('AUTO', 2);
/*Status Values */
define('STATUS_DISABLED', 0);
define('STATUS_ACTIVE', 1);
define('STATUS_PENDING', 2);
$LogLevel=0;
$LogFile = NULL;
function parse_portal_ini($file, $parse_section = false) {
if(!file_exists($file) && !is_readable($file))
die('Could Not Open Ini File');
$contents = file($file);
$retval = array();
$section = '';
$ln = 1;
$resave = false;
foreach($contents as $line) {
if ($ln == 1 && $line != '<'.'?'.'php die() ?'.">\n") {
$resave = true;
}
$ln++;
$line = trim($line);
$line = eregi_replace(';[.]*','',$line);
if(strlen($line) > 0) {
//echo $line . " - ";
if(eregi('^[[a-z]+]$',str_replace(' ', '', $line))) {
//echo 'section';
$section = substr($line,1,(strlen($line)-2));
if ($parse_section) {
$retval[$section] = array();
}
continue;
} elseif(eregi('=',$line)) {
//echo 'main element';
list($key,$val) = explode(' = ',$line);
if (!$parse_section) {
$retval[trim($key)] = str_replace('"', '', $val);
}
else {
$retval[$section][trim($key)] = str_replace('"', '', $val);
}
} //end if
//echo '<br />';
} //end if
} //end foreach
if ($resave) {
$fp = fopen($file, "w");
reset($contents);
fwrite($fp,'<'.'?'.'php die() ?'.">\n\n");
foreach($contents as $line) fwrite($fp,"$line");
fclose($fp);
}
return $retval;
}
/**
* @return object
* @desc Returns reference to database connection
*/
function &GetADODBConnection()
{
static $DB = null;
global $g_DBType, $g_DBHost, $g_DBUser, $g_DBUserPassword, $g_DBName, $g_DebugMode;
global $ADODB_FETCH_MODE, $ADODB_COUNTRECS, $ADODB_CACHE_DIR, $pathtoroot;
if( !isset($DB) && strlen($g_DBType) > 0 )
{
$DB = ADONewConnection($g_DBType);
$connected = $DB->Connect($g_DBHost, $g_DBUser, $g_DBUserPassword, $g_DBName);
if(!$connected) die("Error connecting to database $g_DBHost <br>\n");
$ADODB_CACHE_DIR = $pathtoroot."cache";
$ADODB_FETCH_MODE = 2;
$ADODB_COUNTRECS = false;
$DB->debug = defined('ADODB_OUTP') ? 1 : 0;
$DB->cacheSecs = 3600;
$DB->Execute('SET SQL_BIG_SELECTS = 1');
}
elseif( !strlen($g_DBType) )
{
global $rootURL;
echo 'In-Portal is probably not installed, or configuration file is missing.<br>';
echo 'Please use the installation script to fix the problem.<br><br>';
if ( !preg_match('/admin/', __FILE__) ) $ins = 'admin/';
echo '<a href="'.$rootURL.$ins.'install.php">Go to installation script</a><br><br>';
flush();
exit;
}
return $DB;
}
function GetNextResourceId($Increment=1)
{
$adodbConnection = &GetADODBConnection();
$sql = "LOCK TABLES ".GetTablePrefix()."IdGenerator WRITE";
$adodbConnection->Execute($sql);
$sql = "UPDATE ".GetTablePrefix()."IdGenerator SET lastid=lastid+".$Increment;
$adodbConnection->Execute($sql);
$rs = $adodbConnection->Execute("SELECT lastid FROM ".GetTablePrefix()."IdGenerator");
$val = $rs->fields["lastid"];
if(!$rs || $rs->EOF)
{
echo $adodbConnection->ErrorMsg();
$sql = "INSERT INTO ".GetTablePrefix()."IdGenerator (lastid) VALUES ($Increment)";
$adodbConnection->Execute($sql);
$val = 1;
}
$sql = "UNLOCK TABLES";
$adodbConnection->Execute($sql);
$val = $val-($Increment-1);
return $val;
}
function AddSlash($s)
{
if(substr($s,-1) != "/")
{
return $s."/";
}
else
return $s;
}
function StripNewline($s)
{
$bfound = false;
while (strlen($s)>0 && !$bfound)
{
if(ord(substr($s,-1))<32)
{
$s = substr($s,0,-1);
}
else
$bfound = true;
}
return $s;
}
function DeleteElement($array, $indice)
{
for($i=$indice;$i<count($array)-1;$i++)
$array[$i] = $array[$i+1];
unset($array[count($array)-1]);
return $array;
}
function DeleteElementValue($needle, &$haystack)
{
while(($gotcha = array_search($needle,$haystack)) > -1)
unset($haystack[$gotcha]);
}
function TableCount($TableName, $where="",$JoinCats=1)
{
$db = &GetADODBConnection();
if(!$JoinCats)
{
$sql = "SELECT count(*) as TableCount FROM $TableName";
}
else
$sql = "SELECT count(*) as TableCount FROM $TableName INNER JOIN ".GetTablePrefix()."CategoryItems ON ".GetTablePrefix()."CategoryItems.ItemResourceId=$TableName.ResourceId";
if(strlen($where)>0)
$sql .= " WHERE ".$where;
$rs = $db->Execute($sql);
// echo "SQL TABLE COUNT: ".$sql."<br>\n";
$res = $rs->fields["TableCount"];
return $res;
}
Function QueryCount($sql)
{
$sql = preg_replace('/SELECT(.*)FROM[ \n\r](.*)/is','SELECT COUNT(*) AS TableCount FROM $2', $sql);
$sql = preg_replace('/(.*)LIMIT(.*)/is','$1', $sql);
$sql = preg_replace('/(.*)ORDER BY(.*)/is','$1', $sql);
//echo $sql;
$db =& GetADODBConnection();
return $db->GetOne($sql);
}
function GetPageCount($ItemsPerPage,$NumItems)
{
if($ItemsPerPage==0 || $NumItems==0)
{
return 1;
}
$value = $NumItems/$ItemsPerPage;
return ceil($value);
}
/**
* @return string
* @desc Returns database table prefix entered while installation
*/
function GetTablePrefix()
{
global $g_TablePrefix;
return $g_TablePrefix;
}
function TableHasPrefix($t)
{
$pre = GetTablePrefix();
if(strlen($pre)>0)
{
if(substr($t,0,strlen($pre))==$pre)
{
return TRUE;
}
else
return FALSE;
}
else
return TRUE;
}
function AddTablePrefix($t)
{
if(!TableHasPrefix($t))
$t = GetTablePrefix().$t;
return $t;
}
function ThisDomain()
{
global $objConfig, $g_Domain;
if($objConfig->Get("DomainDetect"))
{
$d = $_SERVER['HTTP_HOST'];
}
else
$d = $g_Domain;
return $d;
}
function GetIndexUrl($secure=0)
{
global $indexURL, $rootURL, $secureURL;
switch($secure)
{
case 0:
$ret = $indexURL;
break;
case 1:
$ret = $secureURL."index.php";
break;
case 2:
$ret = $rootURL."index.php";
break;
default:
$ret = $i;
break;
}
return $ret;
}
function GetLimitSQL($Page,$PerPage)
{
if($Page<1)
$Page=1;
if(is_numeric($PerPage))
{
if($PerPage==0)
$PerPage = 20;
$Start = ($Page-1)*$PerPage;
$limit = "LIMIT ".$Start.",".$PerPage;
}
else
$limit = NULL;
return $limit;
}
function filelist ($currentdir, $startdir=NULL,$ext=NULL)
{
global $pathchar;
//chdir ($currentdir);
// remember where we started from
if (!$startdir)
{
$startdir = $currentdir;
}
$d = @opendir($currentdir);
$files = array();
if(!$d)
return $files;
//list the files in the dir
while (false !== ($file = readdir($d)))
{
if ($file != ".." && $file != ".")
{
if (is_dir($currentdir."/".$file))
{
// If $file is a directory take a look inside
$a = filelist ($currentdir."/".$file, $startdir,$ext);
if(is_array($a))
$files = array_merge($files,$a);
}
else
{
if($ext!=NULL)
{
$extstr = stristr($file,".".$ext);
if(strlen($extstr))
$files[] = $currentdir."/".$file;
}
else
$files[] = $currentdir.'/'.$file;
}
}
}
closedir ($d);
return $files;
}
function DecimalToBin($dec,$WordLength=8)
{
$bits = array();
$str = str_pad(decbin($dec),$WordLength,"0",STR_PAD_LEFT);
for($i=$WordLength;$i>0;$i--)
{
$bits[$i-1] = (int)substr($str,$i-1,1);
}
return $bits;
}
/*
function inp_escape($in, $html_enable=0)
{
$out = stripslashes($in);
$out = str_replace("\n", "\n^br^", $out);
if($html_enable==0)
{
$out=ereg_replace("<","&lt;",$out);
$out=ereg_replace(">","&gt;",$out);
$out=ereg_replace("\"","&quot;",$out);
$out = str_replace("\n^br^", "\n<br />", $out);
}
else
$out = str_replace("\n^br^", "\n", $out);
$out=addslashes($out);
return $out;
}
*/
function inp_escape($var,$html=0)
{
if($html)return $var;
if(is_array($var))
foreach($var as $k=>$v)
$var[$k]=inp_escape($v);
else
// $var=htmlspecialchars($var,ENT_NOQUOTES);
$var=strtr($var,Array('<'=>'&lt;','>'=>'&gt;',));
return $var;
}
function inp_striptags($var,$html=0)
{
if($html)return $var;
if(is_array($var))
foreach($var as $k=>$v)
$var[$k]=inp_striptags($v);
else
$var=strip_tags($var);
return $var;
}
function inp_unescape($in)
{
return $in;
$out=stripslashes($in);
return $out;
}
function inp_textarea_unescape($in)
{
return $in;
$out=stripslashes($in);
$out = str_replace("\n<br />", "\n", $out);
return $out;
}
function HighlightKeywords($Keywords, $html, $OpenTag="", $CloseTag="")
{
global $objConfig;
if(!strlen($OpenTag))
$OpenTag = "<B>";
if(!strlen($CloseTag))
$CloseTag = "</B>";
$r = preg_split('((>)|(<))', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
foreach ($Keywords as $k) {
for ($i = 0; $i < count($r); $i++) {
if ($r[$i] == "<") {
$i++; continue;
}
$r[$i] = preg_replace("/($k)/i", "$OpenTag\\1$CloseTag", $r[$i]);
}
}
return join("", $r);
}
/*
function HighlightKeywords($Keywords,$html, $OpenTag="", $CloseTag="")
{
global $objConfig;
if(!strlen($OpenTag))
$OpenTag = "<B>";
if(!strlen($CloseTag))
$CloseTag = "</B>";
$ret = strip_tags($html);
foreach ($Keywords as $k)
{
if(strlen($k))
{
//$html = str_replace("<$k>", ":#:", $html);
//$html = str_replace("</$k>", ":##:", $html);
//$html = strip_tags($html);
if ($html = preg_replace("/($k)/Ui","$OpenTag\\1$CloseTag", $html))
//if ($html = preg_replace("/(>[^<]*)($k)([^<]*< )/Ui","$OpenTag\\1$CloseTag", $html))
$ret = $html;
//$ret = str_replace(":#:", "<$k>", $ret);
//$ret = str_replace(":##:", "</$k>", $ret);
}
}
return $ret;
}
*/
function ExtractDatePart($part,$datestamp)
{
switch($part)
{
case "month":
if($datestamp<=0)
{
$ret = "";
}
else
$ret = adodb_date("m",$datestamp);
break;
case "day":
if($datestamp<=0)
{
$ret = "";
}
else
$ret = adodb_date("d", $datestamp);
break;
case "year":
if($datestamp<=0)
{
$ret = "";
}
else
$ret = adodb_date("Y", $datestamp);
break;
case "time_24hr":
if($datestamp<=0)
{
$ret = "";
}
else
$ret = adodb_date("H:i", $datestamp);
break;
case "time_12hr":
if($datestamp<=0)
{
$ret = "";
}
else
$ret = adodb_date("g:i a",$datestamp);
break;
default:
$ret = adodb_date($part, $datestamp);
break;
}
return $ret;
}
function GetLocalTime($TimeStamp,$TargetZone=NULL)
{
if($TargetZone==NULL)
$TargetZone = $objConfig->Get("Config_Site_Time");
$server = $objConfig->Get("Config_Server_Time");
if($TargetZone!=$server)
{
$offset = ($server - $TargetZone) * -1;
$TimeStamp = $TimeStamp + (3600 * $offset);
}
return $TimeStamp;
}
function _unhtmlentities ($string)
{
$trans_tbl = get_html_translation_table (HTML_ENTITIES);
$trans_tbl = array_flip ($trans_tbl);
return strtr ($string, $trans_tbl);
}
function getLastStr($hay, $need){
$getLastStr = 0;
$pos = strpos($hay, $need);
if (is_int ($pos)){ //this is to decide whether it is "false" or "0"
while($pos) {
$getLastStr = $getLastStr + $pos + strlen($need);
$hay = substr ($hay , $pos + strlen($need));
$pos = strpos($hay, $need);
}
return $getLastStr - strlen($need);
} else {
return -1; //if $need wasn´t found it returns "-1" , because it could return "0" if it´s found on position "0".
}
}
// --- bbcode processing function: begin ----
function PreformatBBCodes($text)
{
// convert phpbb url bbcode to valid in-bulletin's format
// 1. urls
$text = preg_replace('/\[url=(.*)\](.*)\[\/url\]/Ui','[url href="$1"]$2[/url]',$text);
$text = preg_replace('/\[url\](.*)\[\/url\]/Ui','[url href="$1"]$1[/url]',$text);
// 2. images
$text = preg_replace('/\[img\](.*)\[\/img\]/Ui','[img src="$1" border="0"][/img]',$text);
// 3. color
$text = preg_replace('/\[color=(.*)\](.*)\[\/color\]/Ui','[font color="$1"]$2[/font]',$text);
// 4. size
$text = preg_replace('/\[size=(.*)\](.*)\[\/size\]/Ui','[font size="$1"]$2[/font]',$text);
// 5. lists
$text = preg_replace('/\[list(.*)\](.*)\[\/list\]/Uis','[ul]$2[/ul]',$text);
// 6. email to link
$text = preg_replace('/\[email\](.*)\[\/email\]/Ui','[url href="mailto:$1"]$1[/url]',$text);
//7. b tag
$text = preg_replace('/\[(b|i|u):(.*)\](.*)\[\/(b|i|u):(.*)\]/Ui','[$1]$3[/$4]',$text);
//8. code tag
$text = preg_replace('/\[code:(.*)\](.*)\[\/code:(.*)\]/Uis','[code]$2[/code]',$text);
return $text;
}
/**
* @return string
* @param string $BBCode
* @param string $TagParams
* @param string $TextInside
* @param string $ParamsAllowed
* @desc Removes not allowed params from tag and returns result
*/
function CheckBBCodeAttribs($BBCode, $TagParams, $TextInside, $ParamsAllowed)
{
// $BBCode - bbcode to check, $TagParams - params string entered by user
// $TextInside - text between opening and closing bbcode tag
// $ParamsAllowed - list of allowed parameter names ("|" separated)
$TagParams=str_replace('\"','"',$TagParams);
$TextInside=str_replace('\"','"',$TextInside);
if( $ParamsAllowed && preg_match_all('/ +([^=]*)=["\']?([^ "\']*)["\']?/is',$TagParams,$params,PREG_SET_ORDER) )
{
$ret = Array();
foreach($params as $param)
{
// remove spaces in both parameter name & value & lowercase parameter name
$param[1] = strtolower(trim($param[1])); // name lowercased
if(($BBCode=='url')&&($param[1]=='href'))
if(false!==strpos(strtolower($param[2]),'script:'))
return $TextInside;
// $param[2]='about:blank';
if( isset($ParamsAllowed[ $param[1] ]) )
$ret[] = $param[1].'="'.$param[2].'"';
}
$ret = count($ret) ? ' '.implode(' ',$ret) : '';
return '<'.$BBCode.$ret.'>'.$TextInside.'</'.$BBCode.'>';
}
else
return '<'.$BBCode.'>'.$TextInside.'</'.$BBCode.'>';
return false;
}
function ReplaceBBCode($text)
{
global $objConfig;
// convert phpbb bbcodes to in-bulletin bbcodes
$text = PreformatBBCodes($text);
// $tag_defs = 'b:;i:;u:;ul:type|align;font:color|face|size;url:href;img:src|border';
$tags_defs = $objConfig->Get('BBTags');
foreach(explode(';',$tags_defs) as $tag)
{
$tag = explode(':',$tag);
$tag_name = $tag[0];
$tag_params = $tag[1]?array_flip(explode('|',$tag[1])):0;
$text = preg_replace('/\['.$tag_name.'(.*)\](.*)\[\/'.$tag_name.' *\]/Uise','CheckBBCodeAttribs("'.$tag_name.'",\'$1\',\'$2\',$tag_params);', $text);
}
// additional processing for [url], [*], [img] bbcode
$text = preg_replace('/<url>(.*)<\/url>/Usi','<url href="$1">$1</url>',$text);
$text = preg_replace('/<font>(.*)<\/font>/Usi','$1',$text); // skip empty fonts
$text = str_replace( Array('<url','</url>','[*]'),
Array('<a target="_blank"','</a>','<li>'),
$text);
// bbcode [code]xxx[/code] processing
$text = preg_replace('/\[code\](.*)\[\/code\]/Uise', "ReplaceCodeBBCode('$1')", $text);
return $text;
}
function leadSpace2nbsp($x)
{
return "\n".str_repeat('&nbsp;',strlen($x));
}
function ReplaceCodeBBCode($input_string)
{
$input_string=str_replace('\"','"',$input_string);
$input_string=$GLOBALS['objSmileys']->UndoSmileys(_unhtmlentities($input_string));
$input_string=trim($input_string);
$input_string=inp_htmlize($input_string);
$input_string=str_replace("\r",'',$input_string);
$input_string = str_replace("\t", " ", $input_string);
$input_string = preg_replace('/\n( +)/se',"leadSpace2nbsp('$1')",$input_string);
$input_string='<div style="border:1px solid #888888;width:100%;background-color:#eeeeee;margin-top:6px;margin-bottom:6px"><div style="padding:10px;"><code>'.$input_string.'</code></div></div>';
// $input_string='<textarea wrap="off" style="border:1px solid #888888;width:100%;height:200px;background-color:#eeeeee;">'.inp_htmlize($input_string).'</textarea>';
return $input_string;
if(false!==strpos($input_string,'<'.'?'))
{
$input_string=str_replace('<'.'?','<'.'?php',$input_string);
$input_string=str_replace('<'.'?phpphp','<'.'?php',$input_string);
$input_string=@highlight_string($input_string,1);
}
else
{
$input_string = @highlight_string('<'.'?php'.$input_string.'?'.'>',1);
$input_string = str_replace('&lt;?php', '', str_replace('?&gt;', '', $input_string));
}
return str_replace('<br />','',$input_string);
}
// --- bbcode processing function: end ----
function GetMinValue($Table,$Field, $Where=NULL)
{
$ret = 0;
$sql = "SELECT min($Field) as val FROM $Table ";
if(strlen($where))
$sql .= "WHERE $Where";
$ado = &GetADODBConnection();
$rs = $ado->execute($sql);
if($rs)
$ret = (int)$rs->fields["val"];
return $ret;
}
function getmicrotime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
function SetMissingDataErrors($f)
{
global $FormError;
$count = 0;
if(is_array($_POST))
{
if(is_array($_POST["required"]))
{
foreach($_POST["required"] as $r)
{
$found = FALSE;
if(is_array($_FILES))
{
if( isset($_FILES[$r]) && $_FILES[$r]['size'] > 0 ) $found = TRUE;
}
if(!strlen(trim($_POST[$r])) && !$found)
{
$count++;
if (($r == "dob_day") || ($r == "dob_month") || ($r == "dob_year"))
$r = "dob";
$tag = isset($_POST["errors"]) ? $_POST["errors"][$r] : '';
if(!strlen($tag))
$tag = "lu_ferror_".$f."_".$r;
$FormError[$f][$r] = language($tag);
}
}
}
}
return $count;
}
function makepassword($length=10)
{
$pass_length=$length;
$p1=array('b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z');
$p2=array('a','e','i','o','u');
$p3=array('1','2','3','4','5','6','7','8','9');
$p4=array('(','&',')',';','%'); // if you need real strong stuff
// how much elements in the array
// can be done with a array count but counting once here is faster
$s1=21;// this is the count of $p1
$s2=5; // this is the count of $p2
$s3=9; // this is the count of $p3
$s4=5; // this is the count of $p4
// possible readable combinations
$c1='121'; // will be like 'bab'
$c2='212'; // will be like 'aba'
$c3='12'; // will be like 'ab'
$c4='3'; // will be just a number '1 to 9' if you dont like number delete the 3
// $c5='4'; // uncomment to active the strong stuff
$comb='4'; // the amount of combinations you made above (and did not comment out)
for ($p=0;$p<$pass_length;)
{
mt_srand((double)microtime()*1000000);
$strpart=mt_rand(1,$comb);
// checking if the stringpart is not the same as the previous one
if($strpart<>$previous)
{
$pass_structure.=${'c'.$strpart};
// shortcutting the loop a bit
$p=$p+strlen(${'c'.$strpart});
}
$previous=$strpart;
}
// generating the password from the structure defined in $pass_structure
for ($g=0;$g<strlen($pass_structure);$g++)
{
mt_srand((double)microtime()*1000000);
$sel=substr($pass_structure,$g,1);
$pass.=${'p'.$sel}[mt_rand(0,-1+${'s'.$sel})];
}
return $pass;
}
function LogEntry($text,$writefile=FALSE)
{
global $g_LogFile,$LogFile, $LogData, $LogLevel, $timestart;
static $last;
if(strlen($g_LogFile))
{
$el = str_pad(getmicrotime()- $timestart,10," ");
if($last>0)
$elapsed = getmicrotime() - $last;
if(strlen($el)>10)
$el = substr($el,0,10);
$indent = str_repeat(" ",$LogLevel);
$text = str_pad($text,$LogLevel,"==",STR_PAD_LEFT);
$LogData .= "$el:". round($elapsed,6).":$indent $text";
$last = getmicrotime();
if($writefile==TRUE && is_writable($g_LogFile))
{
if(!$LogFile)
{
if(file_exists($g_LogFile))
unlink($g_LogFile);
$LogFile=@fopen($g_LogFile,"w");
}
if($LogFile)
{
fputs($LogFile,$LogData);
}
}
}
}
function ValidEmail($email)
{
if (eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $email))
{
return TRUE;
}
else
{
return FALSE;
}
}
function language($phrase,$LangId=0)
{
global $objSession, $objLanguageCache, $objLanguages;
if($LangId==0)
$LangId = $objSession->Get("Language");
if($LangId==0)
$LangId = $objLanguages->GetPrimary();
$translation = $objLanguageCache->GetTranslation($phrase,$LangId);
return $translation;
}
function admin_language($phrase,$lang=0,$LinkMissing=FALSE)
{
global $objSession, $objLanguageCache, $objLanguages;
//echo "Language passed: $lang<br>";
if($lang==0)
$lang = $objSession->Get("Language");
//echo "Language from session: $lang<br>";
if($lang==0)
$lang = $objLanguages->GetPrimary();
//echo "Language after primary: $lang<br>";
//echo "Phrase: $phrase<br>";
$translation = $objLanguageCache->GetTranslation($phrase,$lang);
if($LinkMissing && substr($translation,0,1)=="!" && substr($translation,-1)=="!")
{
$res = "<A href=\"javascript:OpenPhraseEditor('&direct=1&label=$phrase'); \">$translation</A>";
return $res;
}
else
return $translation;
}
function prompt_language($phrase,$lang=0)
{
return admin_language($phrase,$lang,TRUE);
}
function GetPrimaryTranslation($Phrase)
{
global $objLanguages;
$l = $objLanguages->GetPrimary();
return language($Phrase,$l);
}
function CategoryNameCount($ParentId,$Name)
{
$cat_table = GetTablePrefix()."Category";
$sql = "SELECT Name from $cat_table WHERE ParentId=$ParentId AND ";
$sql .="(Name LIKE '".addslashes($Name)."' OR Name LIKE 'Copy of ".addslashes($Name)."' OR Name LIKE 'Copy % of ".addslashes($Name)."')";
$ado = &GetADODBConnection();
$rs = $ado->Execute($sql);
$ret = array();
while($rs && !$rs->EOF)
{
$ret[] = $rs->fields["Name"];
$rs->MoveNext();
}
return $ret;
}
function CategoryItemNameCount($CategoryId,$Table,$Field,$Name)
{
$Name=addslashes($Name);
$cat_table = GetTablePrefix()."CategoryItems";
$sql = "SELECT $Field FROM $Table INNER JOIN $cat_table ON ($Table.ResourceId=$cat_table.ItemResourceId) ";
$sql .=" WHERE ($Field LIKE 'Copy % of $Name' OR $Field LIKE '$Name' OR $Field LIKE 'Copy of $Name') AND CategoryId=$CategoryId";
//echo $sql."<br>\n ";
$ado = &GetADODBConnection();
$rs = $ado->Execute($sql);
$ret = array();
while($rs && !$rs->EOF)
{
$ret[] = $rs->fields[$Field];
$rs->MoveNext();
}
return $ret;
}
function &GetItemCollection($ItemName)
{
global $objItemTypes;
if(is_numeric($ItemName))
{
$item = $objItemTypes->GetItem($ItemName);
}
else
$item = $objItemTypes->GetTypeByName($ItemName);
if(is_object($item))
{
$module = $item->Get("Module");
$prefix = ModuleTagPrefix($module);
$func = $prefix."_ItemCollection";
if(function_exists($func))
{
$var =& $func();
}
}
return $var;
}
function UpdateCategoryCount($ItemTypeName=0,$ListType=NULL)
{
global $objCountCache, $objItemTypes;
if(is_numeric($ItemTypeName))
$item = $objItemTypes->GetItem($ItemTypeName);
else
$item = $objItemTypes->GetTypeByName($ItemTypeName);
if(is_object($item))
{
$ItemType = $item->Get("ItemType");
$sql = "DELETE FROM ".$objCountCache->SourceTable." WHERE ItemType=$ItemType";
if( is_numeric($ListType) ) $sql .= " AND ListType=$ListType";
$objCountCache->adodbConnection->Execute($sql);
}
}
function UpdateModifiedCategoryCount($ItemTypeName,$CatId=NULL,$Modifier=0,$ExtraId=NULL)
{
}
function UpdateGroupCategoryCount($ItemTypeName,$CatId=NULL,$Modifier=0,$GroupId=NULL)
{
}
function GetTagCache($module,$tag,$attribs,$env)
{
global $objSystemCache, $objSession, $objConfig;
if($objConfig->Get("SystemTagCache"))
{
$name = $tag;
if(is_array($attribs))
{
foreach($attribs as $n => $val)
{
$name .= "-".$val;
}
}
$CachedValue = $objSystemCache->GetContextValue($name,$module,$env, $objSession->Get("GroupList"));
}
else
$CachedValue="";
return $CachedValue;
}
function SaveTagCache($module, $tag, $attribs, $env, $newvalue)
{
global $objSystemCache, $objSession, $objConfig;
if($objConfig->Get("SystemTagCache"))
{
$name = $tag;
if(is_array($attribs))
{
foreach($attribs as $a => $val)
{
$name .= "-".$val;
}
}
$objSystemCache->EditCacheItem($name,$newvalue,$module,0,$env,$objSession->Get("GroupList"));
}
}
function DeleteTagCache($name,$extraparams, $env="")
{
global $objSystemCache, $objConfig;
if($objConfig->Get("SystemTagCache"))
{
$where = "Name LIKE '$name%".$extraparams."'";
if(strlen($env))
$where .= " AND Context LIKE $env";
$objSystemCache->DeleteCachedItem($where);
}
}
function ParseTagLibrary()
{
$objTagList = new clsTagList();
$objTagList->ParseInportalTags();
unset($objTagList);
}
function GetDateFormat($LangId=0)
{
global $objLanguages;
if(!$LangId)
$LangId= $objLanguages->GetPrimary();
$l = $objLanguages->GetItem($LangId);
if(is_object($l))
{
$fmt = $l->Get("DateFormat");
}
else
$fmt = "m-d-Y";
if(isset($GLOBALS['FrontEnd'])&&$GLOBALS['FrontEnd'])
return $fmt;
return preg_replace('/y+/i','Y',$fmt);
}
function GetTimeFormat($LangId=0)
{
global $objLanguages;
if(!$LangId)
$LangId= $objLanguages->GetPrimary();
$l = $objLanguages->GetItem($LangId);
if(is_object($l))
{
$fmt = $l->Get("TimeFormat");
}
else
$fmt = "H:i:s";
return $fmt;
}
+/**
+ * Gets one of currently selected language options
+ *
+ * @param string $optionName
+ * @param int $LangId
+ * @return string
+ * @access public
+ */
+function GetRegionalOption($optionName,$LangId=0)
+{
+ global $objLanguages, $objSession;
+
+ if(!$LangId) $LangId=$objSession->Get('Language');
+ if(!$LangId) $LangId=$objLanguages->GetPrimary();
+ $l = $objLanguages->GetItem($LangId);
+ return is_object($l)?$l->Get($optionName):false;
+}
+
function LangDate($TimeStamp=NULL,$LangId=0)
{
$fmt = GetDateFormat($LangId);
$ret = adodb_date($fmt,$TimeStamp);
return $ret;
}
function LangTime($TimeStamp=NULL,$LangId=0)
{
$fmt = GetTimeFormat($LangId);
$ret = adodb_date($fmt,$TimeStamp);
return $ret;
}
function LangNumber($Num,$DecPlaces=NULL,$LangId=0)
{
global $objLanguages;
if(!$LangId)
$LangId= $objLanguages->GetPrimary();
$l = $objLanguages->GetItem($LangId);
if(is_object($l))
{
$ret = number_format($Num,$DecPlaces,$l->Get("DecimalPoint"),$l->Get("ThousandSep"));
}
else
$ret = $num;
return $ret;
}
function replacePngTags($x, $spacer="images/spacer.gif")
{
global $rootURL,$pathtoroot;
// make sure that we are only replacing for the Windows versions of Internet
// Explorer 5+, and not Opera identified as MSIE
$msie='/msie\s([5-9])\.?[0-9]*.*(win)/i';
$opera='/opera\s+[0-9]+/i';
if(!isset($_SERVER['HTTP_USER_AGENT']) ||
!preg_match($msie,$_SERVER['HTTP_USER_AGENT']) ||
preg_match($opera,$_SERVER['HTTP_USER_AGENT']))
return $x;
// find all the png images in backgrounds
preg_match_all('/background-image:\s*url\(\'(.*\.png)\'\);/Uis',$x,$background);
for($i=0;$i<count($background[0]);$i++){
// simply replace:
// "background-image: url('image.png');"
// with:
// "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(
// enabled=true, sizingMethod=scale src='image.png');"
// haven't tested to see if background-repeat styles work...
$x=str_replace($background[0][$i],'filter:progid:DXImageTransform.'.
'Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale'.
' src=\''.$background[1][$i].'\');',$x);
}
// OK, time to find all the IMG tags with ".png" in them
preg_match_all('/(<img.*\.png.*>|<input.*type=([\'"])image\\2.*\.png.*>)/Uis',$x,$images);
while(list($imgnum,$v)=@each($images[0])){
$original=$v;
$atts=''; $width=0; $height=0;
// If the size is defined by styles, find
preg_match_all('/style=".*(width: ([0-9]+))px.*'.
'(height: ([0-9]+))px.*"/Ui',$v,$arr2);
if(is_array($arr2) && count($arr2[0])){
// size was defined by styles, get values
$width=$arr2[2][0];
$height=$arr2[4][0];
}
// size was not defined by styles, get values
preg_match_all('/width=\"?([0-9]+)\"?/i',$v,$arr2);
if(is_array($arr2) && count($arr2[0])){
$width=$arr2[1][0];
}
preg_match_all('/height=\"?([0-9]+)\"?/i',$v,$arr2);
if(is_array($arr2) && count($arr2[0])){
$height=$arr2[1][0];
}
preg_match_all('/src=\"([^\"]+\.png)\"/i',$v,$arr2);
if(isset($arr2[1][0]) && !empty($arr2[1][0]))
$image=$arr2[1][0];
else
$image=NULL;
// We do this so that we can put our spacer.gif image in the same
// directory as the image
$tmp=split('[\\/]',$image);
array_pop($tmp);
$image_path=join('/',$tmp);
if(substr($image,0,strlen($rootURL))==$rootURL)
{
$path = str_replace($rootURL,$pathtoroot,$image);
}
else
{
$path = $pathtoroot."themes/telestial/$image";
}
// echo "Sizing $path.. <br>\n";
// echo "Full Tag: ".htmlentities($image)."<br>\n";
//if(!$height || !$width)
//{
$g = imagecreatefrompng($path);
if($g)
{
$height = imagesy($g);
$width = imagesx($g);
}
//}
if(strlen($image_path)) $image_path.='/';
// end quote is already supplied by originial src attribute
$replace_src_with=$spacer.'" style="width: '.$width.
'px; height: '.$height.'px; filter: progid:DXImageTransform.'.
'Microsoft.AlphaImageLoader(src=\''.$image.'\', sizingMethod='.
'\'scale\')';
// now create the new tag from the old
$new_tag=str_replace($image,$replace_src_with,$original);
// now place the new tag into the content
$x=str_replace($original,$new_tag,$x);
}
return $x;
}
function print_pre($str)
{
// no comments here :)
echo '<pre>'.print_r($str, true).'</pre>';
}
function GetOptions($field) // by Alex
{
// get dropdown values from custom field
$tmp =& new clsCustomField();
$tmp->LoadFromDatabase($field, 'FieldName');
$tmp_values = $tmp->Get('ValueList');
unset($tmp);
$tmp_values = explode(',', $tmp_values);
foreach($tmp_values as $mixed)
{
$elem = explode('=', trim($mixed));
$ret[ $elem[0] ] = $elem[1];
}
return $ret;
}
function ResetPage($module_prefix, $page_variable = 'p')
{
// resets page in specific module when category is changed
global $objSession;
if( !is_object($objSession) ) // when changing pages session doesn't exist -> InPortal BUG
{
global $var_list, $SessionQueryString, $FrontEnd;
//if(!$var_list["sid"]) $var_list["sid"] = $_COOKIE["sid"];
$objSession = new clsUserSession($var_list["sid"],($SessionQueryString && $FrontEnd==1));
}
//echo "SID_RESET: ".$GLOBALS['var_list']["sid"].'(COOKIE_SID: '.$_COOKIE["sid"].')<br>';
$last_cat = $objSession->GetVariable('last_category');
$prev_cat = $objSession->GetVariable('prev_category');
//echo "Resetting Page [$prev_cat] -> [$last_cat]<br>";
if($prev_cat != $last_cat) $GLOBALS[$module_prefix.'_var_list'][$page_variable] = 1;
}
if( !function_exists('GetVar') )
{
/**
* @return string
* @param string $name
* @param bool $post_priority
* @desc Get's variable from http query
*/
function GetVar($name, $post_priority = false)
{
if(!$post_priority) // follow gpc_order in php.ini
return isset($_REQUEST[$name]) ? $_REQUEST[$name] : false;
else // get variable from post 1stly if not found then from get
return isset($_POST[$name]) && $_POST[$name] !== false ? $_POST[$name] : ( isset($_GET[$name]) && $_GET[$name] ? $_GET[$name] : false );
}
}
function SetVar($VarName, $VarValue)
{
$_REQUEST[$VarName] = $VarValue;
$_POST[$VarName] = $VarValue;
}
function PassVar(&$source)
{
// source array + any count of key names in passed array
$params = func_get_args();
array_shift($params);
if( count($params) )
{
$ret = Array();
foreach($params as $var_name)
if( isset($source[$var_name]) )
$ret[] = $var_name.'='.$source[$var_name];
$ret = '&'.implode('&', $ret);
}
return $ret;
}
function GetSubmitVariable(&$array, $postfix)
{
// gets edit status of module
// used in case if some modules share
// common action parsed by kernel parser,
// but each module uses own EditStatus variable
$modules = Array('In-Link' => 'Link', 'In-News' => 'News', 'In-Bulletin' => 'Topic');
foreach($modules as $module => $prefix)
if( isset($array[$prefix.$postfix]) )
return Array('Module' => $module, 'variable' => $array[$prefix.$postfix]);
return false;
}
function GetModuleByAction()
{
$prefix2module = Array('m' => 'In-Portal', 'l' => 'In-Link', 'n' => 'In-News', 'bb' => 'In-Bulletin');
$action = GetVar('Action');
if($action)
{
$module_prefix = explode('_', $action);
return $prefix2module[ $module_prefix[0] ];
}
else
return false;
}
function dir_size($dir) {
// calculates folder size based on filesizes inside it (recursively)
$totalsize=0;
if ($dirstream = @opendir($dir)) {
while (false !== ($filename = readdir($dirstream))) {
if ($filename!="." && $filename!="..")
{
if (is_file($dir."/".$filename))
$totalsize+=filesize($dir."/".$filename);
if (is_dir($dir."/".$filename))
$totalsize+=dir_size($dir."/".$filename);
}
}
}
closedir($dirstream);
return $totalsize;
}
function size($bytes) {
// shows formatted file/directory size
$types = Array("la_bytes","la_kilobytes","la_megabytes","la_gigabytes","la_terabytes");
$current = 0;
while ($bytes > 1024) {
$current++;
$bytes /= 1024;
}
return round($bytes,2)." ".language($types[$current]);
}
function echod($str)
{
// echo debug output
echo str_replace( Array('[',']'), Array('[<b>', '</b>]'), $str).'<br>';
}
function PrepareParams($source, $to_lower, $mapping)
{
// prepare array with form values to use with item
$result = Array();
foreach($to_lower as $field)
$result[ $field ] = $source[ strtolower($field) ];
if( is_array($mapping) )
{
foreach($mapping as $field_from => $field_to)
$result[$field_to] = $source[$field_from];
}
return $result;
}
function GetELT($field, $phrases = Array())
{
// returns FieldOptions equivalent in In-Portal
$ret = Array();
foreach($phrases as $phrase)
$ret[] = admin_language($phrase);
$ret = "'".implode("','", $ret)."'";
return 'ELT('.$field.','.$ret.')';
}
function GetModuleImgPath($module)
{
global $rootURL, $admin;
return $rootURL.$module.'/'.$admin.'/images';
}
function ActionPostProcess($StatusField, $ListClass, $ListObjectName = '', $IDField = null)
{
// each action postprocessing stuff from admin
if( !isset($_REQUEST[$StatusField]) ) return false;
$list =& $GLOBALS[$ListObjectName];
if( !is_object($list) ) $list = new $ListClass();
$SFValue = $_REQUEST[$StatusField]; // status field value
switch($SFValue)
{
case 1: // User hit "Save" button
$list->CopyFromEditTable($IDField);
break;
case 2: // User hit "Cancel" button
$list->PurgeEditTable($IDField);
break;
}
if( function_exists('SpecificProcessing') ) SpecificProcessing($StatusField, $SFValue);
if($SFValue == 1 || $SFValue == 2) $list->Clear();
}
/**
* Returns array value if key exists
*
* @param Array $aArray
* @param int $aIndex
* @return string
*/
function getArrayValue(&$aArray, $aIndex)
{
return isset($aArray[$aIndex]) ? $aArray[$aIndex] : false;
}
function MakeHTMLTag($element, $attrib_prefix)
{
$result = Array();
$ap_length = strlen($attrib_prefix);
foreach($element->attributes as $attib_name => $attr_value)
if( substr($attib_name, $ap_length) == $ap_length )
$result[] = substr($attib_name, $ap_length, strlen($attib_name)).'="'.$attr_value.'"';
return count($result) ? implode(' ', $result) : false;
}
function GetImportScripts()
{
// return currently installed import scripts
static $import_scripts = Array();
if( count($import_scripts) == 0 )
{
$sql = 'SELECT * FROM '.GetTablePrefix().'ImportScripts ORDER BY is_id';
$db =&GetADODBConnection();
$rs = $db->Execute($sql);
if( $rs && $rs->RecordCount() > 0 )
{
while(!$rs->EOF)
{
$rec =& $rs->fields;
$import_scripts[] = Array( 'label' => $rec['is_label'], 'url' => $rec['is_script'],
'enabled' => $rec['is_enabled'], 'field_prefix' => $rec['is_field_prefix'],
'id' => $rec['is_string_id'], 'required_fields' => $rec['is_requred_fields'],
'module' => strtolower($rec['is_Module']) );
$rs->MoveNext();
}
}
else
{
$import_scripts = Array();
}
}
return $import_scripts;
}
function GetImportScript($id)
{
$scripts = GetImportScripts();
return isset($scripts[$id]) ? $scripts[$id] : false;
}
function GetNextTemplate($current_template)
{
// used on front, returns next template to make
// redirect to
$dest = GetVar('dest', true);
if(!$dest) $dest = GetVar('DestTemplate', true);
return $dest ? $dest : $current_template;
}
// functions for dealign with enviroment variable construction
function GenerateModuleEnv($prefix, $var_list)
{
// globalize module varible arrays
$main =& $GLOBALS[$prefix.'_var_list'];
$update =& $GLOBALS[$prefix.'_var_list_update'];
//echo "VAR: [$main]; VAR_UPDATE: [$update]<br>";
// ensure that we have no empty values in enviroment variable
foreach($update as $vl_key => $vl_value)
if(!$vl_value) $update[$vl_key] = '0'; // unset($update[$vl_key]);
// if update var count is zero, then do nothing
if(count($update) == 0) return '';
foreach($main as $vl_key => $vl_value)
if(!$vl_value) $main[$vl_key] = '0'; // unset($main[$vl_key]);
$ret = Array();
foreach($var_list as $var_name)
$ret[] = GetEnvVar($prefix, $var_name);
return ':'.$prefix.implode('-',$ret);
}
function GetEnvVar($prefix, $name)
{
// get variable from template variable's list
// (used in module parsers to build env string)
$main =& $GLOBALS[$prefix.'_var_list'];
$update =& $GLOBALS[$prefix.'_var_list_update'];
return isset($update[$name]) ? $update[$name] : ( isset($main[$name]) ? $main[$name] : '');
}
/**
* @return int
* @desc Checks for debug mode
*/
function IsDebugMode()
{
return defined('DEBUG_MODE') && constant('DEBUG_MODE') == 1 ? 1 : 0;
}
?>
Property changes on: trunk/globals.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.62
\ No newline at end of property
+1.63
\ No newline at end of property
Index: trunk/new_phrases.txt
===================================================================
--- trunk/new_phrases.txt (revision 897)
+++ trunk/new_phrases.txt (revision 898)
@@ -1,138 +1,139 @@
la_help_in_progress
la_text_advanced
la_title_sendmailcancel
la_prevgroup
la_nextgroup
la_permtype_$permmodule
la_ban_login
la_ban_email
la_ban_ip
la_title_searchresults
la_restore_file_not_found
la_restore_access_denied
la_restore_file_error
la_restore_read_error
la_restore_unknown_error
+la_prompt_charset
la_tooltip_save
la_tooltip_close
la_text_datatype_
la_text_custom
la_text_multipleshow
la_prompt_multipleshow
la_text_minkeywordlength
la_prompt_minkeywordlength
la_text_prerequisit_not_passed
la_prevcategory
la_nextcategory
la_text_
la_tooltip_previousstep
la_tooltip_nextstep
la_tooltip_cancel
la_description_
la_tab_modules
la_title_select_item
la_title_select_target_item
la_prompt_movedown
la_prompt_moveup
la_prompt_delete
la_prompt_edit
la_category
lu_cookies_error
lu_ferror_reset_denied
lu_subscribe_banned
lu_subscribe_unknown_error
lu_subscribe_success
lu_subscribe_missing_address
lu_ferror_pswd_mismatch
lu_ferror_pswd_toolong
lu_ferror_m_profile_userid
lu_ferror_no_access
lu_ferror_wrongtype
lu_ferror_toolarge
la_review_alreadyreviewed
la_review_added
la_review_pending
la_review_error
la_configerror_review
lu_already_suggested
lu_keywords_tooshort
lu_hello_world
lu_searchtitle_
lu_unknown_error
lu_guest
lu_profile_field
lu_
la_text_denied
la_text_quicklinks
la_by_theme
la_front_end
la_admin
la_text_types
la_prompt_all_templates
la_prompt_parent_templates
la_rootpass_verify_error
la_tab_taglibrary
la_tab_userban
la_title_edit_ban
la_title_category_relationselect
la_title_category_select
la_title_groupselect
la_title_userselect
la_tab_label
la_title_label
la_title_sendmail
lu_read_error
lu_no_template_error
lu_favorite
la_desc_emailevent_
la_text_address_denied
la_error_move_subcategory
lu_close
lu_pm_list_description
lu_rate_access_denied
lu_edittopic_confirm_pending
lu_edittopic_confirm_pending_text
lu_privatemessages_updated
lu_my_topic_favorites
lu_forgotpw_confirm_reset
lu_forgotpw_confirm_text_reset
lu_link_addreview_confirm_pending_text
lu_review_access_denied
lu_modifylink_pending_confirm
lu_modifylink_pending_confirm_text
lu_my_link_favorites
lu_new_news
lu_new_articles
lu_related_articles
lu_news_review_confirm_pending
lu_news_addreview_confirm__pending_text
lu_news_search_results
lu_enlarge_picture
lu_confirm
lu_confirmation_title
lu_confirm_subtitle
lu_confirm_text
lu_favorite_denied
lu_register_autopasswd
lu_modified
lu_expires
lu_no_expiration
lu_rating_alreadyvoted
la_origional_value
la_inlink
la_tooltip_setprimary
la_tab_inlinkimport
la_error_unknown_category
la_rating_alreadyvoted
la_vote_added
la_text_leading
lu_recipent_required
lu_recipient_doesnt_exit
la_no_topics
la_original_values
la_tab_phpbbimport
lu_btn_newtopic
lu_ferror_
la_bytes
la_gigabytes
la_terabytes
Property changes on: trunk/new_phrases.txt
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property

Event Timeline