function CSocNetTextParser($strLang = False, $pathToSmile = false) { global $DB, $CACHE_MANAGER; static $arSmiles = array(); $this->smiles = array(); if ($strLang === False) { $strLang = LANGUAGE_ID; } $this->path_to_smile = $pathToSmile; if ($CACHE_MANAGER->Read(604800, "b_sonet_smile")) { $arSmiles = $CACHE_MANAGER->Get("b_sonet_smile"); } else { $db_res = CSocNetSmile::GetList(array("SORT" => "ASC"), array("SMILE_TYPE" => "S"), false, false, array("LANG_LID", "ID", "IMAGE", "DESCRIPTION", "TYPING", "SMILE_TYPE", "SORT")); while ($res = $db_res->Fetch()) { $tok = strtok($res['TYPING'], " "); while ($tok !== false) { $arSmiles[$res['LANG_LID']][] = array('TYPING' => $tok, 'IMAGE' => stripslashes($res['IMAGE']), 'DESCRIPTION' => stripslashes($res['NAME'])); $tok = strtok(" "); } } function sonet_sortlen($a, $b) { if (strlen($a["TYPING"]) == strlen($b["TYPING"])) { return 0; } return strlen($a["TYPING"]) > strlen($b["TYPING"]) ? -1 : 1; } foreach ($arSmiles as $LID => $arSmilesLID) { uasort($arSmilesLID, 'sonet_sortlen'); $arSmiles[$LID] = $arSmilesLID; } $CACHE_MANAGER->Set("b_sonet_smile", $arSmiles); } $this->smiles = $arSmiles[$strLang]; }
public function CSocNetTextParser($strLang = False, $pathToSmile = false) { global $DB, $CACHE_MANAGER; if ($strLang===False) $strLang = LANGUAGE_ID; $this->path_to_smile = $pathToSmile; $this->smiles = array(); if($CACHE_MANAGER->Read(604800, "b_sonet_smile")) { $arSmiles = $CACHE_MANAGER->Get("b_sonet_smile"); } else { $db_res = CSocNetSmile::GetList(array("SORT" => "ASC"), array("SMILE_TYPE" => "S"/*, "LANG_LID" => $strLang*/), false, false, Array("LANG_LID", "ID", "IMAGE", "DESCRIPTION", "TYPING", "SMILE_TYPE", "SORT")); while ($res = $db_res->Fetch()) { $tok = strtok($res['TYPING'], " "); while ($tok) { $arSmiles[$res['LANG_LID']][] = array('TYPING' => stripslashes($tok), 'IMAGE' => stripslashes($res['IMAGE']), 'DESCRIPTION'=>stripslashes($res['NAME'])); $tok = strtok(" "); } } $CACHE_MANAGER->Set("b_sonet_smile", $arSmiles); } $this->smiles = $arSmiles[$strLang]; }
function Update($ID, $arFields) { global $DB, $CACHE_MANAGER; $ID = IntVal($ID); if ($ID <= 0) { return False; } if (!CSocNetSmile::CheckFields("UPDATE", $arFields)) { return false; } $strUpdate = $DB->PrepareUpdate("b_sonet_smile", $arFields); $strSql = "UPDATE b_sonet_smile SET " . $strUpdate . " WHERE ID = " . $ID; $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__); if (is_set($arFields, "LANG")) { $DB->Query("DELETE FROM b_sonet_smile_lang WHERE SMILE_ID = " . $ID . ""); for ($i = 0; $i < count($arFields["LANG"]); $i++) { $arInsert = $DB->PrepareInsert("b_sonet_smile_lang", $arFields["LANG"][$i]); $strSql = "INSERT INTO b_sonet_smile_lang(SMILE_ID, " . $arInsert[0] . ") " . "VALUES(" . $ID . ", " . $arInsert[1] . ")"; $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__); } } $CACHE_MANAGER->Clean("b_sonet_smile"); return $ID; }
$strNameFormatted = CUser::FormatName($arParams['NAME_TEMPLATE'], $arUser, $bUseLogin); $arResult["Friends"][] = array("USER_ID" => $arUser["ID"], "USER_NAME" => $arUser["NAME"], "USER_LAST_NAME" => $arUser["LAST_NAME"], "USER_SECOND_NAME" => $arUser["SECOND_NAME"], "USER_LOGIN" => $arUser["LOGIN"], "USER_NAME_FORMATTED" => $strNameFormatted, "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "PATH_TO_MESSAGES_CHAT" => str_replace("#user_id#", $arUser["ID"], $arParams["PATH_TO_MESSAGES_CHAT"]), "IS_ONLINE" => $arUser["IS_ONLINE"] == "Y"); } } //Recent users $arResult["RecentUsers"] = array(); $arNavParams = array("nPageSize" => 20, "bDescPageNumbering" => false); $dbMessages = CSocNetMessages::GetMessagesUsers($GLOBALS["USER"]->GetID(), $arNavParams); while ($arMessages = $dbMessages->GetNext()) { $pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arMessages["ID"])); $canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arMessages["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin()); $arTmpUser = array("NAME" => $arMessages["~NAME"], "LAST_NAME" => $arMessages["~LAST_NAME"], "SECOND_NAME" => $arMessages["~SECOND_NAME"], "LOGIN" => $arMessages["~LOGIN"]); $strNameFormatted = CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin); $arResult["RecentUsers"][] = array("USER_ID" => $arMessages["ID"], "USER_NAME" => $arMessages["NAME"], "USER_LAST_NAME" => $arMessages["LAST_NAME"], "USER_SECOND_NAME" => $arMessages["SECOND_NAME"], "USER_LOGIN" => $arMessages["LOGIN"], "USER_NAME_FORMATTED" => $strNameFormatted, "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "PATH_TO_MESSAGES_CHAT" => str_replace("#user_id#", $arMessages["ID"], $arParams["PATH_TO_MESSAGES_CHAT"]), "IS_ONLINE" => $arMessages["IS_ONLINE"] == "Y"); } $arResult["PrintSmilesList"] = CSocNetSmile::PrintSmilesList(0, LANGUAGE_ID, $arParams["PATH_TO_SMILE"]); $strNow = CSocNetMessages::Now(); $strNow_ts = MakeTimeStamp($strNow, "YYYY-MM-DD HH:MI:SS") + CTimeZone::GetOffset(); $arResult["Now"] = date("Y-m-d H:i:s", $strNow_ts); //user options require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/" . strtolower($GLOBALS['DB']->type) . "/favorites.php"; $arResult["USER_OPTIONS"] = CUserOptions::GetOption('socnet', 'chat', array()); if ($arResult["USER_OPTIONS"]["sound"] != "N") { $arResult["USER_OPTIONS"]["sound"] = "Y"; } if ($arResult["USER_OPTIONS"]["contacts"] != "Y") { $arResult["USER_OPTIONS"]["contacts"] = "N"; } $arResult["USER_OPTIONS"]["contacts_width"] = intval($arResult["USER_OPTIONS"]["contacts_width"]); $dirPath = '/bitrix/components/bitrix/socialnetwork.messages_chat'; $arResult["MsgAddPath"] = $dirPath . "/add_message.php";
public static function PrintSmilesList($num_cols, $strLang = False, $strPath2Icons = False, $cacheTime = False) { $res_str = ""; $arSmile = array(); $return_array = intVal($num_cols) > 0 ? false : true; if ($strLang === False) { $strLang = LANGUAGE_ID; } if ($strPath2Icons === False) { $strPath2Icons = "/bitrix/images/socialnetwork/smile/"; } $cache = new CPHPCache(); $cache_id = "socialnetwork_smiles_" . $strLang . preg_replace("/[^a-z0-9]/is", "_", $strPath2Icons); $cache_path = "/" . SITE_ID . "/socialnetwork/smiles/"; if ($cacheTime > 0 && $cache->InitCache($cacheTime, $cache_id, $cache_path)) { $res = $cache->GetVars(); $arSmile = $res["arSmile"]; } if (empty($arSmile)) { $db_res = CSocNetSmile::GetList(array("SORT" => "ASC"), array("TYPE" => "S", "LID" => LANGUAGE_ID)); if ($db_res && ($res = $db_res->Fetch())) { do { $arSmile[] = $res; } while ($res = $db_res->Fetch()); } if ($cacheTime > 0) { $cache->StartDataCache($cacheTime, $cache_id, $cache_path); $cache->EndDataCache(array("arSmile" => $arSmile)); } } if ($return_array) { return $arSmile; } $res_str = ""; $ind = 0; foreach ($arSmile as $res) { if ($ind == 0) { $res_str .= "<tr align=\"center\">"; } $res_str .= "<td width=\"" . IntVal(100 / $num_cols) . "%\">"; $strTYPING = strtok($res['TYPING'], " "); $res_str .= "<img src=\"" . $strPath2Icons . $res['IMAGE'] . "\" alt=\"" . $res['NAME'] . "\" title=\"" . $res['NAME'] . "\" border=\"0\""; if (IntVal($res['IMAGE_WIDTH']) > 0) { $res_str .= " width=\"" . $res['IMAGE_WIDTH'] . "\""; } if (IntVal($res['IMAGE_HEIGHT']) > 0) { $res_str .= " height=\"" . $res['IMAGE_HEIGHT'] . "\""; } $res_str .= " onclick=\"if(emoticon){emoticon('" . $strTYPING . "');}\" name=\"smile\" id='" . $strTYPING . "' "; $res_str .= "/> </td>\n"; $ind++; if ($ind >= $num_cols) { $ind = 0; $res_str .= "</tr>"; } } if ($ind < $num_cols) { for ($i = 0; $i < $num_cols - $ind; $i++) { $res_str .= "<td> </td>"; } } return $res_str; }
$dbResultList = new CAdminResult($dbResultList, $sTableID); $dbResultList->NavStart(); // установке параметров списка $lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("PAGES"))); // заголовок списка $lAdmin->AddHeaders(array(array("id" => "ID", "content" => GetMessage("SMILE_ID"), "sort" => "ID", "default" => true), array("id" => "SORT", "content" => GetMessage("SMILE_SORT"), "sort" => "SORT", "default" => true), array("id" => "SMILE_TYPE", "content" => GetMessage('SMILE_TYPE'), "sort" => "SMILE_TYPE", "default" => true), array("id" => "NAME", "content" => GetMessage("SONET_NAME"), "sort" => "", "default" => true), array("id" => "TYPING", "content" => GetMessage("SONET_TYPING"), "sort" => "", "default" => true), array("id" => "ICON", "content" => GetMessage("SONET_SMILE_ICON"), "sort" => "", "default" => true))); $arVisibleColumns = $lAdmin->GetVisibleHeaderColumns(); // построение списка while ($arSocNet = $dbResultList->NavNext(true, "f_")) { $row =& $lAdmin->AddRow($f_ID, $arSocNet); $row->AddField("ID", '<a href="/bitrix/admin/socnet_smile_edit.php?ID=' . $f_ID . '&lang=' . LANGUAGE_ID . '" title="' . GetMessage("SONET_EDIT_DESCR") . '">' . $f_ID . '</a>'); $row->AddField("SORT", $f_SORT); $row->AddField("SMILE_TYPE", $f_SMILE_TYPE == "I" ? GetMessage("SMILE_TYPE_ICON") : GetMessage("SMILE_TYPE_SMILE")); $fieldShow = ""; if (in_array("NAME", $arVisibleColumns)) { $arSmileLang = CSocNetSmile::GetLangByID($f_ID, LANG); $fieldShow .= htmlspecialcharsbx($arSmileLang["NAME"]); } $row->AddField("NAME", $fieldShow); $row->AddField("TYPING", $f_TYPING); $row->AddField("ICON", "<img src=\"/bitrix/images/socialnetwork/" . ($f_SMILE_TYPE == "I" ? "icon" : "smile") . "/" . $f_IMAGE . "\" border=\"0\" " . (IntVal($f_IMAGE_WIDTH) > 0 ? "width=\"" . $f_IMAGE_WIDTH . "\"" : "") . " " . (IntVal($f_IMAGE_WIDTH) > 0 ? "height=\"" . $f_IMAGE_HEIGHT . "\"" : "") . ">"); $arActions = array(); if ($sonetModulePermissions >= "R") { $arActions[] = array("ICON" => "edit", "TEXT" => GetMessage("SONET_EDIT_DESCR"), "ACTION" => $lAdmin->ActionRedirect("socnet_smile_edit.php?ID=" . $f_ID . "&lang=" . LANG . "&" . GetFilterParams("filter_") . ""), "DEFAULT" => true); } if ($sonetModulePermissions >= "W") { $arActions[] = array("SEPARATOR" => true); $arActions[] = array("ICON" => "delete", "TEXT" => GetMessage("SONET_DELETE_DESCR"), "ACTION" => "if(confirm('" . GetMessage('SMILE_DEL_CONF') . "')) " . $lAdmin->ActionDoGroup($f_ID, "delete")); } $row->AddActions($arActions); }
$arResult["GET_COMMENTS"] = $bGetComments ? "Y" : "N"; $arResult["CURRENT_PAGE_DATE"] = $current_page_date; $arResult["Smiles"] = array(); if (!isset($arResult["FatalError"])) { if (CModule::IncludeModule("forum")) { $arResult["Smiles"] = CForumSmile::GetByType("S", LANGUAGE_ID); foreach ($arResult["Smiles"] as $i => $arSmile) { list($type) = explode(" ", $arSmile["TYPING"]); $arResult["Smiles"][$i]["TYPE"] = str_replace("'", "\\'", $type); $arResult["Smiles"][$i]["TYPE"] = str_replace("\\", "\\\\", $arResult["Smiles"][$i]["TYPE"]); $arResult["Smiles"][$i]["IMAGE"] = "/bitrix/images/forum/smile/" . $arSmile["IMAGE"]; } } else { if ($GLOBALS["CACHE_MANAGER"]->Read(604800, "b_sonet_smile_" . LANGUAGE_ID)) { $arResult["Smiles"] = $GLOBALS["CACHE_MANAGER"]->Get("b_sonet_smile_" . LANGUAGE_ID); } else { $arResult["Smiles"] = array(); $rsSmile = CSocNetSmile::GetList(array("SORT" => "ASC"), array("SMILE_TYPE" => "S", "LANG_LID" => LANGUAGE_ID), false, false, array("ID", "IMAGE", "DESCRIPTION", "TYPING", "SMILE_TYPE", "SORT", "LANG_NAME")); while ($arSmile = $rsSmile->Fetch()) { list($type) = explode(" ", $arSmile["TYPING"]); $arSmile["TYPE"] = str_replace("'", "\\'", $type); $arSmile["TYPE"] = str_replace("\\", "\\\\", $arSmile["TYPE"]); $arSmile["NAME"] = $arSmile["LANG_NAME"]; $arSmile["IMAGE"] = "/bitrix/images/socialnetwork/smile/" . $arSmile["IMAGE"]; $arResult["Smiles"][] = $arSmile; } $GLOBALS["CACHE_MANAGER"]->Set("b_sonet_smile_" . LANGUAGE_ID, $arResult["Smiles"]); } } } $this->IncludeComponentTemplate();
function InstallDB($install_wizard = true) { global $DB, $DBType, $APPLICATION, $install_smiles; if (!$DB->Query("SELECT 'x' FROM b_sonet_group", true)) { $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/socialnetwork/install/db/" . $DBType . "/install.sql"); } if (!empty($errors)) { $APPLICATION->ThrowException(implode("", $errors)); return false; } RegisterModule("socialnetwork"); RegisterModuleDependences("search", "OnBeforeFullReindexClear", "socialnetwork", "CSocNetSearchReindex", "OnBeforeFullReindexClear"); RegisterModuleDependences("search", "OnBeforeIndexDelete", "socialnetwork", "CSocNetSearchReindex", "OnBeforeIndexDelete"); RegisterModuleDependences("search", "OnReindex", "socialnetwork", "CSocNetSearch", "OnSearchReindex"); RegisterModuleDependences("search", "OnSearchCheckPermissions", "socialnetwork", "CSocNetSearch", "OnSearchCheckPermissions"); RegisterModuleDependences("search", "OnBeforeIndexUpdate", "socialnetwork", "CSocNetSearch", "OnBeforeIndexUpdate"); RegisterModuleDependences("search", "OnAfterIndexAdd", "socialnetwork", "CSocNetSearch", "OnAfterIndexAdd"); RegisterModuleDependences("search", "OnSearchPrepareFilter", "socialnetwork", "CSocNetSearch", "OnSearchPrepareFilter"); RegisterModuleDependences("main", "OnUserDelete", "socialnetwork", "CSocNetUser", "OnUserDelete"); RegisterModuleDependences("main", "OnBeforeUserUpdate", "socialnetwork", "CSocNetUser", "OnBeforeUserUpdate"); RegisterModuleDependences("main", "OnAfterUserUpdate", "socialnetwork", "CSocNetUser", "OnAfterUserUpdate"); RegisterModuleDependences("main", "OnAfterUserAdd", "socialnetwork", "CSocNetUser", "OnAfterUserAdd"); RegisterModuleDependences("main", "OnAfterUserLogout", "socialnetwork", "CSocNetUser", "OnAfterUserLogout"); RegisterModuleDependences("main", "OnBeforeProlog", "main", "", "", 100, "/modules/socialnetwork/prolog_before.php"); RegisterModuleDependences("main", "OnBeforeLangDelete", "socialnetwork", "CSocNetGroup", "OnBeforeLangDelete"); RegisterModuleDependences("socialnetwork", "OnSocNetLogFormatEvent", "socialnetwork", "CSocNetLog", "OnSocNetLogFormatEvent"); RegisterModuleDependences("photogallery", "OnAfterUpload", "socialnetwork", "CSocNetLogTools", "OnAfterPhotoUpload"); RegisterModuleDependences("photogallery", "OnAfterPhotoDrop", "socialnetwork", "CSocNetLogTools", "OnAfterPhotoDrop"); RegisterModuleDependences("photogallery", "OnBeforeSectionDrop", "socialnetwork", "CSocNetLogTools", "OnBeforeSectionDrop"); RegisterModuleDependences("photogallery", "OnAfterSectionDrop", "socialnetwork", "CSocNetLogTools", "OnAfterSectionDrop"); RegisterModuleDependences("photogallery", "OnAfterSectionEdit", "socialnetwork", "CSocNetLogTools", "OnAfterSectionEdit"); RegisterModuleDependences("main", "OnAuthProvidersBuildList", "socialnetwork", "CSocNetGroupAuthProvider", "GetProviders"); RegisterModuleDependences("im", "OnBeforeConfirmNotify", "socialnetwork", "CSocNetUserToGroup", "OnBeforeConfirmNotify"); RegisterModuleDependences("im", "OnBeforeConfirmNotify", "socialnetwork", "CSocNetUserRelations", "OnBeforeConfirmNotify"); RegisterModuleDependences("im", "OnGetNotifySchema", "socialnetwork", "CSocNetNotifySchema", "OnGetNotifySchema"); RegisterModuleDependences("pull", "OnGetDependentModule", "socialnetwork", "CSocNetPullSchema", "OnGetDependentModule"); RegisterModuleDependences("extranet", "OnUserInitialize", "socialnetwork", "CSocNetUser", "OnUserInitialize"); RegisterModuleDependences("blog", "OnBlogDelete", "socialnetwork", "CSocNetLogComments", "OnBlogDelete", 100); RegisterModuleDependences("blog", "OnBlogDelete", "socialnetwork", "CSocNetLog", "OnBlogDelete", 200); RegisterModuleDependences("blog", "OnBlogPostMentionNotifyIm", "socialnetwork", "CSocNetLogFollow", "OnBlogPostMentionNotifyIm"); CAgent::AddAgent("CSocNetMessages::SendEventAgent();", "socialnetwork", "N", 600); CAgent::AddAgent("CSocNetLog::ClearOldAgent();", "socialnetwork", "N", 43200); $arUserOptions = CUserOptions::GetOption("intranet", "~gadgets_sonet_user", false, 0); if (!is_array($arUserOptions) || count($arUserOptions) <= 0) { $sOptions = 'a:1:{s:7:"GADGETS";a:10:{s:18:"SONET_USER_LINKS@1";a:4:{s:6:"COLUMN";i:0;s:3:"ROW";i:0;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:20:"SONET_USER_FRIENDS@2";a:4:{s:6:"COLUMN";i:0;s:3:"ROW";i:1;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:21:"SONET_USER_BIRTHDAY@3";a:4:{s:6:"COLUMN";i:0;s:3:"ROW";i:2;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:19:"SONET_USER_GROUPS@4";a:4:{s:6:"COLUMN";i:0;s:3:"ROW";i:3;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:17:"SONET_USER_HEAD@5";a:4:{s:6:"COLUMN";i:0;s:3:"ROW";i:4;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:19:"SONET_USER_HONOUR@6";a:4:{s:6:"COLUMN";i:0;s:3:"ROW";i:5;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:20:"SONET_USER_ABSENCE@7";a:4:{s:6:"COLUMN";i:0;s:3:"ROW";i:6;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:17:"SONET_USER_DESC@8";a:4:{s:6:"COLUMN";i:1;s:3:"ROW";i:0;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}s:22:"SONET_USER_ACTIVITY@21";a:3:{s:6:"COLUMN";i:1;s:3:"ROW";i:1;s:4:"HIDE";s:1:"N";}s:7:"TASKS@9";a:4:{s:6:"COLUMN";i:1;s:3:"ROW";i:2;s:8:"USERDATA";N;s:4:"HIDE";s:1:"N";}}}'; $arOptions = unserialize($sOptions); CUserOptions::SetOption("intranet", "~gadgets_sonet_user", $arOptions, false, 0); $sOptions = 'a:1:{s:7:"GADGETS";a:7:{s:18:"SONET_GROUP_DESC@1";a:3:{s:6:"COLUMN";i:0;s:3:"ROW";i:0;s:4:"HIDE";s:1:"N";}s:16:"UPDATES_ENTITY@9";a:3:{s:6:"COLUMN";i:0;s:3:"ROW";i:1;s:4:"HIDE";s:1:"N";}s:7:"TASKS@4";a:3:{s:6:"COLUMN";i:0;s:3:"ROW";i:2;s:4:"HIDE";s:1:"N";}s:18:"SONET_GROUP_TAGS@5";a:3:{s:6:"COLUMN";i:0;s:3:"ROW";i:3;s:4:"HIDE";s:1:"N";}s:19:"SONET_GROUP_LINKS@6";a:3:{s:6:"COLUMN";i:1;s:3:"ROW";i:0;s:4:"HIDE";s:1:"N";}s:19:"SONET_GROUP_USERS@7";a:3:{s:6:"COLUMN";i:1;s:3:"ROW";i:1;s:4:"HIDE";s:1:"N";}s:18:"SONET_GROUP_MODS@8";a:3:{s:6:"COLUMN";i:1;s:3:"ROW";i:2;s:4:"HIDE";s:1:"N";}}}'; $arOptions = unserialize($sOptions); CUserOptions::SetOption("intranet", "~gadgets_sonet_group", $arOptions, false, 0); } $this->__SetLogFilter(); CModule::IncludeModule("socialnetwork"); if (CModule::IncludeModule("search")) { CSearch::ReIndexModule("socialnetwork"); } if ($install_smiles == "Y" || $install_wizard) { $dbSmile = CSocNetSmile::GetList(); if (!$dbSmile->Fetch()) { $arSmile = array(array("TYPING" => ":D :-D", "IMAGE" => "icon_biggrin.gif", "FICON_SMILE" => "FICON_BIGGRIN"), array("TYPING" => ":) :-)", "IMAGE" => "icon_smile.gif", "FICON_SMILE" => "FICON_SMILE"), array("TYPING" => ":( :-(", "IMAGE" => "icon_sad.gif", "FICON_SMILE" => "FICON_SAD"), array("TYPING" => ":o :-o :shock:", "IMAGE" => "icon_eek.gif", "FICON_SMILE" => "FICON_EEK"), array("TYPING" => "8) 8-)", "IMAGE" => "icon_cool.gif", "FICON_SMILE" => "FICON_COOL"), array("TYPING" => ":{} :-{}", "IMAGE" => "icon_kiss.gif", "FICON_SMILE" => "FICON_KISS"), array("TYPING" => ":oops:", "IMAGE" => "icon_redface.gif", "FICON_SMILE" => "FICON_REDFACE"), array("TYPING" => ":cry: :~(", "IMAGE" => "icon_cry.gif", "FICON_SMILE" => "FICON_CRY"), array("TYPING" => ":evil: >:-<", "IMAGE" => "icon_evil.gif", "FICON_SMILE" => "FICON_EVIL"), array("TYPING" => ";) ;-)", "IMAGE" => "icon_wink.gif", "FICON_SMILE" => "FICON_WINK"), array("TYPING" => ":!:", "IMAGE" => "icon_exclaim.gif", "FICON_SMILE" => "FICON_EXCLAIM"), array("TYPING" => ":?:", "IMAGE" => "icon_question.gif", "FICON_SMILE" => "FICON_QUESTION"), array("TYPING" => ":idea:", "IMAGE" => "icon_idea.gif", "FICON_SMILE" => "FICON_IDEA"), array("TYPING" => ":| :-|", "IMAGE" => "icon_neutral.gif", "FICON_SMILE" => "FICON_NEUTRAL")); $arLang = array(); $dbLangs = CLanguage::GetList($b = "", $o = "", array("ACTIVE" => "Y")); while ($arLangs = $dbLangs->Fetch()) { IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/socialnetwork/install/smiles.php", $arLangs["LID"]); foreach ($arSmile as $key => $val) { $arSmile[$key]["LANG"][] = array("LID" => $arLangs["LID"], "NAME" => GetMessage($val["FICON_SMILE"])); } } foreach ($arSmile as $val) { $val["SMILE_TYPE"] = "S"; $val["CLICKABLE"] = "Y"; $val["SORT"] = 150; $val["IMAGE_WIDTH"] = 16; $val["IMAGE_HEIGHT"] = 16; $id = CSocNetSmile::Add($val); } } } return true; }
/<?php echo $f_IMAGE; ?> " border="0" <?php echo IntVal($f_IMAGE_WIDTH) > 0 ? "width=\"" . $f_IMAGE_WIDTH . "\"" : ""; ?> <?php echo IntVal($f_IMAGE_WIDTH) > 0 ? "height=\"" . $f_IMAGE_HEIGHT . "\"" : ""; ?> ></div><?php } ?> </td> </tr><?php for ($i = 0; $i < count($arSysLangs); $i++) { $arSmileLang = CSocNetSmile::GetLangByID($ID, $arSysLangs[$i]); $str_NAME = htmlspecialcharsbx($arSmileLang["NAME"]); $str_DESCRIPTION = htmlspecialcharsbx($arSmileLang["DESCRIPTION"]); if ($bInitVars) { $str_NAME = htmlspecialcharsbx(${"NAME_" . $arSysLangs[$i]}); $str_DESCRIPTION = htmlspecialcharsbx(${"DESCRIPTION_" . $arSysLangs[$i]}); } ?> <tr class="heading"> <td colspan="2">[<?php echo $arSysLangs[$i]; ?> ] <?php echo $arSysLangNames[$i]; ?> </td>
function logTextParser($strLang = False, $pathToSmile = false) { $this->CTextParser(); global $CACHE_MANAGER; $this->MaxStringLen = 0; $this->smiles = array(); if ($strLang === False) $strLang = LANGUAGE_ID; $this->pathToSmile = $pathToSmile; if($CACHE_MANAGER->Read(604800, "b_sonet_smile")) $arSmiles = $CACHE_MANAGER->Get("b_sonet_smile"); else { $db_res = CSocNetSmile::GetList(array("SORT" => "ASC"), array("SMILE_TYPE" => "S"/*, "LANG_LID" => $strLang*/), false, false, Array("LANG_LID", "ID", "IMAGE", "DESCRIPTION", "TYPING", "SMILE_TYPE", "SORT")); while ($res = $db_res->Fetch()) { $tok = strtok($res['TYPING'], " "); while ($tok !== false) { $arSmiles[$res['LANG_LID']][] = array( 'TYPING' => $tok, 'IMAGE' => stripslashes($res['IMAGE']), // stripslashes is not needed here 'DESCRIPTION' => stripslashes($res['NAME']) // stripslashes is not needed here ); $tok = strtok(" "); } } function sonet_sortlen($a, $b) { if (strlen($a["TYPING"]) == strlen($b["TYPING"])) return 0; return (strlen($a["TYPING"]) > strlen($b["TYPING"])) ? -1 : 1; } foreach ($arSmiles as $LID => $arSmilesLID) { uasort($arSmilesLID, 'sonet_sortlen'); $arSmiles[$LID] = $arSmilesLID; } $CACHE_MANAGER->Set("b_sonet_smile", $arSmiles); } $this->smiles = $arSmiles[$strLang]; AddEventHandler("main", "TextParserAfterTags", Array(&$this, "ParserUser")); }