Ejemplo n.º 1
1
function Bytes_Decode($String, $Separator = '')
{
    /****************************************************************************/
    $__args_types = array('string');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $Result = '';
    #-----------------------------------------------------------------------------
    for ($i = 0; $i < StrLen($String); $i++) {
        $Result .= SPrintF('%02x', Ord($String[$i])) . $Separator;
    }
    #-----------------------------------------------------------------------------
    return $Result;
}
 static function filterPostsOrderBy($orderby, $query)
 {
     if ($query->Get('orderby') == 'post_title_length') {
         $orderby = SPrintF('post_title_length %s', $query->Get('order'));
     }
     return $orderby;
 }
Ejemplo n.º 3
0
function XML_Read($Object, $Level = 1)
{
    #-----------------------------------------------------------------------------
    static $Index = 1;
    #-----------------------------------------------------------------------------
    $Md5 = Md5($Index++);
    #-----------------------------------------------------------------------------
    $Attribs = $Object->Attribs;
    #-----------------------------------------------------------------------------
    $Name = isset($Attribs['comment']) ? $Attribs['comment'] : $Object->Name;
    #-----------------------------------------------------------------------------
    $P = new Tag('P', array('class' => 'NodeName', 'onclick' => SPrintF("TreeSwitch('%s');", $Md5)), new Tag('IMG', array('align' => 'left', 'src' => 'SRC:{Images/Icons/Node.gif}')), new Tag('SPAN', $Name));
    #-----------------------------------------------------------------------------
    $Node = new Tag('DIV', array('class' => 'Node'), $P);
    #-----------------------------------------------------------------------------
    if (Count($Attribs)) {
        #---------------------------------------------------------------------------
        foreach (Array_Keys($Attribs) as $AttribID) {
            $Node->AddChild(new Tag('P', array('class' => 'NodeParam'), new Tag('SPAN', SPrintF('%s: ', $AttribID)), new Tag('SPAN', array('class' => 'NodeParam'), $Attribs[$AttribID])));
        }
    }
    #-----------------------------------------------------------------------------
    if (Count($Childs = $Object->Childs)) {
        #---------------------------------------------------------------------------
        $Content = new Tag('DIV', array('style' => 'display:none;'), array('id' => $Md5));
        #---------------------------------------------------------------------------
        foreach ($Childs as $Child) {
            $Content->AddChild(XML_Read($Child, $Level + 1));
        }
        #---------------------------------------------------------------------------
        $Node->AddChild($Content);
    }
    #-----------------------------------------------------------------------------
    return $Node;
}
Ejemplo n.º 4
0
 public function send(Msg $msg)
 {
     // Get template file path.
     $templatePath = SPrintF('Notifies/SMS/%s.tpl', $msg->getTemplate());
     $smarty = JSmarty::get();
     if (!$smarty->templateExists($templatePath)) {
         throw new jException('Template file not found: ' . $templatePath);
     }
     $smarty->assign('Config', Config());
     foreach (array_keys($msg->getParams()) as $paramName) {
         $smarty->assign($paramName, $msg->getParam($paramName));
     }
     try {
         $message = $smarty->fetch($templatePath);
     } catch (Exception $e) {
         throw new jException(SPrintF("Can't fetch template: %s", $templatePath), $e->getCode(), $e);
     }
     $recipient = $msg->getParam('User');
     if (!$recipient['Params']['NotificationMethods']['SMS']['Address']) {
         throw new jException('Mobile phone number not found for user: '******'ID']);
     }
     $taskParams = array('UserID' => $recipient['ID'], 'TypeID' => 'SMS', 'Params' => array($recipient['Params']['NotificationMethods']['SMS']['Address'], $message, $recipient['ID'], $msg->getParam('ChargeFree') ? TRUE : FALSE));
     #Debug(SPrintF('[system/classes/SMS.class.php]: msg = %s,',print_r($msg,true)));
     $result = Comp_Load('www/Administrator/API/TaskEdit', $taskParams);
     switch (ValueOf($result)) {
         case 'error':
             throw new jException("Couldn't add task to queue: " . $result);
         case 'exception':
             throw new jException("Couldn't add task to queue: " . $result->String);
         case 'array':
             return TRUE;
         default:
             throw new jException("Unexpected error.");
     }
 }
Ejemplo n.º 5
0
 public function getParams()
 {
     $Server = DB_Select('Servers', array('Address', 'Params'), array('UNIQ', 'Where' => SPrintF('(SELECT `ServerID` FROM `OrdersOwners` WHERE `OrdersOwners`.`ID` = %u) = `Servers`.`ID`', $this->params['OrderID'])));
     if (!Is_Array($Server)) {
         return ERROR | @Trigger_Error(500);
     }
     $this->params['Server'] = $Server;
     return $this->params;
 }
Ejemplo n.º 6
0
function Comp_Load($Element)
{
    /****************************************************************************/
    $__args_types = array('string', '*');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $HostsIDs = System_HostsIDs(SPrintF('comp/%s.comp.php', $Element));
    if (Is_Error($HostsIDs)) {
        return ERROR | @Trigger_Error('[Comp_Load]: не возможно найти компонент');
    }
    #-----------------------------------------------------------------------------
    $IsCascade = In_Array(COMP_ALL_HOSTS, $__args__, TRUE);
    #-----------------------------------------------------------------------------
    if ($IsCascade) {
        $HostsIDs = Array_Reverse($HostsIDs);
    }
    #-----------------------------------------------------------------------------
    $Result = array();
    #-----------------------------------------------------------------------------
    foreach ($HostsIDs as $HostID) {
        #---------------------------------------------------------------------------
        $Path = SPrintF('%s/hosts/%s/comp/%s.comp.php', SYSTEM_PATH, $HostID, $Element);
        #---------------------------------------------------------------------------
        if (Is_Dir($Path)) {
            return ERROR | @Trigger_Error('[Comp_Load]: объект не является компонентом');
        }
        #---------------------------------------------------------------------------
        $Args = $__args__;
        #---------------------------------------------------------------------------
        Array_UnShift($Args, $Path);
        #---------------------------------------------------------------------------
        $Comp = Call_User_Func_Array('LoadComp', $Args);
        if (Is_Error($Comp)) {
            return ERROR | @Trigger_Error('[Comp_Load]: не возможно загрузить компонент');
        }
        #---------------------------------------------------------------------------
        if ($IsCascade) {
            $Result[] = $Comp;
        } else {
            #-------------------------------------------------------------------------
            $Result = $Comp;
            #-------------------------------------------------------------------------
            break;
        }
    }
    #-----------------------------------------------------------------------------
    $Loaded =& Link_Get('Comp/Loaded', 'array');
    #-----------------------------------------------------------------------------
    $Loaded[] = $Element;
    #-----------------------------------------------------------------------------
    return $Result;
}
Ejemplo n.º 7
0
 /**
  * Constructor.
  *
  * @param <type> $CodeID
  * @param <type> $String
  * @param <type> $Parent
  * @return <type>
  */
 function __construct($CodeID, $String, $Parent = NULL)
 {
     $__args_types = array('string', 'string', 'NULL,object');
     $__args__ = Func_Get_Args();
     eval(FUNCTION_INIT);
     Debug(SPrintF('[Exception]: [%s]=(%s)', $CodeID, $String));
     $this->CodeID = $CodeID;
     $this->String = $String;
     $this->Parent = $Parent;
     return $this;
 }
Ejemplo n.º 8
0
 static function load($template_name, $vars = array())
 {
     Extract($vars);
     $template_path = Locate_Template($template_name);
     Ob_Start();
     if (!empty($template_path)) {
         include $template_path;
     } else {
         include SPrintF('%s/templates/%s', Core::$plugin_folder, $template_name);
     }
     return Ob_Get_Clean();
 }
Ejemplo n.º 9
0
 public function get($key)
 {
     // Check args.
     $__args_types = array('string');
     $__args__ = Func_Get_Args();
     eval(FUNCTION_INIT);
     $result = apc_fetch($key);
     if (!$result) {
         Debug(SPrintF('[APCCache::get]: не удалось извлечь объект [key=%s]', $key));
     }
     return $result;
 }
Ejemplo n.º 10
0
 function get($key)
 {
     // Check args.
     $__args_types = array('string');
     $__args__ = Func_Get_Args();
     eval(FUNCTION_INIT);
     $key = SPrintF('[%s]-%s', HOST_ID, $key);
     $result = self::$memcached->get($key);
     if (!$result) {
         Debug(SPrintF('[MemcachedCache::get]: не удалось извлечь объект [key=%s]', $key));
     }
     return $result;
 }
Ejemplo n.º 11
0
function Color_RGB_Implode($R, $G, $B)
{
    /****************************************************************************/
    $__args_types = array('integer');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $R = SPrintF('%02X', $R);
    $G = SPrintF('%02X', $G);
    $B = SPrintF('%02X', $B);
    #-----------------------------------------------------------------------------
    return SPrintF('%s%s%s', $R, $G, $B);
}
 public function getParams()
 {
     #-------------------------------------------------------------------------------
     #$Server = DB_Select('HostingServers', Array('Address', 'Url', 'Ns1Name', 'Ns2Name', 'MySQL'), Array('UNIQ', 'ID' => $this->params['ServerID']));
     $Server = DB_Select('Servers', array('Address', 'Params'), array('UNIQ', 'Where' => SPrintF('(SELECT `ServerID` FROM `OrdersOwners` WHERE `OrdersOwners`.`ID` = %u) = `Servers`.`ID`', $this->params['OrderID'])));
     if (!Is_Array($Server)) {
         return ERROR | @Trigger_Error(500);
     }
     #-------------------------------------------------------------------------------
     $this->params['Server'] = $Server;
     #-------------------------------------------------------------------------------
     return $this->params;
     #-------------------------------------------------------------------------------
 }
 public function getParams()
 {
     #-------------------------------------------------------------------------------
     $Server = new DomainServer();
     #-------------------------------------------------------------------------------
     $IsSelected = $Server->Select((int) $this->params['ServerID']);
     #-------------------------------------------------------------------------------
     switch (ValueOf($IsSelected)) {
         #-------------------------------------------------------------------------------
         case 'error':
             return ERROR | @Trigger_Error(500);
         case 'true':
             #-------------------------------------------------------------------------------
             // For RegRu only
             if ($Server->Settings['Params']['SystemID'] == 'RegRu' && In_Array($this->params['Name'], array('ru', 'su', 'рф'))) {
                 #-------------------------------------------------------------------------------
                 $Domain = SprintF("%s.%s", $this->params['DomainName'], $this->params['Name']);
                 #-------------------------------------------------------------------------------
                 $Result = $Server->GetUploadID($Domain);
                 #-------------------------------------------------------------------------------
                 switch (ValueOf($Result)) {
                     case 'error':
                         return ERROR | @Trigger_Error(500);
                     case 'array':
                         #-------------------------------------------------------------------------------
                         $UploadID = $Result['UploadID'];
                         #-------------------------------------------------------------------------------
                         $this->params['UploadID'] = $UploadID;
                         #-------------------------------------------------------------------------------
                         Debug(SPrintF('[system/classes/DomainOrdersOnRegisterMsg.class.php]: UploadID = %s', $UploadID));
                         #-------------------------------------------------------------------------------
                         break;
                         #-------------------------------------------------------------------------------
                     #-------------------------------------------------------------------------------
                     default:
                         return ERROR | @Trigger_Error(101);
                 }
                 #-------------------------------------------------------------------------------
             }
             #-------------------------------------------------------------------------------
             break;
             #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         default:
             return ERROR | @Trigger_Error(101);
     }
     #-------------------------------------------------------------------------------
     return $this->params;
     #-------------------------------------------------------------------------------
 }
Ejemplo n.º 14
0
 public static function init()
 {
     #-------------------------------------------------------------------------------
     if (self::$instance === NULL) {
         #-------------------------------------------------------------------------------
         try {
             #-------------------------------------------------------------------------------
             Debug("[system/classes/auto/CacheManager.class.php]: Start initializing cache system.");
             #-------------------------------------------------------------------------------
             if (Extension_Loaded(MemcachedCache::EXT_NAME) && File_Exists(SPrintF('%s/.memcached', SYSTEM_PATH))) {
                 #-------------------------------------------------------------------------------
                 Debug('[system/classes/auto/CacheManager.class.php]: Force load MemcachedCache');
                 #-------------------------------------------------------------------------------
                 self::$instance = MemcachedCache::getInstance();
                 #-------------------------------------------------------------------------------
             } else {
                 if (Extension_Loaded(APCCache::EXT_NAME)) {
                     #-------------------------------------------------------------------------------
                     Debug('[system/classes/auto/CacheManager.class.php]: Load APCCache');
                     #-------------------------------------------------------------------------------
                     self::$instance = APCCache::getInstance();
                     #-------------------------------------------------------------------------------
                 } else {
                     if (Extension_Loaded(MemcachedCache::EXT_NAME)) {
                         #-------------------------------------------------------------------------------
                         Debug('[system/classes/auto/CacheManager.class.php]: Load MemcachedCache');
                         #-------------------------------------------------------------------------------
                         self::$instance = MemcachedCache::getInstance();
                         #-------------------------------------------------------------------------------
                     } else {
                         #-------------------------------------------------------------------------------
                         throw new Exception("Any supported cache not installed in your sysytem.");
                     }
                 }
             }
             #-------------------------------------------------------------------------------
             Debug("Cache system has been initialized.");
             #-------------------------------------------------------------------------------
         } catch (Exception $e) {
             #-------------------------------------------------------------------------------
             Debug("Cache system has not been installed: " . $e->getTraceAsString());
             #-------------------------------------------------------------------------------
         }
         #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
     return self::$instance;
     #-------------------------------------------------------------------------------
 }
Ejemplo n.º 15
0
 public function send(Msg $msg)
 {
     #-------------------------------------------------------------------------------
     // Get template file path.
     $templatePath = SPrintF('Notifies/ICQ/%s.tpl', $msg->getTemplate());
     #-------------------------------------------------------------------------------
     $smarty = JSmarty::get();
     #-------------------------------------------------------------------------------
     if (!$smarty->templateExists($templatePath)) {
         throw new jException('Template file not found: ' . $templatePath);
     }
     #-------------------------------------------------------------------------------
     $smarty->assign('Config', Config());
     #-------------------------------------------------------------------------------
     foreach (array_keys($msg->getParams()) as $paramName) {
         $smarty->assign($paramName, $msg->getParam($paramName));
     }
     #-------------------------------------------------------------------------------
     try {
         #-------------------------------------------------------------------------------
         $message = $smarty->fetch($templatePath);
         #-------------------------------------------------------------------------------
     } catch (Exception $e) {
         #-------------------------------------------------------------------------------
         throw new jException(SPrintF("Can't fetch template: %s", $templatePath), $e->getCode(), $e);
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
     $recipient = $msg->getParam('User');
     #-------------------------------------------------------------------------------
     if (!$recipient['Params']['NotificationMethods']['ICQ']['Address']) {
         throw new jException("ICQ UIN not found for user: "******"Couldn't add task to queue: " . $result);
         case 'exception':
             throw new jException("Couldn't add task to queue: " . $result->String);
         case 'array':
             return TRUE;
         default:
             throw new jException("Unexpected error.");
     }
     #-------------------------------------------------------------------------------
 }
Ejemplo n.º 16
0
 public function disconnect()
 {
     if ($this->mbox) {
         $this->expungeDeletedMessages();
         $errors = imap_errors();
         if ($errors) {
             foreach ($errors as $error) {
                 #trigger_error($error);
                 Debug(SPrintF('[system/classes/ImapMailbox]: %s', Trim($error)));
             }
         }
         imap_close($this->mbox);
         $this->mbox = null;
     }
 }
Ejemplo n.º 17
0
 static function getArchiveLink($filter = '', $taxonomy_term = Null)
 {
     $permalink_structure = Get_Option('permalink_structure');
     # Get base url
     if ($taxonomy_term) {
         $base_url = Get_Term_Link($taxonomy_term);
     } else {
         $base_url = Get_Post_Type_Archive_Link(self::$post_type_name);
     }
     if (!empty($permalink_structure)) {
         return User_TrailingSlashIt(SPrintF('%1$s/filter:%2$s', RTrim($base_url, '/'), RawURLEncode($filter)));
     } else {
         return Add_Query_Arg(array('filter' => RawURLEncode($filter)), $base_url);
     }
 }
Ejemplo n.º 18
0
function Cache_Delete($Pattern)
{
    #-----------------------------------------------------------------------------
    $Cache =& Link_Get('Cache', 'array');
    #-----------------------------------------------------------------------------
    foreach (Array_Keys($Cache) as $Key) {
        #---------------------------------------------------------------------------
        if (Preg_Match(SPrintF('/%s/', $Pattern), $Key)) {
            #-------------------------------------------------------------------------
            # Debug(SPrintF('[Cache_Delete]: удаление объекта из кеша (%s)',$Key));
            #-------------------------------------------------------------------------
            unset($Cache[$Key]);
        }
    }
    #-----------------------------------------------------------------------------
    return TRUE;
}
Ejemplo n.º 19
0
 static function defineRewriteRules()
 {
     # Add filter permalink structure for post type archive
     $post_type = Get_Post_Type_Object(Post_Type::$post_type_name);
     $archive_url_path = $post_type->rewrite['slug'];
     self::$rewrite_rules[LTrim(SPrintF('%s/filter:([^/]+)/?$', $archive_url_path), '/')] = SPrintF('index.php?post_type=%s&filter=$matches[1]', Post_Type::$post_type_name);
     self::$rewrite_rules[LTrim(SPrintF('%s/filter:([^/]+)/page/([0-9]{1,})/?$', $archive_url_path), '/')] = SPrintF('index.php?post_type=%s&filter=$matches[1]&paged=$matches[2]', Post_Type::$post_type_name);
     # Add filter permalink structure for taxonomy archives
     foreach (Get_Taxonomies(Null, 'objects') as $taxonomy) {
         $taxonomy_slug = $taxonomy->rewrite['slug'];
         if (!In_Array(Post_Type::$post_type_name, $taxonomy->object_type)) {
             continue;
         }
         self::$rewrite_rules[LTrim(SPrintF('%s/([^/]+)/filter:([^/]+)/?$', $taxonomy_slug), '/')] = SPrintF('index.php?%s=$matches[1]&filter=$matches[2]', $taxonomy->name);
         self::$rewrite_rules[LTrim(SPrintF('%s/([^/]+)/filter:([^/]+)/page/([0-9]{1,})/?$', $taxonomy_slug), '/')] = SPrintF('index.php?%s=$matches[1]&filter=$matches[2]&paged=$matches[3]', $taxonomy->name);
     }
 }
Ejemplo n.º 20
0
 public function GetUsers()
 {
     /******************************************************************************/
     $__args__ = Func_Get_Args();
     eval(FUNCTION_INIT);
     /******************************************************************************/
     Array_UnShift($__args__, $this->Settings);
     #-------------------------------------------------------------------------------
     $Function = SPrintF('%s_Get_Users', $this->SystemID);
     #-------------------------------------------------------------------------------
     if (!Function_Exists($Function)) {
         return new gException('FUNCTION_NOT_SUPPORTED', SPrintF('Функция (%s) не поддерживается API модулем', $Function));
     }
     #-------------------------------------------------------------------------------
     $Result = Call_User_Func_Array($Function, $__args__);
     if (Is_Error($Result)) {
         return ERROR | @Trigger_Error('[ISPswServer->GetUsers]: не удалось вызвать целевую функцию');
     }
     #-------------------------------------------------------------------------------
     return $Result;
     #-------------------------------------------------------------------------------
 }
Ejemplo n.º 21
0
function TemplateReplace($Text, $Params = array(), $NoBody = TRUE)
{
    #-------------------------------------------------------------------------------
    $Text = Trim($Text);
    #-------------------------------------------------------------------------------
    # проверяем что нам сунули - текст или файл
    if (!Preg_Match('/\\s/', $Text)) {
        #-------------------------------------------------------------------------------
        # достаём текст из файла
        $Path = System_Element(SPrintF('templates/modules/%s.html', $Text));
        #-------------------------------------------------------------------------------
        if (Is_Error($Path)) {
            #-------------------------------------------------------------------------------
            $Text = SprintF('Отсутствует шаблон сообщения (templates/modules/%s.html)', $Text);
            #-------------------------------------------------------------------------------
        } else {
            #-------------------------------------------------------------------------------
            $Text = Trim(IO_Read($Path));
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    if ($NoBody) {
        $Text = SPrintF('<NOBODY><SPAN>%s</SPAN></NOBODY>', $Text);
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    $Replace = Array_ToLine($Params, '%');
    #-------------------------------------------------------------------------------
    foreach (Array_Keys($Replace) as $Key) {
        $Text = Str_Replace($Key, $Replace[$Key], $Text);
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    return $Text;
    #-------------------------------------------------------------------------------
}
Ejemplo n.º 22
0
function CreateMap($ID, &$ParentNode)
{
    #-----------------------------------------------------------------------------
    $Group = DB_Select('Groups', '*', array('UNIQ', 'ID' => $ID));
    #-----------------------------------------------------------------------------
    switch (ValueOf($Group)) {
        case 'error':
            return ERROR | @Trigger_Error(500);
        case 'exception':
            return ERROR | @Trigger_Error(400);
        case 'array':
            #-------------------------------------------------------------------------
            $Node = new Tag('node', array('TEXT' => $Group['Name'], 'STYLE' => 'bubble', 'BACKGROUND_COLOR' => $Group['IsDepartment'] ? '#F07D00' : '#F9E47D'), new Tag('edge', array('STYLE' => 'sharp_bezier', 'COLOR' => '#D5F66C', 'WIDTH' => 5)), new Tag('font', array('BOLD' => 'true', 'NAME' => 'SansSerif', 'SIZE' => 14)), new Tag('icon', array('BUILTIN' => 'none')));
            #-------------------------------------------------------------------------
            $Childs = DB_Select('Groups', '*', array('Where' => SPrintF('`ParentID` = %u AND `ParentID` != `ID`', $Group['ID'])));
            #-------------------------------------------------------------------------
            switch (ValueOf($Childs)) {
                case 'error':
                    return ERROR | @Trigger_Error(500);
                case 'exception':
                    # No more...
                    break;
                case 'array':
                    #---------------------------------------------------------------------
                    foreach ($Childs as $Child) {
                        CreateMap($Child['ID'], $Node);
                    }
                    break;
                default:
                    return ERROR | @Trigger_Error(101);
            }
            #-------------------------------------------------------------------------
            $ParentNode->AddChild($Node);
            #-------------------------------------------------------------------------
            return TRUE;
        default:
            return ERROR | @Trigger_Error(101);
    }
}
Ejemplo n.º 23
0
function smarty_function_top_panel($params, $smarty)
{
    if (isset($GLOBALS['__USER'])) {
        $__USER = $GLOBALS['__USER'];
        if (Is_Null($__USER)) {
            return ERROR | @Trigger_Error(400);
        }
        $menuPath = SPrintF('%s/TopPanel', $__USER['InterfaceID']);
        $items = Styles_Menu($menuPath);
        if (Is_Error($items)) {
            return ERROR | @Trigger_Error(500);
        }
        $items =& $items['Items'];
        //return print_r(array_values($items));
        $smarty->assign('items', array_values($items));
        $__USER = $GLOBALS['__USER'];
        $smarty->assign('userName', $__USER['Name']);
        $smarty->display('TopPanel/User.tpl');
    } else {
        $smarty->display('TopPanel/Logon.tpl');
    }
}
Ejemplo n.º 24
0
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Service = DB_Select('Services', array('ID', 'Code', 'Name'), array('UNIQ', 'ID' => $DNSmanagerOrder['ServiceID']));
switch (ValueOf($Service)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        return ERROR | @Trigger_Error(400);
    case 'array':
        break;
    default:
        return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Scheme = DB_Select(SPrintF('%sSchemes', $Service['Code']), array('*'), array('UNIQ', 'ID' => $DNSmanagerOrder['SchemeID']));
switch (ValueOf($Scheme)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        return ERROR | @Trigger_Error(400);
    case 'array':
        break;
    default:
        return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Params = array('SchemeID' => $DNSmanagerOrder['SchemeID'], 'OrderID' => $DNSmanagerOrder['OrderID'], 'MaxOrders' => $Scheme['MaxOrders'], 'MinOrdersPeriod' => $Scheme['MinOrdersPeriod'], 'ServiceID' => $Service['ID'], 'ServiceName' => $Service['Name'], 'SchemeName' => $Scheme['Name']);
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Services/Orders/OrdersHistory', $Params);
Ejemplo n.º 25
0
    #-----------------------------------------------------------------------------
    foreach ($Files as $File) {
        #---------------------------------------------------------------------------
        $StatisticID = SubStr($File, 0, StriPos($File, '.'));
        #---------------------------------------------------------------------------
        $Comp = Comp_Load(SPrintF('Statistics/%s', $StatisticID), $IsCreate);
        if (Is_Error($Comp)) {
            return ERROR | @Trigger_Error(500);
        }
        #---------------------------------------------------------------------------
        $Input = Comp_Load('Form/Input', array('type' => 'checkbox', 'name' => 'StatisticsIDs[]', 'value' => $StatisticID, 'id' => $StatisticID));
        if (Is_Error($Input)) {
            return ERROR | @Trigger_Error(500);
        }
        #---------------------------------------------------------------------------
        $Table[] = array(new Tag('SPAN', array('style' => 'cursor:pointer;', 'onclick' => SPrintF('ChangeCheckBox(\'%s\'); return false;', $StatisticID)), $Comp['Title']), $Input);
    }
}
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Form/Input', array('type' => 'button', 'onclick' => 'form.submit();', 'value' => 'Сформировать'));
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Table[] = $Comp;
#-------------------------------------------------------------------------------
$Table[] = new Tag('IFRAME', array('height' => 120, 'width' => '100%', 'name' => 'Statistics'), 'Загрузка...');
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Tables/Standard', $Table);
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
Ejemplo n.º 26
0
    $NewUserID = $MaxUserID['ID'];
}
#-------------------------------------------------------------------------------
foreach ($OldUserIDs as $OldUserID) {
    $NewUserID++;
    # меняем ID юзера
    $IsUpdate = DB_Update('Users', array('ID' => $NewUserID), array('ID' => $OldUserID['ID']));
    if (Is_Error($IsUpdate)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
    # Events
    $IsUpdate = DB_Update('Events', array('UserID' => $NewUserID), array('Where' => SPrintF('`UserID` = %u', $OldUserID['ID'])));
    if (Is_Error($IsUpdate)) {
        return ERROR | @Trigger_Error(500);
    }
    # RequestLog
    $IsUpdate = DB_Update('RequestLog', array('UserID' => $NewUserID), array('Where' => SPrintF('`UserID` = %u', $OldUserID['ID'])));
    if (Is_Error($IsUpdate)) {
        return ERROR | @Trigger_Error(500);
    }
}
#-------------------------------------------------------------------------------
$MaxID = DB_Query(SPrintF('ALTER TABLE `Users` AUTO_INCREMENT=%u;', $NewUserID + 2));
if (Is_Error($MaxID)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return TRUE;
#-------------------------------------------------------------------------------
Ejemplo n.º 27
0
$Div = new Tag('DIV', array('align' => 'right'));
#-------------------------------------------------------------------------------
if ($DSSchemeID) {
    #-------------------------------------------------------------------------------
    $Comp = Comp_Load('Form/Input', array('type' => 'checkbox', 'onclick' => 'form.DSSchemeID.value = (checked?0:value);', 'value' => $DSSchemeID));
    if (Is_Error($Comp)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
    $Div->AddChild($Comp);
    #-------------------------------------------------------------------------------
    $Div->AddChild(new Tag('SPAN', array('class' => 'Comment'), 'создать новый тариф'));
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Form/Input', array('type' => 'button', 'onclick' => SPrintF("FormEdit('/Administrator/API/DSSchemeEdit','DSSchemeEditForm','%s');", $Title), 'value' => $DSSchemeID ? 'Сохранить' : 'Добавить'));
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Div->AddChild($Comp);
#-------------------------------------------------------------------------------
$Table[] = $Div;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Tables/Standard', $Table);
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Form = new Tag('FORM', array('name' => 'DSSchemeEditForm', 'onsubmit' => 'return false;'), $Comp);
Ejemplo n.º 28
0
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Tr = new Tag('TR', new Tag('TD', 'С даты'));
#-------------------------------------------------------------------------------
$Comp = Comp_Load('jQuery/DatePicker', SPrintF('%s1', $ColumnID), $Date1 ? $Date1 : Time() - 189216000);
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Tr->AddChild(new Tag('TD', $Comp));
#-------------------------------------------------------------------------------
$Tr->AddChild(new Tag('TD', 'по дату'));
#-------------------------------------------------------------------------------
$Comp = Comp_Load('jQuery/DatePicker', SPrintF('%s2', $ColumnID), $Date2 ? $Date2 : Time());
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Tr->AddChild(new Tag('TD', $Comp));
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Form/Input', array('onclick' => 'TableSuperReload();', 'type' => 'button', 'value' => 'Вывести'));
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Tr->AddChild(new Tag('TD', $Comp));
#-------------------------------------------------------------------------------
$Table = new Tag('TABLE', array('class' => 'Standard', 'cellspacing' => 5), $Tr);
#-------------------------------------------------------------------------------
Ejemplo n.º 29
0
 /**
 * Формирует объект
 *
 * Сформировывает объект класса DOM и подготавливает к выводу в браузер. После
 * вызова этой функции переменная, куда записывался результат выполнения функции
 * выводится с помощью оператора echo.
 *
 * @param boolean <необходимость преобразования в XML строку>
 */
 public function Build($IsToXML = TRUE)
 {
     #-----------------------------------------------------------------------------
     if ($this->TemplateID) {
         #---------------------------------------------------------------------------
         $Trigger = SPrintF('Triggers/DOM/After/%s', $this->TemplateID);
         #---------------------------------------------------------------------------
         if (!Is_Error(System_Element(SPrintF('comp/%s.comp.php', $Trigger)))) {
             #-------------------------------------------------------------------------
             $LinkID = UniqID('DOM-');
             #-------------------------------------------------------------------------
             $Links =& Links();
             # Коллекция ссылок
             $Links[$LinkID] =& $this;
             #-------------------------------------------------------------------------
             if (Is_Error(Comp_Load($Trigger, $LinkID, COMP_ALL_HOSTS))) {
                 return ERROR | @Trigger_Error('[DOM->Build]: ошибка загрузки предобработчика');
             }
             #-------------------------------------------------------------------------
             unset($Links[$LinkID]);
         }
     }
     #-----------------------------------------------------------------------------
     # Номализация документа
     $this->Normalize();
     #-----------------------------------------------------------------------------
     $this->Apply('Sources');
     #-----------------------------------------------------------------------------
     if ($IsToXML) {
         #---------------------------------------------------------------------------
         $Result = $this->Object->ToXMLString();
         if (Is_Error($Result)) {
             return ERROR | Trigger_Error('[DOM->Build]: не удалось преобразовать DOM в строку');
         }
         #---------------------------------------------------------------------------
         return SPrintF("<!-- Joonte Billing System http://www.joonte.com -->\n%s", $Result);
     }
     #-----------------------------------------------------------------------------
     return TRUE;
 }
Ejemplo n.º 30
0
/******************************************************************************/
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
$Args = Args();
#-------------------------------------------------------------------------------
$TableID = (string) @$Args['TableID'];
$RowID = (int) @$Args['RowID'];
$UserNotice = (string) @$Args['UserNotice'];
#-------------------------------------------------------------------------------
if (Is_Error(System_Load('modules/Authorisation.mod'))) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Notice = DB_Select(SPrintF('%sOwners', $TableID), array('ID', 'UserNotice', 'UserID'), array('UNIQ', 'ID' => $RowID));
#-------------------------------------------------------------------------------
switch (ValueOf($Notice)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        return ERROR | @Trigger_Error(400);
    case 'array':
        #-------------------------------------------------------------------------------
        if ($GLOBALS['__USER']['ID'] != $Notice['UserID']) {
            if (!$GLOBALS['__USER']['IsAdmin']) {
                return ERROR | @Trigger_Error(700);
            }
        }
        #-------------------------------------------------------------------------------
        break;