function Load_Options($options)
 {
     $options = (array) $options;
     // Delete empty values
     foreach ($options as $key => $value) {
         if (!$value) {
             unset($options[$key]);
         }
     }
     // Load options
     $this->arr_option = Array_Merge($this->Default_Options(), $options);
 }
Exemplo n.º 2
1
 static function addRewriteRules($rules)
 {
     if (Is_Array(self::$rewrite_rules) && Is_Array($rules)) {
         return Array_Merge(self::$rewrite_rules, $rules);
     } else {
         return $rules;
     }
 }
Exemplo n.º 3
1
 function load_parameters()
 {
     // Load Parameters
     $_REQUEST = Array_Merge(array('a' => 0, 'h' => 0, 'w' => 0, 'c' => 0, 'g' => 0, 'q' => 80), $_REQUEST);
     $this->attachment_id = IntVal($_REQUEST['a']);
     if ($this->attachment_id < 1) {
         die('I do not think that ' . $this->attachment_id . ' is a valid attachment id.');
     }
     $this->attachment_file = RealPath(get_attached_file($this->attachment_id));
     if (!Is_File($this->attachment_file)) {
         die('Could not find this attachment.');
     }
     $this->dst_height = IntVal($_REQUEST['h']);
     if ($this->dst_height < 1) {
         $this->dst_height = 0;
     }
     $this->dst_width = IntVal($_REQUEST['w']);
     if ($this->dst_width < 1) {
         $this->dst_width = 0;
     }
     if ($this->dst_width < 1 && $this->dst_height < 1) {
         die('New dimensions cannot be less then 1.');
     }
     $this->crop = IntVal($_REQUEST['c']);
     if ($this->crop == 0) {
         $this->crop = False;
     } else {
         $this->crop = True;
     }
     if ($this->crop && ($this->dst_width < 1 || $this->dst_height < 1)) {
         die('If you want something cropped please tell me the dimensions.');
     }
     $this->grayscale = IntVal($_REQUEST['g']);
     if ($this->grayscale == 0) {
         $this->grayscale = False;
     } else {
         $this->grayscale = True;
     }
     $this->negate = IntVal($_REQUEST['n']);
     if ($this->negate == 0) {
         $this->negate = False;
     } else {
         $this->negate = True;
     }
     $this->dst_qualy = IntVal($_REQUEST['q']);
     if ($this->dst_qualy < 1 || $this->dst_qualy > 100) {
         $this->dst_qualy = 80;
     }
 }
Exemplo n.º 4
1
function Tree_Parents($TableID, $RowID)
{
    /****************************************************************************/
    $__args_types = array('string', 'integer');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $Regulars = Regulars();
    #-----------------------------------------------------------------------------
    if (!Preg_Match($Regulars['ID'], $TableID)) {
        return new gException('WRONG_TABLE_ID', 'Неверный идентификатор таблицы');
    }
    #-----------------------------------------------------------------------------
    $Row = DB_Select($TableID, '*', array('UNIQ', 'ID' => $RowID));
    #---------------------------------------------------------------------------
    switch (ValueOf($Row)) {
        case 'error':
            return ERROR | @Trigger_Error('[Tree_Parents]: не возможно найти запись');
        case 'exception':
            return new gException('ROW_NOT_FOUND', 'Запись не найдена');
        case 'array':
            #-------------------------------------------------------------------------
            $Query = SPrintF('SELECT * FROM `%s` `TableA` WHERE `ParentID` = %u AND `ID` != `ParentID` AND EXISTS(SELECT * FROM `%s` `TableB` WHERE `TableB`.`ParentID` = `TableA`.`ID`)', $TableID, $Row['ID'], $TableID);
            #-------------------------------------------------------------------------
            $IsQuery = DB_Query($Query);
            if (Is_Error($IsQuery)) {
                return ERROR | @Trigger_Error('[Tree_Parents]: не возможно найти дочерние записи');
            }
            #-------------------------------------------------------------------------
            $Childs = MySQL::Result($IsQuery);
            #-------------------------------------------------------------------------
            $Result = array($Row['ID']);
            #-------------------------------------------------------------------------
            foreach ($Childs as $Child) {
                #-----------------------------------------------------------------------
                $Parents = Tree_Parents($TableID, (int) $Child['ID']);
                #-----------------------------------------------------------------------
                switch (ValueOf($Parents)) {
                    case 'error':
                        return ERROR | @Trigger_Error('[Tree_Parents]: не возможно определить дочерние вхождения записей');
                    case 'exception':
                        return ERROR | @Trigger_Error('[Tree_Parents]: запись оказавшаяся дочерней не найдена');
                    case 'array':
                        $Result = Array_Merge($Result, $Parents);
                        break;
                    default:
                        return ERROR | @Trigger_Error(101);
                }
            }
            #-------------------------------------------------------------------------
            return $Result;
            break;
        default:
            return ERROR | @Trigger_Error(101);
    }
}
Exemplo n.º 5
1
function HTTP_Send($Target, $Settings, $Get = array(), $Post = array(), $Addins = array())
{
    /******************************************************************************/
    $__args_types = array('string', 'array', 'array', 'string,array', 'array');
    #-------------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /******************************************************************************/
    $Default = array('Protocol' => 'tcp', 'Address' => 'localhost', 'Port' => 8080, 'Host' => 'localhost', 'Basic' => '', 'Charset' => 'UTF-8', 'Hidden' => '', 'IsLogging' => TRUE);
    #-------------------------------------------------------------------------------
    Array_Union($Default, $Settings);
    #-------------------------------------------------------------------------------
    $IsLogging = (bool) $Default['IsLogging'];
    #-------------------------------------------------------------------------------
    $Tmp = System_Element('tmp');
    if (Is_Error($Tmp)) {
        return ERROR | @Trigger_Error('[HTTP_Send]: не удалось определить путь временной директории');
    }
    #-------------------------------------------------------------------------------
    $Config = Config();
    #-------------------------------------------------------------------------------
    $Address = $Default['Address'];
    #-------------------------------------------------------------------------------
    Debug(SPrintF('[HTTP_Send]: соединяемся с (%s:%u)', $Address, $Default['Port']));
    #-------------------------------------------------------------------------------
    # https://bugs.php.net/bug.php?id=52913
    # пришлось заменить: $Address -> $Default['Host']
    $Socket = @FsockOpen(SPrintF('%s://%s', $Protocol = $Default['Protocol'], $Default['Host']), $Port = $Default['Port'], $nError, $sError, $Config['Other']['Libs']['HTTP']['SocketTimeout']);
    if (!Is_Resource($Socket)) {
        #-------------------------------------------------------------------------------
        $IsWrite = IO_Write(SPrintF('%s/logs/http-send.log', $Tmp), SPrintF("%s://%s:%u ошибка соединения\n\n", $Protocol, $Address, $Port));
        if (Is_Error($IsWrite)) {
            return ERROR | @Trigger_Error('[HTTP_Send]: не удалось записать данные в лог файл');
        }
        #-------------------------------------------------------------------------------
        return ERROR | @Trigger_Error('[HTTP_Send]: не удалось соединиться с удаленным хостом');
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    # added by lissyara, 2012-01-04 in 08:42:54 MSK, for JBS-130
    Stream_Set_TimeOut($Socket, $Config['Other']['Libs']['HTTP']['StreamTimeout']);
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    $Charset = $Default['Charset'];
    #-------------------------------------------------------------------------------
    $Method = Count($Post) > 0 ? 'POST' : 'GET';
    #-------------------------------------------------------------------------------
    $Hidden = $Default['Hidden'];
    #-------------------------------------------------------------------------------
    if (Count($Get)) {
        $Target .= SPrintF('?%s', HTTP_Query($Get, $Charset, $Hidden, $IsLogging));
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    $Headers[] = SPrintF('%s %s HTTP/1.0', $Method, $Target);
    #-------------------------------------------------------------------------------
    $Headers[] = SPrintF('Host: %s', $Default['Host']);
    #-------------------------------------------------------------------------------
    $Headers[] = 'Connection: close';
    #-------------------------------------------------------------------------------
    $Headers = Array_Merge($Headers, $Addins);
    #-------------------------------------------------------------------------------
    if ($Basic = $Default['Basic']) {
        #-------------------------------------------------------------------------------
        $Basic = Base64_Encode($Basic);
        #-------------------------------------------------------------------------------
        $Headers[] = SPrintF('Authorization: Basic %s', $Basic);
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    $Body = '';
    #-------------------------------------------------------------------------------
    if ($Post) {
        #-------------------------------------------------------------------------------
        if (Is_Array($Post)) {
            #-------------------------------------------------------------------------------
            if (Count($Post) > 0) {
                #-------------------------------------------------------------------------------
                $Headers[] = 'Content-Type: application/x-www-form-urlencoded';
                #-------------------------------------------------------------------------------
                $Body = HTTP_Query($Post, $Charset, $Hidden, $IsLogging);
                #-------------------------------------------------------------------------------
            }
            #-------------------------------------------------------------------------------
        } else {
            #-------------------------------------------------------------------------------
            $Body = Mb_Convert_Encoding($Post, $Charset);
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    if ($Length = MB_StrLen($Body, 'ASCII')) {
        $Headers[] = SPrintF('Content-Length: %u', $Length);
    }
    #-------------------------------------------------------------------------------
    $Query = SPrintF("%s\r\n\r\n%s", Implode("\r\n", $Headers), $Body);
    #-------------------------------------------------------------------------------
    Debug(SPrintF("[HTTP_Send]: делаем запрос:\n%s", $Query));
    #-------------------------------------------------------------------------------
    if (!@Fwrite($Socket, $Query)) {
        return ERROR | @Trigger_Error('[HTTP_Send]: не удалось записать в сокет');
    }
    #-------------------------------------------------------------------------------
    # added by lissyara, 2014-01-28 in 14:19:08 MSK, for JBS-130
    Stream_Set_TimeOut($Socket, $Config['Other']['Libs']['HTTP']['StreamTimeout']);
    #-------------------------------------------------------------------------------
    $Receive = '';
    #-------------------------------------------------------------------------------
    do {
        #-------------------------------------------------------------------------------
        $Bytes = @FGets($Socket);
        #-------------------------------------------------------------------------------
        $Receive .= $Bytes;
        #-------------------------------------------------------------------------------
    } while ($Bytes);
    #-------------------------------------------------------------------------------
    @Fclose($Socket);
    #-------------------------------------------------------------------------------
    if (Preg_Match('/Content-Type:[\\sa-zA-Z0-9\\/\\-\\;]+charset\\=([a-zA-Z0-9\\-]+)/i', $Receive, $Matches)) {
        #-------------------------------------------------------------------------------
        $Receive = Mb_Convert_Encoding($Receive, 'UTF-8', Next($Matches));
        #-------------------------------------------------------------------------------
    } else {
        #-------------------------------------------------------------------------------
        $Receive = Mb_Convert_Encoding($Receive, 'UTF-8', $Default['Charset']);
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    Debug(SPrintF("[HTTP_Send]: получили ответ:\n%s", $Receive));
    #-------------------------------------------------------------------------------
    $Log = SPrintF("%s://%s:%u [%s]\n%s\n%s\n\n", $Protocol, $Address, $Port, Date('r'), $Query, $Receive);
    #-------------------------------------------------------------------------------
    if ($Hidden) {
        #-------------------------------------------------------------------------------
        if (!Is_Array($Hidden)) {
            $Hidden = array($Hidden);
        }
        #-------------------------------------------------------------------------------
        foreach ($Hidden as $Pattern) {
            #-------------------------------------------------------------------------------
            $Pattern = UrlEncode(Mb_Convert_Encoding($Pattern, $Charset));
            #-------------------------------------------------------------------------------
            $Log = Str_Replace($Pattern, SPrintF('[HIDDEN=(%u)]', StrLen($Pattern)), $Log);
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    if ($Default['IsLogging']) {
        #-------------------------------------------------------------------------------
        $IsWrite = IO_Write(SPrintF('%s/logs/http-send.log', $Tmp), $Log);
        if (Is_Error($IsWrite)) {
            return ERROR | @Trigger_Error('[HTTP_Send]: не удалось записать данные в лог файл');
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    $Heads = $Body = array();
    #-------------------------------------------------------------------------------
    foreach (Explode("\r\n\r\n", $Receive) as $Chunk) {
        #-------------------------------------------------------------------------------
        if (Preg_Match('#^HTTP/1\\.*#', $Chunk)) {
            #-------------------------------------------------------------------------------
            $Heads[] = $Chunk;
            #-------------------------------------------------------------------------------
        } else {
            #-------------------------------------------------------------------------------
            $Body[] = $Chunk;
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    if (SizeOf($Body) < 1) {
        return ERROR | @Trigger_Error('[HTTP_Send]: ответ от сервера не верен');
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    return array('Heads' => Implode("\r\n\r\n", $Heads), 'Body' => Implode("\r\n\r\n", $Body));
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    #$Receive = Preg_Split('/\r\n\r\n/',$Receive,PREG_SPLIT_DELIM_CAPTURE);
    #-------------------------------------------------------------------------------
    #if(Count($Receive) < 2)
    #	return ERROR | @Trigger_Error('[HTTP_Send]: ответ от сервера не верен');
    #-------------------------------------------------------------------------------
    #$Receive = Array_Combine(Array('Heads','Body'),$Receive);
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    #return $Receive;
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
}
Exemplo n.º 6
0
 static function Related_Terms($attributes = Null)
 {
     $attributes = Is_Array($attributes) ? $attributes : array();
     $attributes = Array_Merge(array('number' => 5), $attributes);
     $related_terms = Core::getTagRelatedTerms($attributes);
     return Template::load('glossary-related-terms.php', array('attributes' => $attributes, 'related_terms' => $related_terms));
 }
Exemplo n.º 7
0
 static function getTagRelatedTerms($arguments = Null)
 {
     global $wpdb, $post;
     $arguments = Is_Array($arguments) ? $arguments : array();
     # Load default arguments
     $arguments = (object) Array_Merge(array('term_id' => $post->ID, 'number' => 10, 'taxonomy' => 'glossary-tag'), $arguments);
     # apply filter
     $arguments = Apply_Filters('glossary_tag_related_terms_arguments', $arguments);
     # Get the Tags
     $arr_tags = WP_Get_Post_Terms($arguments->term_id, $arguments->taxonomy);
     if (empty($arr_tags)) {
         return False;
     }
     # Get term IDs
     $arr_term_ids = array();
     foreach ($arr_tags as $taxonomy) {
         $arr_term_ids[] = $taxonomy->term_taxonomy_id;
     }
     $str_tag_list = Implode(',', $arr_term_ids);
     # The Query to get the related posts
     $stmt = " SELECT posts.*,\n                     COUNT(term_relationships.object_id) AS common_tag_count\n              FROM   {$wpdb->term_relationships} AS term_relationships,\n                     {$wpdb->posts} AS posts\n              WHERE  term_relationships.object_id = posts.id\n              AND    term_relationships.term_taxonomy_id IN({$str_tag_list})\n              AND    posts.id != {$arguments->term_id}\n              AND    posts.post_status = 'publish'\n              GROUP  BY term_relationships.object_id\n              ORDER  BY common_tag_count DESC,\n                     posts.post_date_gmt DESC\n              LIMIT  0, {$arguments->number}";
     # Put it in a WP_Query
     $query = new WP_Query();
     $query->posts = $wpdb->Get_Results($stmt);
     $query->post_count = Count($query->posts);
     $query->Rewind_Posts();
     # return
     if ($query->post_count == 0) {
         return False;
     } else {
         return $query;
     }
 }
Exemplo n.º 8
0
$NowDayOfWeek = $DateTimeArray['wday'];
$NowDayOfMonth = $DateTimeArray['mday'];
#-------------------------------------------------------------------------------
isset($Task['Params']['TasksArray']) ? $TasksArray = $Task['Params']['TasksArray'] : ($TasksArray = FALSE);
isset($Task['Params']['NowTask']) ? $NowTask = $Task['Params']['NowTask'] : ($NowTask = FALSE);
$IsEnded = FALSE;
#-------------------------------------------------------------------------------
# Формируем массив задач при первом запуске
if (!$TasksArray && !$NowTask) {
    Debug("[Tasks/GC]: Формируем массив задач");
    $TasksArray = Array_Keys($Settings['DailyTasks']);
    if ($NowDayOfWeek == 1) {
        $TasksArray = Array_Merge($TasksArray, Array_Keys($Settings['WeeklyTasks']));
    }
    if ($NowDayOfMonth == 1) {
        $TasksArray = Array_Merge($TasksArray, Array_Keys($Settings['MonthlyTasks']));
    }
    $Task['Result'] = NULL;
    $TaskResult = NULL;
}
#-------------------------------------------------------------------------------
Debug(SPrintF("[Tasks/GC]: Массив задач: %s", Implode(', ', $TasksArray)));
#-------------------------------------------------------------------------------
if ($NowTask) {
    $TaskCount = 0;
    # Формируем массив параметров для передачи в задачу
    #  $TaskParams = Array();
    #  foreach(Array_Keys($Settings) as $Key){
    #    if(!Is_Array($Settings[$Key]))
    #      $TaskParams[$Key] = $Settings[$Key];
    #-----------------------------------------------------------------------------
Exemplo n.º 9
0
 public function Generate_Gallery_Attributes($attributes)
 {
     global $post;
     $attributes = Is_Array($attributes) ? $attributes : array();
     $gallery_meta = array();
     # Get the Gallery Meta settings
     if (isset($attributes['id']) && !empty($attributes['id'])) {
         $gallery_meta = $this->gallery_post_type->Get_Meta(Null, False, $attributes['id']);
     } else {
         $attributes['id'] = $post->ID;
         if ($post->post_type == $this->gallery_post_type->name) {
             $gallery_meta = $this->gallery_post_type->Get_Meta(Null, False, $attributes['id']);
         } else {
             $gallery_meta = $this->gallery_post_type->Default_Meta();
         }
     }
     # Merge Attributes
     $attributes = Array_Merge(array('id' => False, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => isset($attributes['ids']) ? 'post__in' : 'menu_order', 'columns' => 4, 'number' => -1, 'ids' => False, 'include' => False, 'exclude' => False, 'size' => 'thumbnail', 'link' => 'file', 'link_class' => False, 'thumb_width' => False, 'thumb_height' => False, 'thumb_grayscale' => False, 'thumb_negate' => False, 'template' => False), $gallery_meta, $attributes);
     # Rename some keys
     $attributes = Array_Merge($attributes, array('post_parent' => $attributes['id'], 'posts_per_page' => $attributes['number'], 'include' => $attributes['include'] . $attributes['ids']));
     if (!empty($attributes['include'])) {
         $attributes['post_parent'] = Null;
     }
     foreach (array('id', 'number', 'ids') as $field) {
         unset($attributes[$field]);
     }
     return $attributes;
 }
Exemplo n.º 10
0
 function ToArray()
 {
     /****************************************************************************/
     $__args_types = array('string,array');
     #-----------------------------------------------------------------------------
     $__args__ = Func_Get_Args();
     eval(FUNCTION_INIT);
     /****************************************************************************/
     $Names = Array_Merge($__args__, array('ListElement'));
     #-----------------------------------------------------------------------------
     $AttribsIDs = array();
     #-----------------------------------------------------------------------------
     foreach ($__args__ as $__arg__) {
         #---------------------------------------------------------------------------
         if (Is_Array($__arg__)) {
             $AttribsIDs = Array_Merge($AttribsIDs, $__arg__);
         }
     }
     #-----------------------------------------------------------------------------
     $Childs = $this->Childs;
     #-----------------------------------------------------------------------------
     if (Count($Childs) > 0) {
         #---------------------------------------------------------------------------
         $j = 1;
         #---------------------------------------------------------------------------
         $Result = array();
         #---------------------------------------------------------------------------
         foreach ($Childs as $Child) {
             #-------------------------------------------------------------------------
             $Name = $Child->Name;
             #-------------------------------------------------------------------------
             if (In_Array($Name, $Names)) {
                 $Name = SPrintF('%s%06u', $Name, $j++);
             }
             #-------------------------------------------------------------------------
             $Name = $Name != 'UniqID' ? $Name : UniqID('UniqID');
             #-------------------------------------------------------------------------
             $Result[$Name] = Call_User_Func_Array(array($Child, 'ToArray'), $__args__);
             #-------------------------------------------------------------------------
             foreach (Array_Keys($Child->Attribs) as $AttribID) {
                 #-----------------------------------------------------------------------
                 if (In_Array($AttribID, $AttribsIDs)) {
                     #---------------------------------------------------------------------
                     if (!Is_Array($Result[$Name])) {
                         $Result[$Name] = array();
                     }
                     #---------------------------------------------------------------------
                     $Result[$Name][$AttribID] = $Child->Attribs[$AttribID];
                 }
             }
         }
     } else {
         #---------------------------------------------------------------------------
         $Result = $this->Text != '' ? $this->Text : NULL;
         #---------------------------------------------------------------------------
         $Type = 'string';
         #---------------------------------------------------------------------------
         if (isset($this->Attribs['type'])) {
             $Type = $this->Attribs['type'];
         }
         #---------------------------------------------------------------------------
         @SetType($Result, $Type);
     }
     #-----------------------------------------------------------------------------
     return $Result;
 }
Exemplo n.º 11
0
$arDefaultUrlTemplatesN404 = array();
$arDefaultVariableAliases404 = array();
$arDefaultVariableAliases = array();
$componentPage = "";
$arComponentVariables = array("meeting_id", "item_id", "page", "action");
if ($arParams["SEF_MODE"] == "Y") {
    $arVariables = array();
    $arUrlTemplates = CComponentEngine::MakeComponentUrlTemplates($arDefaultUrlTemplates404, $arParams["SEF_URL_TEMPLATES"]);
    $arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams["VARIABLE_ALIASES"]);
    $componentPage = CComponentEngine::ParseComponentPath($arParams["SEF_FOLDER"], $arUrlTemplates, $arVariables);
    if (empty($componentPage)) {
        $componentPage = "index";
    }
    CComponentEngine::InitComponentVariables($componentPage, $arComponentVariables, $arVariableAliases, $arVariables);
    foreach ($arUrlTemplates as $url => $value) {
        $arResult["PATH_TO_" . strToUpper($url)] = $arParams["SEF_FOLDER"] . $value;
    }
    $arResult["PATH_TO_MEETING_LIST"] = $arParams["SEF_FOLDER"] . $arUrlTemplates["index"];
} else {
    $arVariables = array();
    $arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases, $arParams["VARIABLE_ALIASES"]);
    CComponentEngine::InitComponentVariables(false, $arComponentVariables, $arVariableAliases, $arVariables);
    if (array_key_exists($arVariables["page"], $arDefaultUrlTemplates404)) {
        $componentPage = $arVariables["page"];
    }
    if (empty($componentPage)) {
        $componentPage = "index";
    }
}
$arResult = Array_Merge(array("SEF_MODE" => $arParams["SEF_MODE"], "SEF_FOLDER" => $arParams["SEF_FOLDER"], "VARIABLES" => $arVariables, "ALIASES" => $arParams["SEF_MODE"] == "Y" ? array() : $arVariableAliases, "SET_TITLE" => $arParams["SET_TITLE"], "SET_NAVCHAIN" => $arParams["SET_NAVCHAIN"], "IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"], "IBLOCK_ID" => $arParams["IBLOCK_ID"], "USERGROUPS_MODIFY" => $arParams["USERGROUPS_MODIFY"], "USERGROUPS_RESERVE" => $arParams["USERGROUPS_RESERVE"], "USERGROUPS_CLEAR" => $arParams["USERGROUPS_CLEAR"], "WEEK_HOLIDAYS" => $arParams["WEEK_HOLIDAYS"]), $arResult);
$this->IncludeComponentTemplate($componentPage);
Exemplo n.º 12
0
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (Is_Error(System_Load(SPrintF('classes/%sServer.class.php', $Service['Code'])))) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Columns = array('ID', 'UserID', 'StatusID', 'ServerID', 'StatusID');
#-------------------------------------------------------------------------------
if ($Service['Code'] == 'ISPsw') {
    #-------------------------------------------------------------------------------
    $Columns = Array_Merge($Columns, array('IP'));
    #-------------------------------------------------------------------------------
} else {
    #-------------------------------------------------------------------------------
    $Columns = Array_Merge($Columns, array('Login', 'Password'));
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
$Order = DB_Select(SPrintF('%sOrdersOwners', $Service['Code']), $Columns, array('UNIQ', 'ID' => $ServiceOrderID));
#-------------------------------------------------------------------------------
switch (ValueOf($Order)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        return ERROR | @Trigger_Error(400);
    case 'array':
        break;
    default:
        return ERROR | @Trigger_Error(101);
}
Exemplo n.º 13
0
 function YAMLWalk($source)
 {
     global $parm;
     $destination = array();
     if (!is_array($source)) {
         $this->YAMLWalkError('freetext', $source);
         return $source;
     }
     foreach ($source as $key => $item) {
         // Error 1, usually caused by misplaced or missing semicolon
         if (is_numeric($key)) {
             $this->YAMLWalkError('numindex', $item);
         } else {
             //$split=explode(' ',$key);
             $split = preg_split('/\\s+/', $key);
             if (count($split) == 1) {
                 // If no split, this must be a property/value assignment
                 if (is_array($item)) {
                     $this->YAMLWalkError('arrayvalue', $item);
                 } else {
                     $destination[$key] = $item;
                 }
             } else {
                 // This an entity, like 'column first_name:', where we have
                 // split the key and renested it.  This is where we do real work
                 //
                 $type = $split[0];
                 $name = $split[1];
                 // KFD 9/26/07, allow $LOGIN group
                 if ($name == '$LOGIN') {
                     $name = $parm['APP'];
                 }
                 if ($type == "content") {
                     # KFD 6/30/08
                     $colnames = array_merge(array('__type' => 'columns'), $item['columns']);
                     unset($item['columns']);
                     $values = array();
                     foreach ($item as $key => $stuff) {
                         # KFD 1/28/09.  After we put line numbers
                         #               into things, we get non-array
                         #               entries.  Just skip 'em
                         if (is_array($stuff)) {
                             foreach ($stuff as $idx => $array) {
                                 if (is_array($array)) {
                                     $values[] = array_merge(array('__type' => $key), $array);
                                 }
                             }
                         }
                     }
                     #if(is_array($stuff)) {
                     # KFD 6/21/08, removed hardcode __type of 'value'
                     #   $values[]=array_merge(array('__type'=>'values'),$stuff);
                     #}
                     #else {
                     #   $cols=explode(' ',$key);
                     #   if(count($cols)<2) {
                     #      $this->YAMLWalkError('contentkey',$item);
                     #   }
                     #   else {
                     #      $colnames[] = $cols[1];
                     #   }
                     #}
                     #}
                     //$this->YAMLContent[$name][]=$colnames;
                     $this->YAMLContent[$name] = Array_Merge(array($colnames), $values);
                 } else {
                     $uicolseq = str_pad(++$this->uicolseq, 5, '0', STR_PAD_LEFT);
                     if (!$item) {
                         // This is a blank item, you get this if the spec file
                         // has entries like:
                         // column description:
                         // column add1:
                         // column add2:
                         $destination[$type][$name] = array('uicolseq' => $uicolseq);
                     } else {
                         // A non-blank item, an item with properties, you
                         // get this with:
                         // column vendor:
                         //   primary_key: Y
                         //   uisearch: Y
                         $this->YAMLStack[] = $type;
                         $this->YAMLStack[] = $name;
                         $destination[$type][$name] = $this->YAMLWalk($item);
                         $destination[$type][$name]['uicolseq'] = $uicolseq;
                         array_pop($this->YAMLStack);
                         array_pop($this->YAMLStack);
                     }
                     $keystub = $name;
                     if (isset($item['prefix'])) {
                         $prefix = substr($keystub, 0, strlen($item['prefix']));
                         if ($item['prefix'] != $prefix) {
                             $this->YAMLWalkError('prefix', $item);
                         } else {
                             $keystub = substr($keystub, strlen($item['prefix']));
                         }
                     }
                     if (isset($item['suffix'])) {
                         $suffix = substr($keystub, -strlen($item['suffix']));
                         if ($item['suffix'] != $suffix) {
                             $this->YAMLWalkError('suffix', $item);
                         } else {
                             $keystub = substr($keystub, 0, strlen($keystub) - strlen($item['suffix']));
                         }
                     }
                     if (isset($item['keystub'])) {
                         $keystub = $item['keystub'];
                     }
                     $destination[$type][$name]['__keystub'] = $keystub;
                     if ($type == "foreign_key") {
                         $destination[$type][$name]['table_id_par'] = $keystub;
                     }
                 }
             }
         }
     }
     return $destination;
 }
 function Generate_Gallery_Attributes($attributes)
 {
     global $post;
     // Get the Gallery Meta settings
     if (isset($attributes['id']) && !empty($attributes['id'])) {
         $gallery_meta = $this->Get_Gallery_Meta(Null, False, $attributes['id']);
     } else {
         if ($post->post_type == $this->gallery_post_type) {
             $attributes['id'] = $post->ID;
             $gallery_meta = $this->Get_Gallery_Meta(Null, False, $attributes['id']);
         } else {
             $gallery_meta = $this->Default_Meta();
         }
     }
     // Merge Attributes
     $attributes = Array_Merge(array('id' => False, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => !isset($attributes['ids']) ? 'menu_order' : 'post__in', 'number' => -1, 'ids' => '', 'include' => '', 'exclude' => '', 'size' => 'thumbnail', 'link' => 'file', 'link_class' => '', 'thumb_width' => '', 'thumb_height' => '', 'thumb_grayscale' => False, 'thumb_negate' => False), $gallery_meta, $attributes);
     // Rename some keys
     $attributes = Array_Merge($attributes, array('post_parent' => $attributes['id'], 'posts_per_page' => $attributes['number'], 'include' => $attributes['include'] . $attributes['ids']));
     foreach (array('id', 'number', 'ids') as $field) {
         unset($attributes[$field]);
     }
     #PrintF('<pre>%s</pre>', Print_R ($attributes, True));
     return $attributes;
 }
Exemplo n.º 15
0
         #-----------------------------------------------------------------
         $Table[] = $Compile['Attribs'][$AttribID];
     }
     #-------------------------------------------------------------------
     $Table[] = 'Подтверждение введенных данных';
     #-------------------------------------------------------------------
     $FileLength = GetUploadedFileSize('Profiles', $ProfileID);
     #-------------------------------------------------------------------
     $Table[] = array('Копия документа подтверждающего достоверность данных', $FileLength ? new Tag('TD', array('class' => 'Standard'), new Tag('SPAN', SPrintF('%01.2f Кб.', $FileLength / 1024)), new Tag('A', array('href' => SPrintF('/FileDownload?TypeID=Profiles&FileID=%s', $Profile['ID'])), '[скачать]')) : 'не загружены');
     #-------------------------------------------------------------------
     $Comp = Comp_Load('Statuses/State', 'Profiles', $Profile);
     if (Is_Error($Comp)) {
         return ERROR | @Trigger_Error(500);
     }
     #-------------------------------------------------------------------
     $Table = Array_Merge($Table, $Comp);
     #-------------------------------------------------------------------
     $Comp = Comp_Load('Tables/Standard', $Table, array('style' => 'width:500px;'));
     if (Is_Error($Comp)) {
         return ERROR | @Trigger_Error(500);
     }
     #-------------------------------------------------------------------
     $DOM->AddChild('Into', $Comp);
     #-------------------------------------------------------------------
     if (Is_Error($DOM->Build(FALSE))) {
         return ERROR | @Trigger_Error(500);
     }
     #-------------------------------------------------------------------
     return array('Status' => 'Ok', 'DOM' => $DOM->Object);
 default:
     return ERROR | @Trigger_Error(101);
Exemplo n.º 16
0
 public function Get($key = Null, $default = False)
 {
     # Read Options
     $arr_option = Array_Merge((array) $this->Default_Options(), (array) Get_Option('wp_plugin_fancy_gallery_pro'), (array) Get_Option('wp_plugin_fancy_gallery'), (array) Get_Option(__CLASS__));
     # Locate the option
     if ($key == Null) {
         return $arr_option;
     } elseif (isset($arr_option[$key])) {
         return $arr_option[$key];
     } else {
         return $default;
     }
 }
Exemplo n.º 17
0
 function update($new_instance, $old_instance)
 {
     $instance = Array_Merge($old_instance, $new_instance);
     return $instance;
 }
Exemplo n.º 18
0
 static function filterUpdatedMessages($arr_message)
 {
     return Array_Merge($arr_message, array(self::$post_type_name => array(1 => SPrintF(I18n::t('Term updated. (<a href="%s">View Term</a>)'), Get_Permalink()), 2 => __('Custom field updated.'), 3 => __('Custom field deleted.'), 4 => I18n::t('Term updated.'), 5 => isset($_GET['revision']) ? SPrintF(I18n::t('Term restored to revision from %s'), WP_Post_Revision_Title((int) $_GET['revision'], False)) : False, 6 => SPrintF(I18n::t('Term published. (<a href="%s">View Term</a>)'), Get_Permalink()), 7 => I18n::t('Term saved.'), 8 => I18n::t('Term submitted.'), 9 => SPrintF(I18n::t('Term scheduled. (<a target="_blank" href="%s">View Term</a>)'), Get_Permalink()), 10 => SPrintF(I18n::t('Draft updated. (<a target="_blank" href="%s">Preview Term</a>)'), Add_Query_Arg('preview', 'true', Get_Permalink())))));
 }
Exemplo n.º 19
0
                            case 'array':
                                # No more...
                                break;
                            default:
                                return ERROR | @Trigger_Error(101);
                        }
                    }
                }
            }
            break;
        default:
            return ERROR | @Trigger_Error(100);
    }
} else {
    #-----------------------------------------------------------------------------
    $UProfile = Array_Merge($UProfile, array('TemplateID' => $TemplateID, 'UserID' => $__USER['ID']));
    #-----------------------------------------------------------------------------
    $ProfileID = DB_Insert('Profiles', $UProfile);
    if (Is_Error($ProfileID)) {
        return ERROR | @Trigger_Error(500);
    }
    #-----------------------------------------------------------------------------
    if ($__USER['ID'] == 100) {
        #---------------------------------------------------------------------------
        $Count = DB_Count('Profiles', array('ID' => 100));
        if (Is_Error($Count)) {
            return ERROR | @Trigger_Error(500);
        }
        #---------------------------------------------------------------------------
        if (!$Count) {
            #-------------------------------------------------------------------------
 function gallery_shortcode($attr)
 {
     global $post;
     $attr = Array_Merge(array('id' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order', 'size' => 'thumbnail', 'link' => 'file', 'include' => '', 'exclude' => ''), (array) $attr);
     // get attachments
     if (empty($attr['include'])) {
         // this gallery uses the post attachments
         $attachments = get_children(array('post_parent' => $attr['id'], 'exclude' => $attr['exclude'], 'post_status' => $attr['post_status'], 'post_type' => $attr['post_type'], 'post_mime_type' => $attr['post_mime_type'], 'order' => $attr['order'], 'orderby' => $attr['orderby']));
     } else {
         // this gallery only includes images
         $attachments = get_posts(array('include' => $attr['include'], 'post_status' => $attr['post_status'], 'post_type' => $attr['post_type'], 'post_mime_type' => $attr['post_mime_type'], 'order' => $attr['order'], 'orderby' => $attr['orderby']));
     }
     // There are no attachments
     if (empty($attachments)) {
         return False;
     }
     $code = '<div class="fancy gallery" id="gallery_' . $post->ID . '">';
     foreach ($attachments as $id => $attachment) {
         $code .= wp_get_attachment_link($attachment->ID, $attr['size']);
     }
     $code .= '</div>';
     return $code;
 }
Exemplo n.º 21
0
 $Csv = array();
 #-------------------------------------------------------------------------------
 foreach ($Table as $Row) {
     #-------------------------------------------------------------------------------
     $Array = array();
     #-------------------------------------------------------------------------------
     foreach ($Row as $Column) {
         #-------------------------------------------------------------------------------
         if (Is_Object($Column)) {
             #-------------------------------------------------------------------------------
             $Array[] = SPrintF('"%s"', $Column->Text);
             #-------------------------------------------------------------------------------
             $Attribs = $Column->Attribs;
             #-------------------------------------------------------------------------------
             if (isset($Attribs['colspan'])) {
                 $Array = Array_Merge($Array, Array_Fill(0, $Attribs['colspan'] - 1, NULL));
             }
             #-------------------------------------------------------------------------------
         } else {
             #-------------------------------------------------------------------------------
             $Array[] = SPrintF('"%s"', $Column);
             #-------------------------------------------------------------------------------
         }
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
     $CSV[] = Implode(';', $Array);
 }
 #-------------------------------------------------------------------------------
 $CSV = Implode("\r\n", $CSV);
 #-------------------------------------------------------------------------------
Exemplo n.º 22
0
}
#-------------------------------------------------------------------------------
$Source['Conditions']['Count'] = $Count;
#-------------------------------------------------------------------------------
$Where = $ConditionWhere;
#-------------------------------------------------------------------------------
$AddingWhere = $Source['Adding']['Where'];
#-------------------------------------------------------------------------------
$Count = DB_Count($TableID, array('Where' => $AddingWhere));
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Source['Adding']['Count'] = $Count;
#-------------------------------------------------------------------------------
$Where = Array_Merge($Where, $AddingWhere);
#-------------------------------------------------------------------------------
$Where = Implode(' AND ', $Where);
#-------------------------------------------------------------------------------
$Count = DB_Count($TableID, array('Where' => $Where, 'GroupBy' => $Query['GroupBy']));
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Source['Count'] = $Count;
//print_r($Count);
//die();
#-------------------------------------------------------------------------------
$Request = array('Where' => $Where, 'SortOn' => $Query['SortOn'], 'IsDesc' => $Query['IsDesc'], 'GroupBy' => $Query['GroupBy']);
#-------------------------------------------------------------------------------
$InPage = $Template['Query']['InPage'];
Exemplo n.º 23
0
function Config_Read($Array, $Path = array(), $Level = 1)
{
    #-------------------------------------------------------------------------------
    # ASort added by lissyara for test purpose, 2014-01-16 in 15:22 MSK
    ASort($Array);
    #-------------------------------------------------------------------------------
    $TmpArray = array();
    #-------------------------------------------------------------------------------
    $Names = array('Name', 'IsActive', 'IsEvent', 'Valute', 'Course', 'Measure', 'IsCourseUpdate', 'MinimumPayment', 'MaximumPayment');
    #-------------------------------------------------------------------------------
    foreach ($Names as $Name) {
        #-------------------------------------------------------------------------------
        if (isset($Array[$Name])) {
            #-------------------------------------------------------------------------------
            $TmpArray[$Name] = $Array[$Name];
            #-------------------------------------------------------------------------------
            unset($Array[$Name]);
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    $Array = $TmpArray + $Array;
    #-------------------------------------------------------------------------------
    #-----------------------------------------------------------------------------
    static $Index = 1;
    #-----------------------------------------------------------------------------
    $Links =& Links();
    #-----------------------------------------------------------------------------
    $ConfigNames =& $Links['ConfigNames'];
    #-----------------------------------------------------------------------------
    $Node = new Tag('DIV', array('class' => 'Node'));
    #-----------------------------------------------------------------------------
    foreach (Array_Keys($Array) as $ElementID) {
        #---------------------------------------------------------------------------
        $Element = $Array[$ElementID];
        #---------------------------------------------------------------------------
        $ID = SPrintF('ID%06u', $Index++);
        #---------------------------------------------------------------------------
        $StringPath = Implode('/', $CurrentPath = Array_Merge($Path, array($ElementID)));
        #---------------------------------------------------------------------------
        if (isset($ConfigNames[$ElementID])) {
            #-------------------------------------------------------------------------
            $Item = Explode('|', $ConfigNames[$ElementID]);
            #-------------------------------------------------------------------------
            if (isset($ConfigNames[SPrintF('Prompt.%s', $ElementID)])) {
                $ElementPrompt = $ConfigNames[SPrintF('Prompt.%s', $ElementID)];
            }
            #-------------------------------------------------------------------------
        } else {
            #-------------------------------------------------------------------------
            if (!isset($ConfigNames[$StringPath])) {
                continue;
            }
            #-------------------------------------------------------------------------
            $Item = Explode('|', $ConfigNames[$StringPath]);
            #-------------------------------------------------------------------------
            if (isset($ConfigNames[SPrintF('Prompt.%s', $StringPath)])) {
                $ElementPrompt = $ConfigNames[SPrintF('Prompt.%s', $StringPath)];
            }
            #-------------------------------------------------------------------------
        }
        #---------------------------------------------------------------------------
        $ElementName = Current($Item);
        #---------------------------------------------------------------------------
        if (Count($Item) > 1) {
            #-------------------------------------------------------------------------
            $Type = Next($Item);
            #-------------------------------------------------------------------------
            switch ($Type) {
                case 'select':
                    #---------------------------------------------------------------------
                    $Select = array();
                    #---------------------------------------------------------------------
                    $Options = Explode(',', Next($Item));
                    #---------------------------------------------------------------------
                    foreach ($Options as $Option) {
                        #-------------------------------------------------------------------
                        $Option = Explode('=', $Option);
                        #-------------------------------------------------------------------
                        $Select[Next($Option)] = Prev($Option);
                    }
                    #---------------------------------------------------------------------
                    $Comp = Comp_Load('Form/Select', array('onchange' => SPrintF("ConfigChange('%s',this.value);", $StringPath)), $Select, $Element);
                    if (Is_Error($Comp)) {
                        return ERROR | @Trigger_Error(500);
                    }
                    break;
                default:
                    return ERROR | @Trigger_Error(101);
            }
        } else {
            $Comp = new Tag('SPAN', array('class' => 'NodeParam', 'onclick' => SPrintF("Value = prompt('Значение1:',this.innerHTML.XMLUnEscape());if(Value != null){ ConfigChange('%s',Value); this.innerHTML = Value; }", $StringPath)), Is_Array($Element) ? '[EMPTY]' : ($Element == '' ? '[EMPTY]' : $Element));
        }
        #---------------------------------------------------------------------------
        if (Is_Array($Element) && Count($Element)) {
            #-------------------------------------------------------------------------
            $Result = Config_Read($Element, $CurrentPath, $Level + 1);
            #-------------------------------------------------------------------------
            if ($Result) {
                #-----------------------------------------------------------------------
                $NodeName = new Tag('P', array('class' => 'NodeName'), new Tag('IMG', array('align' => 'left', 'src' => 'SRC:{Images/Icons/Node.gif}')));
                #-----------------------------------------------------------------------
                $NodeName->AddChild(new Tag('A', array('href' => SPrintF("javascript:ConfigSwitch('%s');", $ID)), $ElementName));
                #-----------------------------------------------------------------------
                $Node->AddChild($NodeName);
                #-----------------------------------------------------------------------
                $Node->AddChild(new Tag('DIV', array('id' => $ID, 'style' => 'display:none;'), $Result));
            }
        } else {
            #-----------------------------------------------------------------------
            $Params = isset($ElementPrompt) ? array('onMouseOver' => SPrintF('PromptShow(event,\'%s\',this);', $ElementPrompt)) : array();
            #-----------------------------------------------------------------------
            $Node->AddChild(new Tag('P', array('class' => 'NodeParam'), new Tag('SPAN', $Params, SPrintF('%s: ', $ElementName)), $Comp));
            #-----------------------------------------------------------------------
            unset($ElementPrompt);
            #-----------------------------------------------------------------------
        }
        #-----------------------------------------------------------------------
    }
    #-----------------------------------------------------------------------------
    return Count($Node->Childs) ? $Node : FALSE;
}
Exemplo n.º 24
0
function IO_Scan($Path, $IsHidden = TRUE)
{
    /****************************************************************************/
    $__args_types = array('string', 'boolean');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $Result = array();
    #-----------------------------------------------------------------------------
    $Folder = @OpenDir($Path);
    if (!$Folder) {
        return ERROR | @Trigger_Error(SPrintF('[IO_Scan]: не возможно открыть директорию (%s)', $Path));
    }
    #-----------------------------------------------------------------------------
    $Ignored = array('.', '..');
    #-----------------------------------------------------------------------------
    if ($IsHidden) {
        $Ignored = Array_Merge($Ignored, array('.svn'));
    }
    #-----------------------------------------------------------------------------
    # ReadDir changed to ScanDir by lissyara, for JBS-335
    $Files = ScanDir($Path);
    #while($File = ReadDir($Folder)){
    foreach ($Files as $File) {
        #---------------------------------------------------------------------------
        if (In_Array($File, $Ignored)) {
            continue;
        }
        #---------------------------------------------------------------------------
        $Result[] = $File;
    }
    #-----------------------------------------------------------------------------
    CloseDir($Folder);
    #-----------------------------------------------------------------------------
    return $Result;
}
Exemplo n.º 25
0
 /**
  * Api调用
  * @param String $method
  * @param String $fields
  * @param Array $params
  */
 protected function apiCall($method, $fields, $params)
 {
     $cacheid = md5($method . $fields . implode(" ", $params));
     //缓存id
     $this->Cache->setMethod($method);
     //设置method
     //如果不存在文件 则调用远程数据
     if (!($this->_ArrayData = $this->Cache->getCacheData($cacheid))) {
         $default = array('method' => $method, 'timestamp' => Date('Y-m-d H:i:s'), 'format' => 'xml', 'app_key' => $this->_setting['appKey'], 'v' => '1.0', 'sign_method' => 'md5', 'fields' => $fields);
         $this->_params = Array_Merge($default, $params);
         $this->_retData = $this->send($this->_params);
         //编码转换
         $this->_retData = Api59miao_Toos::Format59miaoData($this->_retData);
         $this->_ArrayData = Api59miao_Toos::getXmlData($this->_retData);
         $this->_ArrayData = Api59miao_Toos::get_object_vars_final_coding($this->_ArrayData);
         $this->_ArrayData = Api59miao_Toos::Serialize($this->_ArrayData);
         //序列化
         $this->Cache->saveCacheData($cacheid, $this->_ArrayData);
     }
     return Api59miao_Toos::UnSerialize($this->_ArrayData);
 }
Exemplo n.º 26
-1
 static function Get($key = Null, $default = False)
 {
     # Read Options
     $arr_option = Array_Merge((array) self::getDefaultOptions(), (array) Get_Option(self::$options_key));
     # Locate the option
     if ($key == Null) {
         return $arr_option;
     } elseif (isset($arr_option[$key])) {
         return $arr_option[$key];
     } else {
         return $default;
     }
 }
Exemplo n.º 27
-1
 function Register_Taxonomies()
 {
     # Load Taxonomies
     $this->arr_taxonomies = $this->Get_Taxonomies();
     # Register Taxonomies
     foreach ((array) $this->core->options->Get('gallery_taxonomies') as $taxonomie => $attributes) {
         if (!isset($this->arr_taxonomies[$taxonomie])) {
             continue;
         }
         Register_Taxonomy($taxonomie, $this->name, Array_Merge($this->arr_taxonomies[$taxonomie], $attributes));
     }
 }
Exemplo n.º 28
-1
function BillManager_Get_List_Licenses($Settings)
{
    /****************************************************************************/
    $__args_types = array('array');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $authinfo = SPrintF('%s:%s', $Settings['Login'], $Settings['Password']);
    #-----------------------------------------------------------------------------
    $HTTP = BillManager_Build_HTTP($Settings);
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    $Request = array('authinfo' => $authinfo, 'out' => 'xml', 'func' => 'soft');
    #-------------------------------------------------------------------------------
    $Response = HTTP_Send($Settings['Params']['PrefixAPI'], $HTTP, array(), $Request);
    if (Is_Error($Response)) {
        return ERROR | @Trigger_Error('[BillManager_Get_List_Licenses]: не удалось соедениться с сервером');
    }
    #-------------------------------------------------------------------------------
    $Response = Trim($Response['Body']);
    #-------------------------------------------------------------------------------
    $XML = String_XML_Parse($Response);
    if (Is_Exception($XML)) {
        return new gException('WRONG_SERVER_ANSWER', $Response, $XML);
    }
    #-------------------------------------------------------------------------------
    $XML = $XML->ToArray('elem');
    #-------------------------------------------------------------------------------
    $Doc = $XML['doc'];
    if (isset($Doc['error'])) {
        return new gException('BillManager_Get_List_Licenses', 'Не удалось получить список лицензий');
    }
    #-------------------------------------------------------------------------------
    # в полученном массиве недостаточно данных. перебираем лицензии по одной, достаём полную информацию.
    $Out = array();
    #-------------------------------------------------------------------------------
    foreach ($Doc as $License) {
        #-------------------------------------------------------------------------------
        #Debug(SPrintF("[system/libs/BillManager.php]: License = %s",print_r($License, true)));
        #-------------------------------------------------------------------------------
        if (!isset($License['expiredate'])) {
            continue;
        }
        #-------------------------------------------------------------------------------
        $Request = array('authinfo' => $authinfo, 'out' => 'xml', 'func' => 'soft.edit', 'elid' => $License['id']);
        #-------------------------------------------------------------------------------
        $Response = HTTP_Send($Settings['Params']['PrefixAPI'], $HTTP, array(), $Request);
        if (Is_Error($Response)) {
            return ERROR | @Trigger_Error('[BillManager_Get_List_Licenses]: не удалось соедениться с сервером');
        }
        #-------------------------------------------------------------------------------
        $Response = Trim($Response['Body']);
        #-------------------------------------------------------------------------------
        $XML = String_XML_Parse($Response);
        if (Is_Exception($XML)) {
            return new gException('WRONG_SERVER_ANSWER', $Response, $XML);
        }
        #-------------------------------------------------------------------------------
        $XML = $XML->ToArray('elem');
        #-------------------------------------------------------------------------------
        $Doc = $XML['doc'];
        if (isset($Doc['error'])) {
            return new gException('BillManager_Get_List_Licenses', 'Не удалось получить список лицензий');
        }
        #-------------------------------------------------------------------------------
        #Debug(SPrintF("[system/libs/BillManager.php]: Doc = %s",print_r($Doc, true)));
        $Out[] = Array_Merge($License, $Doc);
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    return $Out;
    #-------------------------------------------------------------------------------
}
Exemplo n.º 29
-1
 function Register_Taxonomies()
 {
     # Load Taxonomies
     $this->arr_taxonomies = $this->Get_Taxonomies();
     # Register Taxonomies
     $arr_taxonomies = $this->core->options->Get('gallery_taxonomies');
     if (!Is_Array($arr_taxonomies)) {
         return False;
     }
     foreach ($arr_taxonomies as $taxonomie => $attributes) {
         if (!isset($this->arr_taxonomies[$taxonomie])) {
             continue;
         }
         $this->arr_taxonomies[$taxonomie] = Is_Array($this->arr_taxonomies[$taxonomie]) ? $this->arr_taxonomies[$taxonomie] : array();
         Register_Taxonomy($taxonomie, $this->name, Array_Merge($this->arr_taxonomies[$taxonomie], $attributes));
     }
 }
Exemplo n.º 30
-1
    #-------------------------------------------------------------------------------
    #Debug(SPrintF('[comp/www/Administrator/API/Dispatch]: Result = %s',print_r($Result,true)));
    #-------------------------------------------------------------------------------
    foreach ($Dispatches[$DispatchID] as $FilterID) {
        if (isset($Result[$FilterID])) {
            $UsersIDs = Array_Merge($UsersIDs, $Result[$FilterID]['UsersIDs']);
        }
    }
    #-------------------------------------------------------------------------------
    #Debug(SPrintF('[comp/www/Administrator/API/Dispatch]: into filters, UserIDs = %s',Implode(',',$UsersIDs)));
    #-------------------------------------------------------------------------------
    if (isset($Result['UsersIDs'])) {
        #-------------------------------------------------------------------------------
        #Debug(SPrintF('[comp/www/Administrator/API/Dispatch]: into filters, $Result[UsersIDs] = %s',Implode(',',$Result['UsersIDs'])));
        #-------------------------------------------------------------------------------
        $UsersIDs = Array_Merge($UsersIDs, $Result['UsersIDs']);
        #-------------------------------------------------------------------------------
        $Counter++;
        #-------------------------------------------------------------------------------
    } else {
        #-------------------------------------------------------------------------------
        $Counter = $Counter + SizeOf($Dispatches[$DispatchID]);
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
switch ($Logic) {
    case 'AND':
        #-------------------------------------------------------------------------------