php StrPos类(方法)实例源码

下面列出了php StrPos 类(方法)源码代码实例,从而了解它的用法。

作者:GE    项目:GE   
function jeRobot()
{
    //(funkce převzata z http://seo.nawebu.cz/200301/0287.html)
    $robot = 0;
    $agent_test = " " . StrToLower($_SERVER["HTTP_USER_AGENT"]);
    if (!StrPos($agent_test, "mozilla") && !StrPos($agent_test, "opera") && !StrPos($agent_test, "links") && !StrPos($agent_test, "lynx") && !StrPos($agent_test, "icab") && !StrPos($agent_test, "reqwireless")) {
        $robot = 1;
    } else {
        if (StrPos($agent_test, "@")) {
            $robot = 1;
        }
        if (StrPos($agent_test, "search")) {
            $robot = 1;
        }
        if (StrPos($agent_test, "crawl")) {
            $robot = 1;
        }
        if (StrPos($agent_test, "bot")) {
            $robot = 1;
        }
        if (StrPos($agent_test, "spider")) {
            $robot = 1;
        }
        if (StrPos($agent_test, "jeeves")) {
            $robot = 1;
        }
    }
    return $robot;
}

作者:webgksuppor    项目:alpin   
function __UnEscapeTmp(&$item, $key)
 {
     if (Is_Array($item)) {
         Array_Walk($item, '__UnEscapeTmp');
     } else {
         if (StrPos($item, "%u") !== false) {
             $item = $GLOBALS["APPLICATION"]->UnJSEscape($item);
         }
     }
 }

作者:andyU    项目:kabmin-ne   
static function filterContent($content)
 {
     global $post;
     if ($post->post_type == Post_Type::$post_type_name && Is_Single($post->ID)) {
         if (StrPos($content, '[glossary_related_terms]') === False && StrPos($content, '[glossary_related_terms ') === False && Options::Get('related_terms') != 'none' && !post_password_required()) {
             $content .= Shortcodes::Related_Terms();
         }
     }
     return $content;
 }

作者:rtgibbon    项目:bya.or   
function Get_Active_Extensions()
 {
     $arr_extension = array();
     foreach ((array) get_option('active_plugins') as $plugin_file) {
         $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_file);
         if (StrPos(StrToLower($plugin_data['Author']), 'dennis hoppe') !== False) {
             $arr_extension[$plugin_file] = $plugin_data;
         }
     }
     return $arr_extension;
 }

作者:tetrate    项目:runescape-classic-dum   
function Decrypt($S)
{
    $chars = "KECTDPOSWNMFGQHL";
    $S = Substr($S, 1);
    $s1 = "";
    for ($F = 0; $F < StrLen($S) / 2; $F++) {
        $f1 = StrPos($chars, substr($S, $F, 1));
        $f2 = StrPos($chars, substr($S, StrLen($S) / 2 + $F, 1));
        $f2 = $f2 << 4;
        $ff = $f1 | $f2;
        $s1 = $s1 . Chr($ff);
    }
    return $s1;
}

作者:carriercom    项目:jb   
//.........这里部分代码省略.........
            #-------------------------------------------------------------------------
            $Invoice = Array_Combine(array('Domain', 'User', 'Parkeds'), $Invoice);
            #-------------------------------------------------------------------------
            $Domains = array($Invoice['Domain']);
            #-------------------------------------------------------------------------
            $Parkeds = Explode('|', $Invoice['Parkeds']);
            #-------------------------------------------------------------------------
            Array_Pop($Parkeds);
            #-------------------------------------------------------------------------
            foreach ($Parkeds as $Parked) {
                #-----------------------------------------------------------------------
                $Parked = Explode('=', $Parked);
                #-----------------------------------------------------------------------
                if (Count($Parked) != 2) {
                    continue;
                }
                #-----------------------------------------------------------------------
                $Parked = Array_Combine(array('Domain1', 'Domain2'), $Parked);
                #-----------------------------------------------------------------------
                $Domain2 = $Parked['Domain2'];
                #-----------------------------------------------------------------------
                if ($Parked['Domain1'] || $Domain2) {
                    #---------------------------------------------------------------------
                    if (StrLen($Domain2) > 1) {
                        #-------------------------------------------------------------------
                        $Domain2 = Explode(',', $Domain2);
                        #-------------------------------------------------------------------
                        Array_Pop($Domain2);
                        #-------------------------------------------------------------------
                        foreach ($Domain2 as $Domain) {
                            $Domains[] = $Domain;
                        }
                    } else {
                        $Domains[] = $Parked['Domain1'];
                    }
                }
            }
            #-------------------------------------------------------------------------
            $Result[$Invoice['User']] = $Domains;
        }
    }
    #-----------------------------------------------------------------------------
    $Request = array('nohtml' => 'y');
    #-----------------------------------------------------------------------------
    $Response = HTTP_Send('/scripts2/listparked', $HTTP, $Request);
    if (Is_Error($Response)) {
        return ERROR | @Trigger_Error('[Cpanel_Get_Domains]: не удалось осуществить запрос');
    }
    #-----------------------------------------------------------------------------
    foreach (Explode("\n", $Response['Body']) as $Invoice) {
        #---------------------------------------------------------------------------
        if (Preg_Match('/.+\\:.+\\:.+/', $Invoice)) {
            #-------------------------------------------------------------------------
            $Invoice = Explode(':', $Invoice);
            #-------------------------------------------------------------------------
            if (Count($Invoice) != 3) {
                continue;
            }
            #-------------------------------------------------------------------------
            $Invoice = Array_Combine(array('Domain', 'User', 'Parkeds'), $Invoice);
            #-------------------------------------------------------------------------
            $User = $Invoice['User'];
            #-------------------------------------------------------------------------
            if (isset($Result[$User])) {
                $Result[$User] = array();
            }
            #-------------------------------------------------------------------------
            $Result[$User][] = $Invoice['Domain'];
        }
    }
    #-----------------------------------------------------------------------------
    $Request = array('viewall' => 1, 'nohtml' => 'y');
    #-----------------------------------------------------------------------------
    $Response = HTTP_Send('/scripts2/listaccts', $HTTP, $Request);
    if (Is_Error($Response)) {
        return ERROR | @Trigger_Error('[Cpanel_Get_Domains]: не удалось осуществить запрос');
    }
    #-----------------------------------------------------------------------------
    foreach (Explode("\n", $Response['Body']) as $Invoice) {
        #---------------------------------------------------------------------------
        if (Preg_Match('/.+\\=.+\\,.+\\,.+/', $Invoice)) {
            #-------------------------------------------------------------------------
            $Invoice = Array_Combine(array('User', 'Domain'), Explode('=', SubStr($Invoice, 0, StrPos($Invoice, ','))));
            #-------------------------------------------------------------------------
            $User = $Invoice['User'];
            #-------------------------------------------------------------------------
            if (isset($Result[$User])) {
                $Result[$User] = array();
            }
            #-------------------------------------------------------------------------
            $Result[$User][] = $Invoice['Domain'];
        }
    }
    #-----------------------------------------------------------------------------
    if (!Count($Result)) {
        return new gException('DOMAINS_NOT_FOUND', 'Домены не найдены');
    }
    #-----------------------------------------------------------------------------
    return $Result;
}

作者:vojtajin    项目:sitellit   
function mp3_id($file)
 {
     // Lux: we keep all variables internal within this function, that way our global namespace
     // is kept clean, and we can still call this method like a function without instantiating
     // a whole class to do so.
     //global $version, $layer, $crc, $bitrate, $bitindex, $freq, $mode, $copy, $genres;
     // Corrected by Luca (18/06/01): luca@linuxmendoza.org.ar
     $genres = array('Blues', 'Classic Rock', 'Country', 'Dance', 'Disco', 'Funk', 'Grunge', 'Hip-Hop', 'Jazz', 'Metal', 'New Age', 'Oldies', 'Other', 'Pop', 'R&B', 'Rap', 'Reggae', 'Rock', 'Techno', 'Industrial', 'Alternative', 'Ska', 'Death Metal', 'Pranks', 'Soundtrack', 'Euro-Techno', 'Ambient', 'Trip-Hop', 'Vocal', 'Jazz+Funk', 'Fusion', 'Trance', 'Classical', 'Instrumental', 'Acid', 'House', 'Game', 'Sound Clip', 'Gospel', 'Noise', 'AlternRock', 'Bass', 'Soul', 'Punk', 'Space', 'Meditative', 'Instrumental Pop', 'Instrumental Rock', 'Ethnic', 'Gothic', 'Darkwave', 'Techno-Industrial', 'Electronic', 'Pop-Folk', 'Eurodance', 'Dream', 'Southern Rock', 'Comedy', 'Cult', 'Gangsta', 'Top 40', 'Christian Rap', 'Pop/Funk', 'Jungle', 'Native American', 'Cabaret', 'New Wave', 'Psychadelic', 'Rave', 'Showtunes', 'Trailer', 'Lo-Fi', 'Tribal', 'Acid Punk', 'Acid Jazz', 'Polka', 'Retro', 'Musical', 'Rock & Roll', 'Hard Rock', 'Folk', 'Folk-Rock', 'National Folk', 'Swing', 'Fast Fusion', 'Bebob', 'Latin', 'Revival', 'Celtic', 'Bluegrass', 'Avantgarde', 'Gothic Rock', 'Progressive Rock', 'Psychedelic Rock', 'Symphonic Rock', 'Slow Rock', 'Big Band', 'Chorus', 'Easy Listening', 'Acoustic', 'Humour', 'Speech', 'Chanson', 'Opera', 'Chamber Music', 'Sonata', 'Symphony', 'Booty Bass', 'Primus', 'Porn Groove', 'Satire', 'Slow Jam', 'Club', 'Tango', 'Samba', 'Folklore', 'Ballad', 'Power Ballad', 'Rhythmic Soul', 'Freestyle', 'Duet', 'Punk Rock', 'Drum Solo', 'Acapella', 'Euro-House', 'Dance Hall');
     $genreids = array("Blues" => 0, "Classic Rock" => 1, "Country" => 2, "Dance" => 3, "Disco" => 4, "Funk" => 5, "Grunge" => 6, "Hip-Hop" => 7, "Jazz" => 8, "Metal" => 9, "New Age" => 10, "Oldies" => 11, "Other" => 12, "Pop" => 13, "R&B" => 14, "Rap" => 15, "Reggae" => 16, "Rock" => 17, "Techno" => 18, "Industrial" => 19, "Alternative" => 20, "Ska" => 21, "Death Metal" => 22, "Pranks" => 23, "Soundtrack" => 24, "Euro-Techno" => 25, "Ambient" => 26, "Trip-Hop" => 27, "Vocal" => 28, "Jazz+Funk" => 29, "Fusion" => 30, "Trance" => 31, "Classical" => 32, "Instrumental" => 33, "Acid" => 34, "House" => 35, "Game" => 36, "Sound Clip" => 37, "Gospel" => 38, "Noise" => 39, "AlternRock" => 40, "Bass" => 41, "Soul" => 42, "Punk" => 43, "Space" => 44, "Meditative" => 45, "Instrumental Pop" => 46, "Instrumental Rock" => 47, "Ethnic" => 48, "Gothic" => 49, "Darkwave" => 50, "Techno-Industrial" => 51, "Electronic" => 52, "Pop-Folk" => 53, "Eurodance" => 54, "Dream" => 55, "Southern Rock" => 56, "Comedy" => 57, "Cult" => 58, "Gangsta" => 59, "Top 40" => 60, "Christian Rap" => 61, "Pop/Funk" => 62, "Jungle" => 63, "Native American" => 64, "Cabaret" => 65, "New Wave" => 66, "Psychadelic" => 67, "Rave" => 68, "Showtunes" => 69, "Trailer" => 70, "Lo-Fi" => 71, "Tribal" => 72, "Acid Punk" => 73, "Acid Jazz" => 74, "Polka" => 75, "Retro" => 76, "Musical" => 77, "Rock & Roll" => 78, "Hard Rock" => 79, "Folk" => 80, "Folk-Rock" => 81, "National Folk" => 82, "Swing" => 83, "Fast Fusion" => 84, "Bebob" => 85, "Latin" => 86, "Revival" => 87, "Celtic" => 88, "Bluegrass" => 89, "Avantgarde" => 90, "Gothic Rock" => 91, "Progressive Rock" => 92, "Psychedelic Rock" => 93, "Symphonic Rock" => 94, "Slow Rock" => 95, "Big Band" => 96, "Chorus" => 97, "Easy Listening" => 98, "Acoustic" => 99, "Humour" => 100, "Speech" => 101, "Chanson" => 102, "Opera" => 103, "Chamber Music" => 104, "Sonata" => 105, "Symphony" => 106, "Booty Bass" => 107, "Primus" => 108, "Porn Groove" => 109, "Satire" => 110, "Slow Jam" => 111, "Club" => 112, "Tango" => 113, "Samba" => 114, "Folklore" => 115, "Ballad" => 116, "Power Ballad" => 117, "Rhythmic Soul" => 118, "Freestyle" => 119, "Duet" => 120, "Punk Rock" => 121, "Drum Solo" => 122, "Acapella" => 123, "Euro-House" => 124, "Dance Hall" => 125);
     // end
     $version = array("00" => 2.5, "10" => 2, "11" => 1);
     $layer = array("01" => 3, "10" => 2, "11" => 1);
     $crc = array("Yes", "No");
     $bitrate["0001"] = array(32, 32, 32, 32, 8, 8);
     $bitrate["0010"] = array(64, 48, 40, 48, 16, 16);
     $bitrate["0011"] = array(96, 56, 48, 56, 24, 24);
     $bitrate["0100"] = array(128, 64, 56, 64, 32, 32);
     $bitrate["0101"] = array(160, 80, 64, 80, 40, 40);
     $bitrate["0110"] = array(192, 96, 80, 96, 48, 48);
     $bitrate["0111"] = array(224, 112, 96, 112, 56, 56);
     $bitrate["1000"] = array(256, 128, 112, 128, 64, 64);
     $bitrate["1001"] = array(288, 160, 128, 144, 80, 80);
     $bitrate["1010"] = array(320, 192, 160, 160, 96, 96);
     $bitrate["1011"] = array(352, 224, 192, 176, 112, 112);
     $bitrate["1100"] = array(384, 256, 224, 192, 128, 128);
     $bitrate["1101"] = array(416, 320, 256, 224, 144, 144);
     $bitrate["1110"] = array(448, 384, 320, 256, 160, 160);
     $bitindex = array("1111" => "0", "1110" => "1", "1101" => "2", "1011" => "3", "1010" => "4", "1001" => "5", "0011" => "3", "0010" => 4, "0001" => "5");
     $freq["00"] = array("11" => 44100, "10" => 22050, "00" => 11025);
     $freq["01"] = array("11" => 48000, "10" => 24000, "00" => 12000);
     $freq["10"] = array("11" => 32000, "10" => 16000, "00" => 8000);
     $mode = array("00" => "Stereo", "01" => "Joint stereo", "10" => "Dual channel", "11" => "Mono");
     $copy = array("No", "Yes");
     if (!($f = @fopen($file, "r"))) {
         return -1;
         break;
     } else {
         // read first 4 bytes from file and determine if it is wave file if so, header begins five bytes after word 'data'
         $tmp = fread($f, 4);
         if ($tmp == "RIFF") {
             $idtag["ftype"] = "Wave";
             fseek($f, 0);
             $tmp = fread($f, 128);
             $x = StrPos($tmp, "data");
             fseek($f, $x + 8);
             $tmp = fread($f, 4);
         }
         // now convert those four bytes to BIN. maybe it can be faster and easier. dunno how yet. help?
         for ($y = 0; $y < 4; $y++) {
             $x = decbin(ord($tmp[$y]));
             for ($i = 0; $i < 8 - StrLen($x); $i++) {
                 $x .= "0";
             }
             $bajt .= $x;
         }
         // every mp3 framesynch begins with eleven ones, lets look for it. if not found continue looking for some 1024 bytes (you can search multiple for it or you can disable this, it will speed up and not many mp3 are like this. anyways its not standart)
         //     if(substr($bajt,1,11)!="11111111111") {
         //        return -1;
         //        break;
         //     }
         if (substr($bajt, 1, 11) != "11111111111") {
             fseek($f, 4);
             $tmp = fread($f, 2048);
             for ($i = 0; $i < 2048; $i++) {
                 if (ord($tmp[$i]) == 255 && substr(decbin(ord($tmp[$i + 1])), 0, 3) == "111") {
                     $tmp = substr($tmp, $i, 4);
                     $bajt = "";
                     for ($y = 0; $y < 4; $y++) {
                         $x = decbin(ord($tmp[$y]));
                         for ($i = 0; $i < 8 - StrLen($x); $i++) {
                             $x .= "0";
                         }
                         $bajt .= $x;
                     }
                     break;
                 }
             }
         }
         if ($bajt == "") {
             return -1;
             break;
         }
         // now parse all the info from frame header
         $len = filesize($file);
         $idtag["version"] = $version[substr($bajt, 11, 2)];
         $idtag["layer"] = $layer[substr($bajt, 13, 2)];
         $idtag["crc"] = $crc[$bajt[15]];
         $idtag["bitrate"] = $bitrate[substr($bajt, 16, 4)][$bitindex[substr($bajt, 11, 4)]];
         $idtag["frequency"] = $freq[substr($bajt, 20, 2)][substr($bajt, 11, 2)];
         $idtag["padding"] = $copy[$bajt[22]];
         $idtag["mode"] = $mode[substr($bajt, 24, 2)];
         $idtag["copyright"] = $copy[$bajt[28]];
         $idtag["original"] = $copy[$bajt[29]];
         // lets count lenght of the song
         if ($idtag["layer"] == 1) {
             $fsize = (12 * ($idtag["bitrate"] * 1000) / $idtag["frequency"] + $idtag["padding"]) * 4;
         } else {
             $fsize = 144 * ($idtag["bitrate"] * 1000 / $idtag["frequency"] + $idtag["padding"]);
         }
         // Modified by Luca (18/02/01): devel@lluca.com
//.........这里部分代码省略.........

作者:k-kalashniko    项目:geekcon_ne   
function CopyComponent($componentName, $newNamespace, $newName = False, $bRewrite = False)
 {
     global $APPLICATION;
     $componentName = trim($componentName);
     if (strlen($componentName) <= 0) {
         $APPLICATION->ThrowException(GetMessage("comp_util_err1"), "EMPTY_COMPONENT_NAME");
         return false;
     }
     $path2Comp = CComponentEngine::MakeComponentPath($componentName);
     if (strlen($path2Comp) <= 0) {
         $APPLICATION->ThrowException(str_replace("#NAME#", $componentName, GetMessage("comp_util_err2")), "ERROR_NOT_COMPONENT");
         return false;
     }
     $componentPath = "/bitrix/components" . $path2Comp;
     if (!CComponentUtil::isComponent($componentPath)) {
         $APPLICATION->ThrowException(str_replace("#NAME#", $componentName, GetMessage("comp_util_err2")), "ERROR_NOT_COMPONENT");
         return false;
     }
     $newNamespace = trim($newNamespace);
     if (strlen($newNamespace) > 0) {
         $newNamespaceTmp = preg_replace("#[^A-Za-z0-9_.-]#i", "", $newNamespace);
         if ($newNamespace != $newNamespaceTmp) {
             $APPLICATION->ThrowException(str_replace("#NAME#", $newNamespace, GetMessage("comp_util_err3")), "ERROR_NEW_NAMESPACE");
             return false;
         }
     }
     if (strlen($newName) <= 0) {
         $newName = False;
     }
     if ($newName !== False) {
         if (!preg_match("#^([A-Za-z0-9_-]+\\.)*([A-Za-z0-9_-]+)\$#i", $newName)) {
             $APPLICATION->ThrowException(str_replace("#NAME#", $newName, GetMessage("comp_util_err4")), "ERROR_NEW_NAME");
             return false;
         }
     }
     $namespace = "";
     $name = $componentName;
     if (($pos = StrPos($componentName, ":")) !== False) {
         $namespace = SubStr($componentName, 0, $pos);
         $name = SubStr($componentName, $pos + 1);
     }
     if ($namespace == $newNamespace && ($newName === False || $newName !== False && $name == $newName)) {
         $APPLICATION->ThrowException(GetMessage("comp_util_err5"), "ERROR_DUPL1");
         return false;
     }
     if ($newName !== False) {
         $componentNameNew = $newNamespace . ":" . $newName;
     } else {
         $componentNameNew = $newNamespace . ":" . $name;
     }
     $path2CompNew = CComponentEngine::MakeComponentPath($componentNameNew);
     if (strlen($path2CompNew) <= 0) {
         $APPLICATION->ThrowException(str_replace("#NAME#", $componentNameNew, GetMessage("comp_util_err2")), "ERROR_NOT_COMPONENT");
         return false;
     }
     $componentPathNew = "/bitrix/components" . $path2CompNew;
     if (file_exists($_SERVER["DOCUMENT_ROOT"] . $componentPathNew)) {
         if (!$bRewrite) {
             $APPLICATION->ThrowException(str_replace("#NAME#", $componentNameNew, GetMessage("comp_util_err6")), "ERROR_EXISTS");
             return false;
         } else {
             DeleteDirFilesEx($componentPathNew);
         }
     }
     CheckDirPath($_SERVER["DOCUMENT_ROOT"] . $componentPathNew);
     CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . $componentPath, $_SERVER["DOCUMENT_ROOT"] . $componentPathNew, True, True, False);
     return null;
 }

作者:mrdeadmous    项目:u13600   
if (IntVal($arParams["USERGROUPS_MODIFY"]) > 0) {
        $arParams["USERGROUPS_MODIFY"] = array($arParams["USERGROUPS_MODIFY"]);
    } else {
        $arParams["USERGROUPS_MODIFY"] = array();
    }
}
if (!Is_Array($arParams["USERGROUPS_RESERVE"])) {
    if (IntVal($arParams["USERGROUPS_RESERVE"]) > 0) {
        $arParams["USERGROUPS_RESERVE"] = array($arParams["USERGROUPS_RESERVE"]);
    } else {
        $arParams["USERGROUPS_RESERVE"] = array();
    }
}
$meetingId = IntVal($arParams["MEETING_ID"]);
if ($meetingId <= 0) {
    $meetingId = IntVal($_REQUEST[$arParams["MEETING_VAR"]]);
}
$arResult["Page"] = Trim($arParams["PAGE_ID"]);
if (StrLen($arResult["Page"]) <= 0) {
    $arResult["Page"] = Trim($_REQUEST[$arParams["PAGE_VAR"]]);
}
$arResult["Urls"]["MeetingList"] = $arParams["PATH_TO_MEETING_LIST"];
$arResult["Urls"]["ModifyMeeting"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MODIFY_MEETING"], array("meeting_id" => $meetingId));
$arResult["Urls"]["CreateMeeting"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MODIFY_MEETING"], array("meeting_id" => 0));
$arResult["Urls"]["Meeting"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MEETING"], array("meeting_id" => $meetingId));
$arResult["Urls"]["Meeting"] .= (StrPos($arResult["Urls"]["Meeting"], "?") === false ? "?" : "&") . "week_start=" . UrlEncode($_REQUEST["week_start"]);
$arResult["Urls"]["ReserveMeeting"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_RESERVE_MEETING"], array("meeting_id" => $meetingId, "item_id" => 0));
$arResult["Urls"]["Search"] = $arParams["PATH_TO_SEARCH"];
$arResult["Perms"]["CanModify"] = $GLOBALS["USER"]->IsAuthorized() && ($GLOBALS["USER"]->IsAdmin() || Count(Array_Intersect($GLOBALS["USER"]->GetUserGroupArray(), $arParams["USERGROUPS_MODIFY"])) > 0);
$arResult["Perms"]["CanReserve"] = $GLOBALS["USER"]->IsAuthorized() && ($GLOBALS["USER"]->IsAdmin() || Count(Array_Intersect($GLOBALS["USER"]->GetUserGroupArray(), $arParams["USERGROUPS_RESERVE"])) > 0);
$this->IncludeComponentTemplate();

作者:k-kalashniko    项目:geekcon_ne   
}
 }
 // USER PROPERIES
 $arResult["UserPropertiesMain"] = array("SHOW" => "N", "DATA" => array());
 $arResult["UserPropertiesContact"] = array("SHOW" => "N", "DATA" => array());
 $arResult["UserPropertiesPersonal"] = array("SHOW" => "N", "DATA" => array());
 if (count($arParams["USER_PROPERTY_MAIN"]) > 0 || count($arParams["USER_PROPERTY_CONTACT"]) > 0 || count($arParams["USER_PROPERTY_PERSONAL"]) > 0) {
     $arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("USER", $arResult["User"]["ID"], LANGUAGE_ID);
     foreach ($arUserFields as $fieldName => $arUserField) {
         //echo "<pre>".print_r($arUserField, true)."</pre>";
         $arUserField["EDIT_FORM_LABEL"] = StrLen($arUserField["EDIT_FORM_LABEL"]) > 0 ? $arUserField["EDIT_FORM_LABEL"] : $arUserField["FIELD_NAME"];
         $arUserField["EDIT_FORM_LABEL"] = htmlspecialcharsEx($arUserField["EDIT_FORM_LABEL"]);
         $arUserField["~EDIT_FORM_LABEL"] = $arUserField["EDIT_FORM_LABEL"];
         $arUserField["PROPERTY_VALUE_LINK"] = "";
         if (in_array($arUserField["FIELD_NAME"], $arParams["SONET_USER_PROPERTY_SEARCHABLE"])) {
             $arUserField["PROPERTY_VALUE_LINK"] = $arParams["PATH_TO_SEARCH_INNER"] . (StrPos($arParams["PATH_TO_SEARCH_INNER"], "?") !== false ? "&" : "?") . "flt_" . StrToLower($arUserField["FIELD_NAME"]) . "=#VALUE#";
         } elseif ($bIntranet) {
             $arUserField['SETTINGS']['SECTION_URL'] = $arParams["PATH_TO_CONPANY_DEPARTMENT"];
         }
         if (in_array($fieldName, $arParams["USER_PROPERTY_MAIN"])) {
             $arResult["UserPropertiesMain"]["DATA"][$fieldName] = $arUserField;
         }
         if (in_array($fieldName, $arParams["USER_PROPERTY_CONTACT"])) {
             $arResult["UserPropertiesContact"]["DATA"][$fieldName] = $arUserField;
         }
         if (in_array($fieldName, $arParams["USER_PROPERTY_PERSONAL"])) {
             $arResult["UserPropertiesPersonal"]["DATA"][$fieldName] = $arUserField;
         }
     }
     if (count($arResult["UserPropertiesMain"]["DATA"]) > 0) {
         $arResult["UserPropertiesMain"]["SHOW"] = "Y";

作者:mrdeadmous    项目:u13600   
function PrepareGetListArray($key, &$arFields, &$arPropIDsTmp)
 {
     $propIDTmp = false;
     if (StrPos($key, "PROPERTY_ID_") === 0) {
         $propIDTmp = IntVal(substr($key, StrLen("PROPERTY_ID_")));
     } elseif (StrPos($key, "PROPERTY_NAME_") === 0) {
         $propIDTmp = IntVal(substr($key, StrLen("PROPERTY_NAME_")));
     } elseif (StrPos($key, "PROPERTY_VALUE_") === 0) {
         $propIDTmp = IntVal(substr($key, StrLen("PROPERTY_VALUE_")));
     } elseif (StrPos($key, "PROPERTY_CODE_") === 0) {
         $propIDTmp = IntVal(substr($key, StrLen("PROPERTY_CODE_")));
     } elseif (StrPos($key, "PROPERTY_VAL_BY_CODE_") === 0) {
         $propIDTmp = preg_replace("/[^a-zA-Z0-9_-]/is", "", trim(substr($key, StrLen("PROPERTY_VAL_BY_CODE_"))));
     }
     $locationPropInfo = self::getLocationPropertyInfo();
     if (strlen($propIDTmp) > 0 || $propIDTmp > 0) {
         if (!in_array($propIDTmp, $arPropIDsTmp)) {
             $arPropIDsTmp[] = $propIDTmp;
             $arFields["PROPERTY_ID_" . $propIDTmp] = array("FIELD" => "SP_" . $propIDTmp . ".ID", "TYPE" => "int", "FROM" => "INNER JOIN b_sale_order_props_value SP_" . $propIDTmp . " ON (SP_" . $propIDTmp . ".ORDER_PROPS_ID = " . $propIDTmp . " AND O.ID = SP_" . $propIDTmp . ".ORDER_ID)");
             $arFields["PROPERTY_ORDER_PROPS_ID_" . $propIDTmp] = array("FIELD" => "SP_" . $propIDTmp . ".ORDER_PROPS_ID", "TYPE" => "int", "FROM" => "INNER JOIN b_sale_order_props_value SP_" . $propIDTmp . " ON (SP_" . $propIDTmp . ".ORDER_PROPS_ID = " . $propIDTmp . " AND O.ID = SP_" . $propIDTmp . ".ORDER_ID)");
             $arFields["PROPERTY_NAME_" . $propIDTmp] = array("FIELD" => "SP_" . $propIDTmp . ".NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_sale_order_props_value SP_" . $propIDTmp . " ON (SP_" . $propIDTmp . ".ORDER_PROPS_ID = " . $propIDTmp . " AND O.ID = SP_" . $propIDTmp . ".ORDER_ID)");
             if (CSaleLocation::isLocationProMigrated() && isset($locationPropInfo['ID'][$propIDTmp])) {
                 $arFields["PROPERTY_VALUE_" . $propIDTmp] = array("FIELD" => "L_" . $propIDTmp . ".ID", "TYPE" => "string", "FROM" => "INNER JOIN b_sale_order_props_value SP_" . $propIDTmp . " ON (SP_" . $propIDTmp . ".ORDER_PROPS_ID = " . $propIDTmp . " AND O.ID = SP_" . $propIDTmp . ".ORDER_ID) INNER JOIN b_sale_location L_" . $propIDTmp . " ON (SP_" . $propIDTmp . ".VALUE = L_" . $propIDTmp . ".CODE)");
             } else {
                 $arFields["PROPERTY_VALUE_" . $propIDTmp] = array("FIELD" => "SP_" . $propIDTmp . ".VALUE", "TYPE" => "string", "FROM" => "INNER JOIN b_sale_order_props_value SP_" . $propIDTmp . " ON (SP_" . $propIDTmp . ".ORDER_PROPS_ID = " . $propIDTmp . " AND O.ID = SP_" . $propIDTmp . ".ORDER_ID)");
             }
             $arFields["PROPERTY_CODE_" . $propIDTmp] = array("FIELD" => "SP_" . $propIDTmp . ".CODE", "TYPE" => "string", "FROM" => "INNER JOIN b_sale_order_props_value SP_" . $propIDTmp . " ON (SP_" . $propIDTmp . ".ORDER_PROPS_ID = " . $propIDTmp . " AND O.ID = SP_" . $propIDTmp . ".ORDER_ID)");
             if (CSaleLocation::isLocationProMigrated() && isset($locationPropInfo['CODE'][$propIDTmp])) {
                 $arFields["PROPERTY_VAL_BY_CODE_" . $propIDTmp] = array("FIELD" => "L_" . $propIDTmp . ".ID", "TYPE" => "string", "FROM" => "INNER JOIN b_sale_order_props_value SP_" . $propIDTmp . " ON (SP_" . $propIDTmp . ".CODE = '" . $propIDTmp . "' AND O.ID = SP_" . $propIDTmp . ".ORDER_ID) INNER JOIN b_sale_location L_" . $propIDTmp . " ON (SP_" . $propIDTmp . ".VALUE = L_" . $propIDTmp . ".CODE)");
             } else {
                 $arFields["PROPERTY_VAL_BY_CODE_" . $propIDTmp] = array("FIELD" => "SP_" . $propIDTmp . ".VALUE", "TYPE" => "string", "FROM" => "INNER JOIN b_sale_order_props_value SP_" . $propIDTmp . " ON (SP_" . $propIDTmp . ".CODE = '" . $propIDTmp . "' AND O.ID = SP_" . $propIDTmp . ".ORDER_ID)");
             }
         }
     }
 }

作者:janhanci    项目:simplepagechec   
public function RunChecks()
 {
     if ($this->reportToOutput === false && $this->recipientEmail === null) {
         throw new BadMethodCallException('No reporting defined. Call "ReportToEmail()" or/and "ReportToOutput()" method.');
     }
     if (Count($this->checks) === 0) {
         throw new BadMethodCallException('No checks defined. Add at least one check using "AddCheck()" method.');
     }
     $errors = array();
     foreach ($this->checks as $key => $check) {
         if ($check['pre_url'] !== null) {
             File_Get_Contents($check['pre_url']);
         }
         // just fetch the page, we don't need it's contents
         $response = File_Get_Contents($check['url']);
         if ($response === false) {
             $errors[] = array($check, 'URL not reachable');
             continue;
         }
         $checkFound = false;
         if ($check['is_regex'] === false) {
             $checkFound = StrPos($response, $check['check']) !== false;
         } else {
             $matchResult = Preg_Match($check['check'], $response);
             if ($matchResult === false) {
                 $errors[] = array($check, 'Regular expression is not valid');
                 continue;
             } else {
                 if ($matchResult > 0) {
                     $checkFound = true;
                 }
             }
         }
         if ($checkFound === false) {
             $errors[] = array($check, 'Check string not found');
         }
     }
     if (Count($errors) > 0) {
         $errorsBody = '';
         foreach ($errors as $key => $error) {
             if ($this->recipientEmail !== null) {
                 if ($this->oneEmailPerError === true) {
                     $errorsBody .= $this->getErrorMessage($error) . "\n\n";
                 } else {
                     $this->sendErrorEmail($this->getErrorMessage($error));
                 }
             }
             if ($this->reportToOutput === true) {
                 if ($this->inCli === true) {
                     echo $this->getErrorMessage($error) . "\n\n";
                 } else {
                     echo Nl2Br($this->getErrorMessage($error)) . "<br /><br />";
                 }
             }
         }
         if ($this->recipientEmail !== null && $this->oneEmailPerError === true) {
             $this->sendErrorEmail($errorsBody);
         }
     }
 }

作者:NioFB    项目:majordom   
/**
 * [#inc ...#] tag parsing
 *
 * @access private
 * @param string $res template strings
 * @param array $hash data params
 * @param string $dir current template directory (for correct [#inc ...#] tags parsing)
 */
 function parseIncludes(&$res, &$hash, $dir)
 {
     if (preg_match_all('/\\[#inc (.*?)#\\]/', $res, $matches, PREG_PATTERN_ORDER)) {
         $count_matches_0 = count($matches[0]);
         for ($i = 0; $i < $count_matches_0; $i++) {
             $raw = $matches[1][$i];
             if (Is_Integer(strpos($raw, '="'))) {
                 // inc file parameters
                 $new_hash = $hash;
                 preg_match_all('/(\\w+?)="(.*?)"/', $raw, $matches1, PREG_PATTERN_ORDER);
                 $count_matches1_0 = count($matches1[0]);
                 for ($k = 0; $k < $count_matches1_0; $k++) {
                     $new_hash[$matches1[1][$k]] = $matches1[2][$k];
                     $raw = str_replace($matches1[0][$k], '', $raw);
                 }
             } else {
                 $new_hash =& $hash;
             }
             $file_name = $dir . trim($raw);
             $new_root = dirname($file_name) . "/";
             if (defined('ALTERNATIVE_TEMPLATES')) {
                 $alt_path = str_replace('templates/', ALTERNATIVE_TEMPLATES . '/', $file_name);
                 if (file_exists($alt_path)) {
                     $file_name = $alt_path;
                 }
             }
             if (!file_exists($file_name)) {
                 $res = str_replace($matches[0][$i], "<!-- Cannot find file {$file_name} -->", $res);
             } else {
                 if (Defined("DEBUG_MODE") && !Is_Integer(StrPos($file_name, ".js"))) {
                     $id = "block" . (int) rand(0, 100000);
                     //$res=str_replace($matches[0][$i], "<!-- begin of file $file_name -->".$this->parse($this->loadfile($file_name)."<!-- end of file $file_name -->", $new_hash, $new_root), $res);
                     $res = str_replace($matches[0][$i], "" . $this->parse($this->loadfile($file_name) . "", $new_hash, $new_root), $res);
                 } else {
                     $res = str_replace($matches[0][$i], $this->parse($this->loadfile($file_name), $new_hash, $new_root), $res);
                 }
             }
         }
     }
     return $res;
 }

作者:novozhenet    项目:majordom   
/**
* [#inc ...#] tag parsing
*
* @access private
* @param string $res template strings
* @param array $hash data params
* @param string $dir current template directory (for correct [#inc ...#] tags parsing)
*/
 function parseIncludes(&$res, &$hash, $dir) {
 
 if (preg_match_all('/\[#inc (.*?)#\]/', $res, $matches, PREG_PATTERN_ORDER)) {
  $count_matches_0=count($matches[0]);
  for($i=0;$i<$count_matches_0;$i++) {
   $raw=$matches[1][$i];
   if (Is_Integer(strpos($raw, '="'))) {
   // inc file parameters
    $new_hash=$hash;
    preg_match_all('/(\w+?)="(.*?)"/', $raw, $matches1, PREG_PATTERN_ORDER);
    $count_matches1_0=count($matches1[0]);
    for($k=0;$k<$count_matches1_0;$k++) {
     $new_hash[$matches1[1][$k]]=$matches1[2][$k];
     $raw=str_replace($matches1[0][$k], '', $raw);
    }
   } else {
    $new_hash=&$hash;
   }
   $file_name=$dir.trim($raw);
   if (!file_exists($file_name)) {
    $res=str_replace($matches[0][$i], "<!-- Cannot find file $file_name -->", $res);
   } else {
    $new_root=dirname($file_name)."/";
    if ((Defined("DEBUG_TEMPLATES")) && !Is_Integer(StrPos($file_name, ".js"))) {
     $id="block".(int)rand(0, 100000);
     $res=str_replace($matches[0][$i], "<div name=\"$file_name\" onMouseOver=\"dmo(event)\" onMouseOut=\"dmu(event)\" style=\"margin:0px\">".$this->parse($this->loadfile($file_name)."</div>", $new_hash, $new_root), $res);
    } else {
     $res=str_replace($matches[0][$i], $this->parse($this->loadfile($file_name), $new_hash, $new_root), $res);
    }
   }
  }
 }

 return $res;

 }

作者:carriercom    项目:jb   
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
$Config = Config();
#-------------------------------------------------------------------------------
$Statuses = $Config['Statuses']['DomainOrders'];
#-------------------------------------------------------------------------------
foreach ($DomainOrders as $DomainOrder) {
    $NoBody->AddChild(new Tag('P', SPrintF('Доменов в статусе "%s": %u', isset($Statuses[$DomainOrder['StatusID']]) ? $Statuses[$DomainOrder['StatusID']]['Name'] : $DomainOrder['StatusID'], $DomainOrder['Count'])));
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Where = array();
#-------------------------------------------------------------------------------
foreach ($Servers as $Server) {
    $Where[] = '`Ns1Name` NOT LIKE "%' . SubStr($Server['Params']['Ns1Name'], StrPos($Server['Params']['Ns1Name'], '.') + 1, StrLen($Server['Params']['Ns1Name'])) . '%"';
}
#-------------------------------------------------------------------------------
$Where[] = '`Ns1Name` != ""';
$Where[] = '`StatusID` = "Active"';
$Where[] = '`Ns1Name` NOT LIKE CONCAT ("%",`DomainName`,".",`Name`)';
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Columns = array('SUBSTRING_INDEX(`Ns1Name`, ".", -2) AS Address', 'COUNT(*) AS Count');
#-------------------------------------------------------------------------------
$DNSs = DB_Select('DomainOrdersOwners', $Columns, array('Where' => $Where, 'SortOn' => 'Count', 'IsDesc' => TRUE, 'GroupBy' => 'Address'));
#-------------------------------------------------------------------------------
switch (ValueOf($DNSs)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':

作者:mrdeadmous    项目:u13600   
}
                $_SESSION["INTASK_TASKVIEW_current_view"][$taskType . "-" . $ownerId] = $userSettingsId;
            }
            $arResult["CurrentView"] = $userSettingsId;
            $strBackUrl = "back_url=" . UrlEncode($GLOBALS["APPLICATION"]->GetCurPageParam("", array()));
            $arResult["Urls"]["CreateView"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASKS_VIEW"], array("owner_id" => $ownerId, "view_id" => 0, "action" => "create"));
            $arResult["Urls"]["CreateView"] .= StrPos($arResult["Urls"]["CreateView"], "?") === false ? "?" : "&";
            $arResult["Urls"]["CreateView"] .= $strBackUrl;
            $arResult["Urls"]["EditView"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASKS_VIEW"], array("owner_id" => $ownerId, "view_id" => $userSettingsId, "action" => "edit"));
            $arResult["Urls"]["EditView"] .= StrPos($arResult["Urls"]["EditView"], "?") === false ? "?" : "&";
            $arResult["Urls"]["EditView"] .= $strBackUrl;
            if ($arResult["Perms"]["create_tasks"]) {
                $arResult["Urls"]["CreateTask"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASKS_TASK"], array("owner_id" => $ownerId, "task_id" => 0, "action" => "create"));
                if (StrLen($strBackUrl) > 0) {
                    $arResult["Urls"]["CreateTask"] .= StrPos($arResult["Urls"]["CreateTask"], "?") === false ? "?" : "&";
                    $arResult["Urls"]["CreateTask"] .= $strBackUrl;
                }
                if (StrLen($strSectionId) > 0) {
                    $arResult["Urls"]["CreateTask"] .= StrPos($arResult["Urls"]["CreateTask"], "?") === false ? "?" : "&";
                    $arResult["Urls"]["CreateTask"] .= $strSectionId;
                }
            } else {
                $arResult["Urls"]["CreateTask"] = "";
            }
            $arResult["Urls"]["DeleteView"] = $arResult["Urls"]["ChangeView"] . "0&" . bitrix_sessid_get() . "&action=delete_view&del_view_id=" . $arResult["CurrentView"];
        }
    }
    if (StrLen($arResult["FatalError"]) <= 0) {
        $this->IncludeComponentTemplate();
    }
}

作者:carriercom    项目:jb   
if (!Is_Array($User)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$IsImmediately = isset($IsImmediately) ? $IsImmediately : FALSE;
#-------------------------------------------------------------------------------
$TransferTime = FALSE;
#-------------------------------------------------------------------------------
# возможно, параметры не заданы/требуется немедленная отправка - время не опредлеяем
if (!$IsImmediately) {
    #-------------------------------------------------------------------------------
    $SMSBeginTime = $User['Params']['Settings']['SMSBeginTime'];
    $SMSBeginTime = IntVal(SubStr($SMSBeginTime, StrPos($SMSBeginTime, '_') + 1, StrLen($SMSBeginTime)));
    #-------------------------------------------------------------------------------
    $SMSEndTime = $User['Params']['Settings']['SMSEndTime'];
    $SMSEndTime = IntVal(SubStr($SMSEndTime, StrPos($SMSEndTime, '_') + 1, StrLen($SMSEndTime)));
    #-------------------------------------------------------------------------------
    # время окончания, если оно 0:00 - это больше чем 23:00, например... надо 0->24
    $SMSEndTime = $SMSEndTime == 0 ? 24 : $SMSEndTime;
    #-------------------------------------------------------------------------------
    if ($SMSBeginTime != $SMSEndTime) {
        #-------------------------------------------------------------------------------
        # если обычный период, например 9:00-18:00
        if ($SMSBeginTime < $SMSEndTime) {
            #-------------------------------------------------------------------------------
            if (Date('G') >= $SMSBeginTime && Date('G') < $SMSEndTime) {
                # OK
            } else {
                #-------------------------------------------------------------------------------
                if (Date('G') < $SMSBeginTime) {
                    #-------------------------------------------------------------------------------

作者:WSIContracto    项目:Simple   
/**
  * Read one string from buffer ending with null byte
  *
  * @return string
  */
 public function GetString()
 {
     $ZeroBytePosition = StrPos($this->Buffer, "", $this->Position);
     if ($ZeroBytePosition === false) {
         $String = "";
     } else {
         $String = $this->Get($ZeroBytePosition - $this->Position);
         $this->Position++;
     }
     return $String;
 }

作者:carriercom    项目:jb   
throw new Exception("Coudn't load class: " . $ClassPath);
    }
    #-------------------------------------------------------------------------------
    include_once $ClassPath;
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
spl_autoload_register('JoonteAutoLoad');
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
/**
 * Request processing.
 */
$__URI = $_SERVER['REQUEST_URI'];
#-------------------------------------------------------------------------------
$Index = StrPos($__URI, '?');
#-------------------------------------------------------------------------------
if (Is_Int($Index)) {
    $__URI = SubStr($__URI, 0, $Index);
}
#-------------------------------------------------------------------------------
unset($Index);
#-------------------------------------------------------------------------------
Debug(SPrintF('[JBs core]: внешний запрос сформирован как (__URI=%s)', $__URI));
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
/**
 * Custom shutdown function.
 */
function __ShutDown_Function__()
{

作者:k-kalashniko    项目:geekcon_ne   
$cacheId = "socnet_user_groups_" . SITE_ID . '_' . $arParams["PAGE"] . "_" . $USER->GetID() . "_" . "_" . $arResult["User"]["ID"] . "_" . md5(serialize($arCacheKeys)) . "_" . intval(CSocNetUser::IsCurrentUserModuleAdmin());
 if ($arParams["CACHE_TIME"] > 0 && $groupCache->InitCache($arParams["CACHE_TIME"], $cacheId, $cachePath)) {
     $vars = $groupCache->GetVars();
     $arCacheResult = $vars["arCacheResult"];
 } else {
     if ($arParams["CACHE_TIME"] > 0 && defined("BX_COMP_MANAGED_CACHE")) {
         $GLOBALS["CACHE_MANAGER"]->StartTagCache($cachePath);
         $GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_user2group_U" . $GLOBALS["USER"]->GetID());
         $GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group");
     }
     $arGroupID = array();
     if (in_array($arParams["PAGE"], array("groups_list", "groups_subject")) || $arResult["CurrentUserPerms"] && $arResult["CurrentUserPerms"]["Operations"]["viewgroups"]) {
         $arNavParams = array("nPageSize" => $arParams["ITEMS_COUNT"], "bDescPageNumbering" => false);
         $arCacheResult["Urls"]["GroupsAdd"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_CREATE"], array("user_id" => $arResult["User"]["ID"]));
         $arCacheResult["Urls"]["LogGroups"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_LOG"], array());
         $arCacheResult["Urls"]["LogGroups"] .= (StrPos($arCacheResult["Urls"]["LogGroups"], "?") !== false ? "&" : "?") . "flt_entity_type=" . SONET_ENTITY_GROUP;
         $arCacheResult["CanViewLog"] = $arResult["User"]["ID"] == $GLOBALS["USER"]->GetID();
         $arCacheResult["Groups"] = false;
         $arGroupFilter = array("SITE_ID" => SITE_ID, "ACTIVE" => "Y");
         if (!CSocNetUser::IsCurrentUserModuleAdmin()) {
             $arGroupFilter["CHECK_PERMISSIONS"] = $GLOBALS["USER"]->GetID();
         }
         if (COption::GetOptionString("socialnetwork", "work_with_closed_groups", "N") != "Y" && $arResult["filter_tags"] != "Y") {
             $arGroupFilter["CLOSED"] = $arResult["filter_archive"] == "Y" ? "Y" : "N";
         }
         if (intval($arResult["filter_subject_id"]) > 0) {
             $arGroupFilter["SUBJECT_ID"] = $arResult["filter_subject_id"];
         }
         if (strlen($arResult["filter_name"]) > 0) {
             $arGroupFilter["%NAME"] = $arResult["filter_name"];
         }


问题


面经


文章

微信
公众号

扫码关注公众号