Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1026078
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Jun 13, 8:32 PM
Size
32 KB
Mime Type
text/x-diff
Expires
Sun, Jun 15, 8:32 PM (6 h, 7 m)
Engine
blob
Format
Raw Data
Handle
661712
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/unlabeled/unlabeled-1.16.2/kernel/include/customfield.php
===================================================================
--- branches/unlabeled/unlabeled-1.16.2/kernel/include/customfield.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.16.2/kernel/include/customfield.php (revision 7869)
@@ -0,0 +1,289 @@
+<?php
+
+class clsCustomField extends clsItem
+{
+
+ function clsCustomField($CustomFieldId=-1)
+ {
+ $this->clsItem();
+ $this->tablename=GetTablePrefix()."CustomField";
+ $this->type=10;
+ $this->BasePermission="";
+ $this->id_field = "CustomFieldId";
+ $this->NoResourceId=1; //set this to avoid using a resource ID
+ $this->debuglevel=0;
+ if($CustomFieldId>-1)
+ $this->LoadFromDatabase($CustomFieldId);
+ }
+
+
+ function GetAdminUI()
+ {
+ $a = new clsConfigAdminItem();
+ $a->name = "_".$this->Get("FieldName");
+ $a->heading = $this->Get("Heading");
+ $a->prompt = $this->Get("Prompt");
+ $a->ElementType = $this->Get("ElementType");
+ $a->ValidationRules="";
+ $a->default_value = "";
+ $a->ValueList=$this->Get("ValueList");
+ if(!strlen($a->ElementType))
+ $a->ElementType="text";
+ if(!strlen($a->prompt))
+ $a->prompt = "lu_fieldcustom__".strtolower($this->Get("FieldName"));
+ return $a;
+ }
+
+ function parsetag($tag)
+ {
+ if(is_object($tag))
+ {
+ $tagname = $tag->name;
+ }
+ else
+ $tagname = $tag;
+ switch($tagname)
+ {
+ case "fieldlabel":
+ return $this->Get("FieldLabel");
+ break;
+
+ case "fieldname":
+ return $this->Get("FieldName");
+ break;
+
+ case "customfieldid":
+ return $this->Get("CustomFieldId");
+
+ default:
+ return "Undefined:$tagname";
+ break;
+ }
+ }
+
+ }
+
+class clsCustomFieldList extends clsItemCollection
+{
+ var $Type;
+
+ function clsCustomFieldList($type = -1, $table = 'CustomField')
+ {
+ $this->clsItemCollection();
+ $this->Type = $type;
+ $this->classname = 'clsCustomField';
+ if ($table == 'CustomField') {
+ $table = GetTablePrefix().$table;
+ }
+
+ $this->SourceTable = $table;
+ if ($this->Type > 0) {
+ $this->LoadFields();
+ }
+ }
+
+ function LoadFields()
+ {
+ $this->Clear();
+ $sql = 'SELECT *
+ FROM '.$this->SourceTable.'
+ WHERE Type = '.$this->Type.' AND (IsSystem = 0 OR OnGeneralTab = 1)
+ ORDER BY DisplayOrder DESC, CustomFieldId ASC';
+ if($this->debuglevel > 1)
+ echo $sql."<br>\n";
+ $rs = $this->adodbConnection->Execute($sql);
+
+ while($rs && !$rs->EOF)
+ {
+ $data = $rs->fields;
+ $this->AddItemFromArray($data);
+ $rs->MoveNext();
+ }
+ }
+
+ function LoadFieldsAndValues($ResourceId, $main_prefix, $temp_table = false)
+ {
+ $this->Clear();
+
+ $table = $this->Application->getUnitOption($main_prefix.'-cdata', 'TableName');
+ if ($temp_table) {
+ $table = $this->Application->GetTempName($table, 'prefix:'.$main_prefix);
+ }
+
+ $sql = 'SELECT *
+ FROM '.$table.'
+ WHERE ResourceId = '.$ResourceId;
+ $custom_data = $this->adodbConnection->GetRow($sql);
+
+ $sql = 'SELECT *
+ FROM '.TABLE_PREFIX.'CustomField
+ WHERE Type = '.$this->Application->getUnitOption($main_prefix, 'ItemType');
+ $custom_fields = $this->Conn->Query($sql, 'CustomFieldId');
+
+ $ml_formatter =& $this->Application->recallObject('kMultiLanguage');
+ foreach ($custom_fields as $custom_id => $custom_info) {
+ $custom_name = $ml_formatter->LangFieldName('cust_'.$custom_id);
+ $custom_info['Value'] = $custom_data[$custom_name];
+ $custom_info['CustomDataId'] = 0;
+ $this->AddItemFromArray($custom_info);
+ }
+ }
+
+ function GetFieldUIList($GeneralTab=FALSE)
+ {
+ $ret = new clsConfigAdmin();
+
+ if ($this->NumItems() > 0) {
+ foreach ($this->Items as $field) {
+ if ($GeneralTab == true && $field->Get('OnGeneralTab') == 1 || !$GeneralTab) {
+ $ui = $field->GetAdminUI();
+ array_push($ret->Items,$ui);
+ }
+ }
+ }
+ return $ret;
+ }
+
+ function GetFieldNames()
+ {
+ $res = array();
+ foreach($this->Items as $f)
+ $res[] = $f->Get("FieldName");
+ return $res;
+ }
+
+ function SaveFields()
+ {
+ foreach($this->Items as $i)
+ {
+ if($i->Get("CustomFieldId"))
+ {
+ $i->Update();
+ }
+ else
+ $i->Create();
+ }
+
+ }
+
+ function Query_CustomField($where=NULL,$orderby=NULL,$limit=NULL)
+ {
+ $this->Clear();
+ $sql = "SELECT * FROM ".$this->SourceTable;
+ if(isset($where))
+ $sql = sprintf('%s WHERE %s',$sql,$where);
+ if(isset($orderby) && strlen(trim($orderby))>0)
+ $sql = sprintf('%s ORDER BY %s',$sql,$orderby);
+ if(isset($limit) && strlen(trim($limit)))
+ $sql .= " ".$limit;
+ // $sql."<br>";
+ $this->Query_Item($sql);
+ return $this->Items;
+ }
+
+ function AddField($Type,$FieldName,$FieldLabel,$ShowGeneral=0,$Heading="", $Prompt="",
+ $ElementType="",$ValueList="")
+ {
+ global $objItemTypes,$objSearchConfig,$objLanguages;
+
+ //if(!is_numeric($Type))
+ // {
+ $f = new clsCustomField();
+ $f->tablename = $this->SourceTable;
+ $f->Set(array("Type","FieldName","FieldLabel","OnGeneralTab","Heading","Prompt",
+ "ElementType","ValueList"),
+ array($Type,$FieldName,$FieldLabel,$ShowGeneral,$Heading,$Prompt,
+ $ElementType,$ValueList));
+ $f->Create();
+ $Item = $objItemTypes->GetItem($Type);
+ if(is_object($Item))
+ {
+ //$Table = $Item->Get("SourceTable");
+ $Table = 'CustomField';
+ $Header = "la_text_".strtolower($Item->Get("ItemName"));
+ $Module = $Item->Get("Module");
+// $Desc = $FieldLabel;
+
+ if(!is_object($objSearchConfig))
+ {
+ $objSearchConfig = new clsSearchConfigList();
+ }
+
+ $NextOrder = $objSearchConfig->GetNextDisplayOrder($Module);
+ $desc = "lu_fieldcustom__".strtolower($FieldName);
+ if(!strlen($FieldLabel))
+ {
+ $FieldLabel = $FieldName;
+ }
+
+ $l = $objLanguages->GetPrimary();
+ $phrases = new clsPhraseList();
+ $phrases->AddPhrase($desc,$l,$FieldLabel,2, $Item->Get('Module') );
+
+ $dtable = GetTablePrefix()."CustomMetaData";
+ $Join = "($dtable.ResourceId={Table}.ResourceId)";
+ $objSearchConfig->AddSearchField($Table,$FieldName,$Module,$Type == 6 ? -1 : 0,0,
+ $FieldLabel,$desc,$Header,$NextOrder,0,
+ $ElementType, NULL, NULL, NULL, NULL, NULL,
+ $f->Get("CustomFieldId"), NULL);
+ }
+ return $f;
+ //}
+ //else
+ // return FALSE;
+ }
+
+ function EditField($FieldId,$Type,$FieldName,$FieldLabel,$ShowGeneral=0,$Heading="", $Prompt="",$ElementType="",$ValueList="")
+ {
+ global $objSearchConfig;
+
+ $f = $this->GetItem($FieldId);
+ $f->Set(array("Type","FieldName","FieldLabel","OnGeneralTab","Heading","Prompt","ElementType","ValueList"),
+ array($Type,$FieldName,$FieldLabel,$ShowGeneral,$Heading,$Prompt,$ElementType,$ValueList));
+ $f->Update();
+
+ $db =& $this->adodbConnection;
+
+ if (!$FieldLabel) $FieldLabel = $FieldName;
+ $sql = 'UPDATE '.GetTablePrefix().'SearchConfig
+ SET FieldType = '.$db->qstr($ElementType).',
+ DisplayName = '.$db->qstr('lu_fieldcustom__'.strtolower($FieldName)).',
+ FieldName = '.$db->qstr($FieldName).',
+ Description = '.$db->qstr($FieldLabel).'
+ WHERE CustomFieldId = '.$FieldId;
+ $this->adodbConnection->Execute($sql);
+
+ return $f;
+ }
+
+ function DeleteField($FieldId)
+ {
+ global $objItemTypes, $objSearchConfig;
+ //echo "<pre>"; print_r($objSearchConfig); echo "</pre>";
+ $f = $this->GetItem($FieldId);
+ $Type = $f->Get("Type");
+ $Item = $objItemTypes->GetItem($Type);
+ $Module = $Item->Get("Module");
+ if(is_object($Item))
+ {
+ //$table = $Item->Get("TableName");
+ $table = GetTablePrefix()."CustomField";
+ if(!is_object($objSearchConfig))
+ {
+ $objSearchConfig = new clsSearchConfigList($Module);
+ }
+
+ $sql = 'DELETE FROM '.$objSearchConfig->SourceTable.' WHERE CustomFieldId = '.$FieldId;
+ $this->adodbConnection->Execute($sql);
+
+ $phrase_name = 'lu_fieldcustom__'.strtolower($f->Get('FieldName'));
+ $sql = 'DELETE FROM '.GetTablePrefix().'Phrase WHERE Phrase = '.$this->adodbConnection->qstr($phrase_name);
+ $this->adodbConnection->Execute($sql);
+ }
+ $f->Delete();
+ }
+
+}/*clsCustomFieldList*/
+
+
+?>
Property changes on: branches/unlabeled/unlabeled-1.16.2/kernel/include/customfield.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.16
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.16.2/core/kernel/parser/tags.php
===================================================================
--- branches/unlabeled/unlabeled-1.16.2/core/kernel/parser/tags.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.16.2/core/kernel/parser/tags.php (revision 7869)
@@ -0,0 +1,442 @@
+<?php
+
+define ('parse', 0);
+define ('skip', 1);
+define ('skip_tags', 2);
+
+class MyTagHolder extends kBase {
+
+ var $_Tag;
+
+ function MyTagHolder()
+ {
+
+ }
+
+ function &GetTag($tag_data, &$parser, $inp_tag = 0)
+ {
+ if (!isset($this->_Tag)) {
+ $this->_Tag =& new Tag($tag_data, $parser, $inp_tag);
+ }
+ else {
+// $this->_Tag->Parser =& $parser;
+ $this->_Tag->TagData = $tag_data;
+ if ($tag_data != '') $this->_Tag->ParseTagData($tag_data);
+ $this->_Tag->NP =& $this->_Tag->NamedParams;
+ }
+ return $this->_Tag;
+ }
+
+}
+
+class Tag extends kBase {
+ var $Processor;
+ var $Tag;
+ var $Params = Array();
+ var $NamedParams = Array();
+ var $NP;
+ /**
+ * Enter description here...
+ *
+ * @var TemplateParser
+ */
+ var $Parser;
+ var $TagData = '';
+
+ function Tag($tag_data, &$parser, $inp_tag=0)
+ {
+ parent::kBase();
+ $this->Parser =& $parser;
+ $this->TagData = $tag_data;
+ if ($tag_data != '') $this->ParseTagData($tag_data);
+ $this->NP =& $this->NamedParams;
+ }
+
+ function CopyFrom(&$tag)
+ {
+ $this->Processor = $tag->Processor;
+ $this->Tag = $tag->Tag;
+ $this->TagData = $tag->TagData;
+ $this->Params = $tag->Params;
+ $this->NamedParams = $tag->NamedParams;
+ $this->Parser =& $tag->Parser;
+ }
+
+ function GetFullTag()
+ {
+ return '<%'.$this->TagData.'%>';
+ }
+
+ function RebuildTagData()
+ {
+ $res = $this->Processor.':'.$this->Tag.' ';
+ foreach ($this->NamedParams as $name => $value) {
+ $res .= "$name='$value' ";
+ }
+ return $res;
+ }
+
+ /**
+ * Escape chars in phrase translation, that could harm parser to process tag
+ *
+ * @param string $text
+ * @return string
+ * @access private
+ */
+ function EscapeReservedChars($text)
+ {
+ $reserved = Array('"',"'"); // =
+ $replacement = Array('\"',"\'"); // \=
+ return str_replace($reserved,$replacement,$text);
+ }
+
+
+ function ReplaceParams($tag_data)
+ {
+ //print_pre($this->Parser->Pattern, $tag_data);
+ $values = $this->Parser->Values;
+ foreach($values as $param_name => $param_value)
+ {
+ $values[$param_name] = $this->EscapeReservedChars($param_value);
+ }
+
+ if (is_array($this->Parser->Params)) {
+ $tag_data = preg_replace($this->Parser->Pattern, $values, $tag_data);
+ }
+ //echo "got: $tag_data<br>";
+ return $tag_data;
+ }
+
+ function PreParseReplaceParams($tag_data)
+ {
+ //print_pre($this->Parser->Pattern, $tag_data);
+ $values = $this->Parser->Values;
+ foreach($values as $param_name => $param_value)
+ {
+ $values[$param_name] = $this->EscapeReservedChars($param_value);
+ }
+
+ /*$patterns = Array();
+ if ( is_array($this->Parser->Args) ) {
+ foreach ($this->Parser->Args as $arg) {
+
+ }
+ }*/
+
+ if ($this->Parser->SkipMode == parse) {
+ if (is_array($this->Parser->Params)) {
+ $tag_data = preg_replace($this->Parser->Pattern, $values, $tag_data);
+ }
+ }
+ //echo "got: $tag_data<br>";
+ return $tag_data;
+ }
+
+ function CmpParams($a, $b)
+ {
+ $a_len = strlen($a);
+ $b_len = strlen($b);
+ if ($a_len == $b_len) return 0;
+ return $a_len > $b_len ? -1 : 1;
+ }
+
+ /**
+ * Set's Prefix and Special for Tag object
+ * based on ones from tagname
+ *
+ * @param string $tag_data
+ * @access protected
+ */
+ function ParseTagData($tag_data)
+ {
+ if (defined('EXPERIMENTAL_PRE_PARSE') ) {
+ $this->OriginalTagData = $tag_data;
+ $tag_data = $this->PreParseReplaceParams($tag_data) . ' ';
+ }
+ else {
+ $tag_data = $this->ReplaceParams($tag_data) . ' ';
+// $tag_data = $this->Application->ReplaceLanguageTags($tag_data);
+ }
+
+ list ($key_data, $params) = split("[ \t\n]{1}", $tag_data, 2);
+ $key_data = trim($key_data);
+
+ $tmp=explode(':',$key_data);
+ $this->Tag=$tmp[1];
+
+ $tmp=$this->Application->processPrefix($tmp[0]);
+ $this->Prefix=$tmp['prefix'];
+ $this->Special=$tmp['special'];
+ $this->Processor=$this->Prefix;
+
+ if ($params != '') {
+ $this->ParseNamedParams($params);
+ }
+ else {
+ $this->NamedParams = array();
+ }
+ }
+
+ function ParseNamedParams($params_str)
+ {
+ $params =& new Params($params_str);
+ $this->NamedParams = $params->_Params;
+ }
+
+ function GetParam($param)
+ {
+ if (isset($this->NP[$param]))
+ return $this->NP[$param];
+ else
+ return false;
+ }
+
+ /**
+ * Process IF tags in specific way
+ *
+ */
+ function Process()
+ {
+ if ($this->Processor == 'm' || $this->Processor == 'm_TagProcessor') { //if we are procssing Main tags
+ if ($this->Tag == 'block' || $this->Tag == 'DefineElement') {
+ $tag =& new BlockTag('', $this->Parser);
+ $tag->CopyFrom($this);
+ $tag->Process();
+ }
+ elseif ($this->Parser->SkipMode == skip_tags) {
+ return;
+ }
+ elseif (
+ $this->Tag == 'if' ||
+ $this->Tag == 'ifnot' ||
+ $this->Tag == 'else' ||
+ $this->Tag == 'elseif'
+ )
+ {
+ if ( defined('EXPERIMENTAL_PRE_PARSE') ) {
+ $this->Parser->AppendCompiledCode( $this->GetCode() );
+ }
+ $tag =& new ConstructTag('', $this->Parser);
+ $tag->CopyFrom($this);
+ $tag->Process();
+ }
+ else {
+ if ($this->Parser->SkipMode == skip) {
+ if ( defined('EXPERIMENTAL_PRE_PARSE') ) {
+ $this->Parser->AppendCompiledCode( $this->GetCode() );
+ }
+ return;
+ }
+ $this->ProcessTag();
+ if ( defined('EXPERIMENTAL_PRE_PARSE') ) {
+ $this->Parser->AppendCompiledCode( $this->GetCode() );
+ }
+ }
+ }
+ else { //normal tags - processors other than main
+ if ($this->Parser->SkipMode == skip) { // inside if - add statements inside if to compiled code
+ if ( defined('EXPERIMENTAL_PRE_PARSE') ) {
+ $this->Parser->AppendCompiledCode( $this->GetCode() );
+ }
+ return;
+ }
+ elseif ($this->Parser->SkipMode == skip_tags) return; //do not parse if we skipping tags
+ $this->ProcessTag();
+ if ( defined('EXPERIMENTAL_PRE_PARSE') ) {
+ $this->Parser->AppendCompiledCode( $this->GetCode() );
+ }
+ }
+ }
+
+ /**
+ * Set's Prefix and Special for TagProcessor
+ * based on tag beeing processed
+ *
+ * @return string
+ * @access protected
+ */
+ function DoProcessTag()
+ {
+ // $tag->Prefix - l_TagProcessor
+ $tmp = $this->Application->processPrefix($this->Processor);
+
+ if (isset($this->NamedParams['_ignore_missing_'])) {
+ if (!$this->Application->prefixRegistred($tmp['prefix'])) return '';
+ }
+
+ $processor =& $this->Application->recallObject($tmp['prefix'].'_TagProcessor'); // $this->Processor
+
+ $tmp=explode('_',$tmp['prefix'],2);
+ $processor->Prefix=$tmp[0];
+ $processor->Special=$this->Special;
+
+ // pass_params for non ParseBlock tags :)
+ $parser_params = $this->Application->Parser->Params;
+ if( getArrayValue($this->NamedParams,'pass_params') )
+ {
+ unset( $this->NamedParams['pass_params'] );
+ $this->NamedParams = array_merge_recursive2($parser_params, $this->NamedParams);
+ }
+
+ return $processor->ProcessTag($this);
+ }
+
+ function ProcessTag()
+ {
+ $o = $this->DoProcessTag();
+ if ($o !== false)
+ {
+ $this->Parser->AppendOutput($o);
+ }
+ else
+ {
+ trigger_error('can\'t process tag '.$this->Tag.' in '.$this->Prefix,E_USER_WARNING);
+ }
+ }
+
+ function GetCode($echo=false)
+ {
+ $tmp_params = $this->NamedParams;
+ $splited = split("[ \t\n]{1}", $this->OriginalTagData, 2);
+ if (isset($splited[1]) && $splited[1]) {
+ $this->ParseNamedParams($splited[1]);
+ }
+ $pass_params = $this->NamedParams;
+ $this->NamedParams = $tmp_params;
+
+ $code = Array();
+
+ $to_pass = 'Array(';
+ foreach ($pass_params as $name => $val) {
+ $to_pass .= '"'.$name.'" => "'.str_replace('"', '\"', $val).'",';
+ }
+ $to_pass .= ')';
+
+ if ($echo) $code[] = '$o = '."'';\n";
+
+ switch ( $this->Tag ) {
+ case 'DefaultParam':
+ foreach ($this->NP as $key => $val) {
+ $code[] = 'if (!isset($'.$key.')) $application->Parser->SetParam(\''.$key.'\', \''.$val.'\');';
+ $code[] = '$'.$key.' = isset($'.$key.') ? $'.$key.' : \''.$val.'\';';
+ }
+ return $code;
+ case 'param':
+ $param_code = '$o .= $params["'.$this->NP['name'].'"]';
+ if (isset($this->NP['plus'])) {
+ $param_code .= ' + '.$this->NP['plus'];
+ }
+ $code[] = $param_code.';';
+ return $code;
+ case 'if':
+ if (isset($this->NP['_closing_tag_'])) {
+ $code[] = ' }';
+ }
+ else {
+
+ $check = $this->GetParam('check');
+ if ($check) {
+ if (strpos($check, '_') !== false) {
+ list($prefix, $function) = explode('_', $check, 2);
+ }
+ else {
+ $function = $check;
+ $prefix = '$PrefixSpecial';
+
+// $prefix = $this->Parser->GetParam('PrefixSpecial');
+ }
+ }
+ else {
+ $prefix = $this->GetParam('prefix');
+ $function = $this->GetParam('function');
+ }
+
+ $code[] = '$tmp = $application->processPrefix("'.$prefix.'");'."\n";
+ $code[] = '$__tp = $tmp[\'prefix\'].\'_TagProcessor\';'."\n";
+ $code[] = '$p =& $application->recallObject($__tp);'."\n";
+ $code[] = '$p->Prefix = $tmp[\'prefix\'];'."\n";
+ $code[] = '$p->Special = $tmp[\'special\'];'."\n";
+ $code[] = '$if_result = $p->ProcessParsedTag(\''.$function.'\', '.$to_pass.', "'.$prefix.'");'."\n";
+ if (isset($pass_params['inverse'])) {
+ $code[] = 'if (!$if_result) {';
+ }
+ else {
+ $code[] = 'if ($if_result) {';
+ }
+ }
+ return $code;
+
+ case 'endif':
+ $code[] = ' }';
+ return $code;
+
+ case 'else':
+ $code[] = ' }';
+ $code[] = ' else {';
+ return $code;
+ }
+
+ /* $tmp_pref = $this->getPrefixSpecial();
+ $tmp = $this->Application->processPrefix($tmp_pref);
+ $tmp_processor = $tmp['prefix'].'_TagProcessor';
+ if (strpos($tmp['prefix'], '$') !== false) {
+ $processor_to_check = '{'.$tmp['prefix'].'}_TagProcessor';
+ }
+ else {
+ $processor_to_check = $tmp_processor;
+ } */
+
+ if (isset($this->NamedParams['_auto_prefix_'])) {
+ $prefix = '$PrefixSpecial';
+ }
+ else {
+ // use original prefix_special found in templates (parameter names in form $ParamName found in it will not be replaced with values)
+ list ($prefix, $tag) = explode(':', $splited[0], 2); //$prefix = $this->getPrefixSpecial();
+
+ if (isset($this->NamedParams['_ignore_missing_'])) {
+ if (!$this->Application->prefixRegistred($prefix)) return array();
+ }
+ }
+
+ $code[] = '$tmp = $application->processPrefix("'.$prefix.'");'."\n";
+
+ /*if (!isset($this->Application->CompilationCache[$this->getPrefixSpecial()])) {
+ $code[] = '$tmp = $application->processPrefix("'.$this->getPrefixSpecial().'");'."\n";
+ $code[] = '$__tp = $tmp[\'prefix\'].\'_TagProcessor\';'."\n";
+ $code[] = '$application->CachedProcessors["'.$this->getPrefixSpecial().'"] =& $application->recallObject($__tp);'."\n";
+ $this->Application->CompilationCache[$this->getPrefixSpecial()] = true;
+
+ if (strpos($tmp_pref, '$') === false) {
+ $this->Application->CachedProcessors[$this->getPrefixSpecial()] =& $this->Application->recallObject($tmp_processor);
+ }
+ }
+
+ $this->Parser->UsedProcessors[] = $tmp['prefix'];*/
+ $code[] = '$__tp = $tmp[\'prefix\'].\'_TagProcessor\';'."\n";
+ $code[] = '$p =& $application->recallObject($__tp);'."\n";
+ $code[] = '$p->Prefix = $tmp[\'prefix\'];'."\n";
+ $code[] = '$p->Special = $tmp[\'special\'];'."\n";
+
+ $tag_func = $this->Tag;
+ if ($tag_func == 'include') $tag_func = 'MyInclude';
+
+// $code[] = '$o .= $application->CachedProcessors["'.$this->getPrefixSpecial().'"]->ProcessParsedTag(\''.$tag_func.'\', '.$to_pass.', "'.$this->Processor.'");'."\n";
+
+ $code[] = '$o .= $p->ProcessParsedTag(\''.$tag_func.'\', '.$to_pass.', "'.$this->Processor.'");'."\n";
+
+ /*$code = ' $processor =& $application->recallObject(\''.$this->Processor.'_TagProcessor\');
+ $o .= $processor->ProcessParsedTag(\''.$this->Tag.'\', unserialize(\''.serialize($this->NP).'\'));';*/
+
+ if (isset($pass_params['result_to_var'])) {
+ $code[] = '$'.$pass_params['result_to_var'].' = $application->Parser->GetParam(\''.$pass_params['result_to_var'].'\');';
+ $echo = false;
+ }
+
+ if ($echo) $code[] = ' echo $o;'."\n";
+
+ return $code;
+ //return '$o .= \'tag:'. $this->Tag .'\'';
+ }
+}
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.16.2/core/kernel/parser/tags.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.16
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.16.2/admin/email/do_send.php
===================================================================
--- branches/unlabeled/unlabeled-1.16.2/admin/email/do_send.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.16.2/admin/email/do_send.php (revision 7869)
@@ -0,0 +1,271 @@
+<?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. ##
+##############################################################
+
+// new startup: begin
+define('REL_PATH', 'admin/email');
+$relation_level = count( explode('/', REL_PATH) );
+define('FULL_PATH', realpath(dirname(__FILE__) . str_repeat('/..', $relation_level) ) );
+require_once FULL_PATH.'/kernel/startup.php';
+// new startup: end
+
+$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");
+
+//Set Section
+$section = 'in-portal:sendmail';
+
+//Set Environment Variable
+$envar = "env=" . BuildEnv();
+
+$State = $_POST["EmailState"];
+if(!strlen($State))
+{
+ $State = $_GET["EmailState"];
+}
+
+$ado = &GetADODBConnection();
+$table = "ses_".$objSession->GetSessionKey()."_sendmail";
+$MessagesPerPage =2;
+
+$SendQueue = new clsEmailQueue($table,$MessagesPerPage);
+
+$FromUser = $objUsers->GetItem($objSession->Get("PortalUserId"));
+
+$FromAddr = $FromUser->Get("Email");
+$FromName = $FromUser->Get("FirstName")." ".$FromUser->Get("LastName");
+
+if(!strlen(trim($FromAddr)))
+{
+ $FromAddr = $objConfig->Get("Smtp_AdminMailFrom");
+}
+
+if(!strlen(trim($FromName)))
+{
+ $FromName = strip_tags( $objConfig->Get('Site_Name') );
+}
+
+$TargetURL = $_SERVER["PHP_SELF"]."?".$envar.'&destform=popup';
+$CancelURL = $TargetURL."&EmailState=email_user_cancel";
+
+ function getEmailFooter($is_html = true)
+ {
+ static $footer = Array('html' => null, 'plain' => null);
+
+ $footer_body =& $footer[$is_html ? 'html' : 'plain'];
+ if (is_null($footer_body)) {
+ $application =& kApplication::Instance();
+
+ $esender =& $application->recallObject('EmailSender');
+ /* @var $esender kEmailSendingHelper */
+
+ $sql = 'SELECT em.Template
+ FROM '.TABLE_PREFIX.'EmailMessage em
+ LEFT JOIN '.TABLE_PREFIX.'Events e ON e.EventId = em.EventId
+ WHERE em.LanguageId = '.$application->GetVar('m_lang').' AND e.Event = "COMMON.FOOTER"';
+ $footer_body = explode("\n\n", $application->Conn->GetOne($sql));
+ $footer_body = "\r\n".($is_html ? '<br/>'.$footer_body[1] : $esender->ConvertToText($footer_body[1]));
+ }
+ return $footer_body;
+ }
+
+
+/*Initialize page*/
+switch($State)
+{
+ case "email_single_send": /*single user send */
+ $PageTitle = admin_language("la_Title_SendInit");
+ $Subject = $_POST["subject"];
+ $Html = $_POST["messageHTML"];
+ $Text = strip_tags($_POST["messageTEXT"]);
+
+ if(is_array($_FILES))
+ {
+ $attatch = $_FILES["attatchment"];
+ if(strlen($attatch["name"]) >0 && $attatch["size"]>0)
+ {
+ $FileName = $attatch["name"];
+ $FileLoc = $attatch["tmp_name"];
+ }
+ else
+ {
+ $FileName = NULL;
+ $FileLoc = NULL;
+ }
+ }
+ else
+ {
+ $FileName = NULL;
+ $FileLoc = NULL;
+ }
+ $charset = "";
+ $TargetURL .= "&EmailState=email_send_complete";
+ break;
+ case "email_multi_send": /*Init multiuser send*/
+ $UserList = explode(",",$_POST["sendaddrs"]);
+ //echo $_POST["sendaddrs"]."<br>\n";
+
+ $Subject = $_POST["subject"];
+ $Html = $_POST["messageHTML"];
+ $Text = strip_tags($_POST["messageTEXT"]);
+
+ if(is_array($_FILES))
+ {
+ $attatch = $_FILES["attatchment"];
+ if(strlen($attatch["name"]) >0 && $attatch["size"]>0)
+ {
+ $FileName = $attatch["name"];
+ $FileLoc = $attatch["tmp_name"];
+ }
+ else
+ {
+ $FileName = NULL;
+ $FileLoc = NULL;
+ }
+ }
+ else
+ {
+ $FileName = NULL;
+ $FileLoc = NULL;
+ }
+
+ $charset = "";
+ $PageTitle = admin_language("la_Title_SendMailInit");
+ $TargetURL .="&EmailState=email_send_progress&Start=0&Total=".count($UserList);
+ break;
+ case "email_send_progress":
+ $total = $_GET["Total"];
+ $start = $_GET["Start"];
+ if($start < $total)
+ {
+ $pct = (int)(($start/$total)*100);
+ $NewStart = $start+$MessagesPerPage;
+ $TargetURL .= "&EmailState=email_send_progress&Start=$NewStart&Total=$total";
+ $PageTitle = admin_language("la_Title_SendMailProgress")." - ".$pct."% ".admin_language("la_Text_Complete");
+ }
+ else
+ {
+ $PageTitle = admin_language("la_Title_SendMailProgress");
+ $TargetURL .= "&EmailState=email_send_complete";
+ }
+ break;
+ case "email_send_complete":
+ $PageTitle = admin_language("la_Title_SendMailComplete");
+ $TargetURL="";
+ break;
+ case "email_user_cancel":
+ $PageTitle = admin_language("la_Title_SendMailCancel");
+ $TargetURL = "";
+ break;
+
+}
+
+ int_header(NULL,NULL,admin_language("la_Title_PleaseWait"));
+ echo "\n";
+
+/*do page functions */
+// echo "Current State:". $State."<br>\n";
+
+if ($Html) $Html .= getEmailFooter(true);
+if ($Text) $Text .= getEmailFooter(false);
+
+
+echo "<TABLE border=0 width=\"100%\" height=\"90%\"><TR><TD valign=\"top\" align=\"middle\">";
+switch($State)
+{
+case "email_single_send": /*single user send */
+ $PageTitle = admin_language($Pagetitle);
+ $ToAddr = $_POST["sendaddrs"];
+
+ $SendQueue->SendMail($FromAddr,$FromName,$ToAddr,"",$Subject,$Text,$Html,$charset, "",$FileName,$FileLoc,0, NULL);
+ $o = "<TABLE CLASS=\"tableborder_full\" width=\"75%\">";
+ $o .= int_subsection_title_ret($PageTitle);
+ $o .= "<TD COLSPAN=2>".admin_language("la_prompt_EmailInitMessage")."</TD></TR>";
+ $o .= "<TD ALIGN=\"middle\" COLSPAN=2></TD></TR>";
+ $o .= "</TABLE><input type=button CLASS=\"button\" VALUE=\"".admin_language("la_Cancel")."\" ONCLICK=\"document.location='".$CancelURL."';\">";
+ echo $o."\n";
+ break;
+ case "email_multi_send": /*Init multiuser send*/
+ /*Create storage Table for Queue */
+ $o = "<TABLE CLASS=\"tableborder_full\" width=\"75%\">";
+ $o .= int_subsection_title_ret($PageTitle);
+ $o .= "<tr><TD COLSPAN=2>".admin_language("la_prompt_EmailInitMessage")."</TD></TR>";
+ $o .= "<TD ALIGN=\"middle\" COLSPAN=2></TD></TR>";
+ $o .= "</TABLE><input type=button CLASS=\"button\" VALUE=\"".admin_language("la_Cancel")."\" ONCLICK=\"document.location='".$CancelURL."';\">";
+ echo $o."\n";
+
+ $sql = "CREATE TABLE $table SELECT * FROM ".$objEmailQueue->SourceTable." WHERE queued=99";
+ $ado->Execute($sql);
+ //echo $sql."<br>\n";
+ for($i=0;$i<count($UserList);$i++)
+ {
+ $ToAddr = $UserList[$i];
+ //$From,$FromName,$To,$ToName,$Subject,$Text,$Html,$charset,$AttmFiles,$QueueOnly=0
+ $SendQueue->SendMail($FromAddr,$FromName,$ToAddr,"",$Subject,$Text,$Html,$charset, "",$FileName,$FileLoc,1, NULL);
+ }
+ break;
+ case "email_send_progress":
+ $sql = "SELECT * FROM $table LIMIT $start,".$MessagesPerPage;
+ // echo $sql."<br>\n";
+ $rs = $ado->Execute($sql);
+ while($rs && !$rs->EOF)
+ {
+ $data = $rs->fields;
+
+ $SendQueue->DeliverMail($data["toaddr"],$data["fromaddr"],$data["Subject"],$data["message"],$data["headers"],1);
+ $rs->MoveNext();
+ }
+ $o = "<TABLE CLASS=\"tableborder_full\" width=\"75%\">";
+ $o .= int_subsection_title_ret($PageTitle);
+ $o .="<TR border=1><TD width=\"".$pct."%\" STYLE=\"background:url('".$adminURL."/images/progress_bar_segment.gif');\"> </TD>";
+ $comp_pct = 100-$pct;
+ $o .= "<TD bgcolor=#FFFFFF width=\"".$comp_pct."%\"></TD></TR>";
+ $o .= "</TABLE>";
+ $o .= "<input type=button VALUE=\"".admin_language("la_Cancel")."\" CLASS=\"button\" ONCLICK=\"document.location='".$CancelURL."';\">";
+
+ echo $o."\n";
+ break;
+ case "email_send_complete":
+ $sql = "DROP TABLE IF EXISTS $table";
+ $ado->Execute($sql);
+ $o = "<TABLE CLASS=\"tableborder_full\" width=\"75%\">";
+ $o .= int_subsection_title_ret($PageTitle);
+ $o .= "<TR><TD COLSPAN=2>".admin_language("la_prompt_EmailCompleteMessage")."</TD></TR>";
+ $o .= "<TD ALIGN=\"middle\" COLSPAN=2></TD></TR>";
+ $o .= "</TABLE><input type=button VALUE=\"".admin_language("la_Close")."\" CLASS=\"button\" ONCLICK=\"window.close();\">";
+ echo $o."\n";
+ break;
+ case "email_user_cancel":
+ $o = "<TABLE CLASS=\"tableborder_full\" width=\"75%\">";
+ $o .= int_subsection_title_ret($PageTitle);
+ $o .= "<TR><TD COLSPAN=2>".admin_language("la_prompt_EmailCancelMessage")."</TD></TR>";
+ $o .= "</TABLE><input type=button VALUE=\"".admin_language("la_Close")."\" CLASS=\"button\" ONCLICK=\"window.close();\">";
+ echo $o."\n";
+
+ break;
+}
+echo "</TD></TR></TABLE>";
+if(strlen($TargetURL))
+{
+?>
+<SCRIPT LANGUAGE="JavaScript">
+ document.location = '<?php echo $TargetURL; ?>';
+</SCRIPT>
+<?php
+}
+?>
+<?php int_footer(); ?>
Property changes on: branches/unlabeled/unlabeled-1.16.2/admin/email/do_send.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.16
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Event Timeline
Log In to Comment