Ejemplo n.º 1
0
	function blogTextParser($strLang = False, $pathToSmile = false)
	{
		$this->CTextParser();
		global $CACHE_MANAGER;
		if ($strLang===False)
			$strLang = LANGUAGE_ID;

		if(strlen($pathToSmile) <= 0)
			$pathToSmile = "/bitrix/images/blog/smile/";
		$this->pathToSmile = $pathToSmile;
		$this->imageWidth = COption::GetOptionString("blog", "image_max_width", 600);
		$this->imageHeight = COption::GetOptionString("blog", "image_max_height", 1000);
		$this->showedImages = array();
		$this->ajaxPage = $GLOBALS["APPLICATION"]->GetCurPageParam("", array("bxajaxid", "logout"));
		$this->blogImageSizeEvents = GetModuleEvents("blog", "BlogImageSize", true);
		$this->arUserfields = array();
		$arSmiles = array();

		$this->smiles = array();
		if($CACHE_MANAGER->Read(60*60*24*365, "b_blog_smile"))
		{
			$arSmiles = $CACHE_MANAGER->Get("b_blog_smile");
		}
		else
		{
			$db_res = CBlogSmile::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" => $tok,
										"IMAGE"  => stripslashes($res["IMAGE"]),
										"DESCRIPTION" => stripslashes($res["NAME"]));
					$tok = strtok(" ");
				}
			}

			function sortlen($a, $b) 
			{
				if (strlen($a["TYPING"]) == strlen($b["TYPING"]))
					return 0;

				return (strlen($a["TYPING"]) > strlen($b["TYPING"])) ? -1 : 1;
			}

			if(!empty($arSmiles))
			{
				foreach ($arSmiles as $LID => $arSmilesLID)
				{
					uasort($arSmilesLID, 'sortlen');
					$arSmiles[$LID] = $arSmilesLID;
				}
			}

			$CACHE_MANAGER->Set("b_blog_smile", $arSmiles);
		}
		$this->smiles = $arSmiles[$strLang];
	}
Ejemplo n.º 2
0
     $Vars = $cache->GetVars();
     foreach ($Vars["arResult"] as $k => $v) {
         if (!array_key_exists($k, $arResult)) {
             $arResult[$k] = $v;
         }
     }
     CBitrixComponentTemplate::ApplyCachedData($Vars["templateCachedData"]);
     $cache->Output();
 } else {
     if ($arParams["CACHE_TIME"] > 0) {
         $cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path);
     }
     $arResult["CommentsResult"] = array();
     $arSelectFields = array("ID", "SMILE_TYPE", "TYPING", "IMAGE", "DESCRIPTION", "CLICKABLE", "SORT", "IMAGE_WIDTH", "IMAGE_HEIGHT", "LANG_NAME");
     $arSmiles = array();
     $res = CBlogSmile::GetList(array("SORT" => "ASC", "ID" => "DESC"), array("SMILE_TYPE" => "S", "LANG_LID" => LANGUAGE_ID), false, false, $arSelectFields);
     while ($arr = $res->GetNext()) {
         list($type) = explode(" ", $arr["TYPING"]);
         $arr["TYPE"] = str_replace("'", "\\'", $type);
         $arr["TYPE"] = str_replace("\\", "\\\\", $arr["TYPE"]);
         $arSmiles[] = $arr;
     }
     $arResult["Smiles"] = $arSmiles;
     if (IntVal($arParams["ID"]) > 0) {
         $arOrder = array("ID" => "ASC", "DATE_CREATE" => "ASC");
         $arFilter = array("POST_ID" => $arParams["ID"]);
         if ($arResult["Perm"] < BLOG_PERMS_MODERATE || !$arResult["IDEA_MODERATOR"]) {
             $arFilter["PUBLISH_STATUS"] = BLOG_PUBLISH_STATUS_PUBLISH;
         }
         $arSelectedFields = array("ID", "BLOG_ID", "POST_ID", "PARENT_ID", "AUTHOR_ID", "AUTHOR_NAME", "AUTHOR_EMAIL", "AUTHOR_IP", "AUTHOR_IP1", "TITLE", "POST_TEXT", "DATE_CREATE", "PUBLISH_STATUS");
         $dbComment = CBlogComment::GetList($arOrder, array_merge($extFilter, $arFilter), false, false, $arSelectedFields);
Ejemplo n.º 3
0
	function InstallDB($install_wizard = true)
	{
		global $DB, $DBType, $APPLICATION, $install_smiles;

		if (!$DB->Query("SELECT 'x' FROM b_blog_user_group", true))
		{
			$errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/blog/install/".$DBType."/install.sql");
			COption::SetOptionString("blog", "socNetNewPerms", "Y");
		}

		if (empty($errors))
		{
			$errors = $this->InstallUserFields();
		}

		if (!empty($errors))
		{
			$APPLICATION->ThrowException(implode("", $errors));
			return false;
		}

		RegisterModule("blog");
		RegisterModuleDependences("search", "OnReindex", "blog", "CBlogSearch", "OnSearchReindex");
		RegisterModuleDependences("main", "OnUserDelete", "blog", "CBlogUser", "Delete");
		RegisterModuleDependences("main", "OnSiteDelete", "blog", "CBlogSitePath", "DeleteBySiteID");

		RegisterModuleDependences("socialnetwork", "OnSocNetGroupDelete", "blog", "CBlogSoNetPost", "OnGroupDelete");

		RegisterModuleDependences("socialnetwork", "OnSocNetFeaturesAdd", "blog", "CBlogSearch", "SetSoNetFeatureIndexSearch");
		RegisterModuleDependences("socialnetwork", "OnSocNetFeaturesUpdate", "blog", "CBlogSearch", "SetSoNetFeatureIndexSearch");
		RegisterModuleDependences("socialnetwork", "OnSocNetFeaturesPermsAdd", "blog", "CBlogSearch", "SetSoNetFeaturePermIndexSearch");
		RegisterModuleDependences("socialnetwork", "OnSocNetFeaturesPermsUpdate", "blog", "CBlogSearch", "SetSoNetFeaturePermIndexSearch");

		RegisterModuleDependences("main", "OnAfterAddRating", 	"blog", "CRatingsComponentsBlog", "OnAfterAddRating", 200);
		RegisterModuleDependences("main", "OnAfterUpdateRating", "blog", "CRatingsComponentsBlog", "OnAfterUpdateRating", 200);
		RegisterModuleDependences("main", "OnSetRatingsConfigs", "blog", "CRatingsComponentsBlog", "OnSetRatingConfigs", 200);
		RegisterModuleDependences("main", "OnGetRatingsConfigs", "blog", "CRatingsComponentsBlog", "OnGetRatingConfigs", 200);
		RegisterModuleDependences("main", "OnGetRatingsObjects", "blog", "CRatingsComponentsBlog", "OnGetRatingObject", 200);

		RegisterModuleDependences("main", "OnGetRatingContentOwner", "blog", "CRatingsComponentsBlog", "OnGetRatingContentOwner", 200);
		RegisterModuleDependences("im", "OnGetNotifySchema", "blog", "CBlogNotifySchema", "OnGetNotifySchema");

		RegisterModuleDependences("main", "OnAfterRegisterModule", "main", "blog", "installUserFields", 100, "/modules/blog/install/index.php"); // check UF

		RegisterModuleDependences('conversion', 'OnGetCounterTypes' , 'blog', '\Bitrix\Blog\Internals\ConversionHandlers', 'onGetCounterTypes');
		RegisterModuleDependences('conversion', 'OnGetRateTypes' , 'blog', '\Bitrix\Blog\Internals\ConversionHandlers', 'onGetRateTypes');
		RegisterModuleDependences('blog', 'OnPostAdd', 'blog', '\Bitrix\Blog\Internals\ConversionHandlers', 'onPostAdd');

		CModule::IncludeModule("blog");
		if (CModule::IncludeModule("search"))
			CSearch::ReIndexModule("blog");

		if($install_smiles == "Y" || $install_wizard)
		{
			$dbSmile = CBlogSmile::GetList();
			if(!($dbSmile->Fetch()))
			{

				$arSmile = Array(
					Array(
						"TYPING" => ":D :-D",
						"IMAGE" => "icon_biggrin.png",
						"FICON_SMILE" => "FICON_BIGGRIN",
						"SORT" => "120",
					),
					Array(
						"TYPING" => ":) :-)",
						"IMAGE" => "icon_smile.png",
						"FICON_SMILE" => "FICON_SMILE",
						"SORT" => "100",
					),
					Array(
						"TYPING" => ":( :-(",
						"IMAGE" => "icon_sad.png",
						"FICON_SMILE" => "FICON_SAD",
						"SORT" => "140",
					),
					Array(
						"TYPING" => ":o :-o :shock:",
						"IMAGE" => "icon_eek.png",
						"FICON_SMILE" => "FICON_EEK",
						"SORT" => "180",
					),
					Array(
						"TYPING" => "8) 8-)",
						"IMAGE" => "icon_cool.png",
						"FICON_SMILE" => "FICON_COOL",
						"SORT" => "130",
					),
					Array(
						"TYPING" => ":{} :-{}",
						"IMAGE" => "icon_kiss.png",
						"FICON_SMILE" => "FICON_KISS",
						"SORT" => "200",
					),
					Array(
						"TYPING" => ":oops:",
						"IMAGE" => "icon_redface.png",
						"FICON_SMILE" => "FICON_REDFACE",
						"SORT" => "190",
					),
					Array(
						"TYPING" => ":cry: :~(",
						"IMAGE" => "icon_cry.png",
						"FICON_SMILE" => "FICON_CRY",
						"SORT" => "160",
					),
					Array(
						"TYPING" => ":evil: >:-<",
						"IMAGE" => "icon_evil.png",
						"FICON_SMILE" => "FICON_EVIL",
						"SORT" => "170",
					),
					Array(
						"TYPING" => ";) ;-)",
						"IMAGE" => "icon_wink.png",
						"FICON_SMILE" => "FICON_WINK",
						"SORT" => "110",
					),
					Array(
						"TYPING" => ":!:",
						"IMAGE" => "icon_exclaim.png",
						"FICON_SMILE" => "FICON_EXCLAIM",
						"SORT" => "220",
					),
					Array(
						"TYPING" => ":?:",
						"IMAGE" => "icon_question.png",
						"FICON_SMILE" => "FICON_QUESTION",
						"SORT" => "210",
					),
					Array(
						"TYPING" => ":idea:",
						"IMAGE" => "icon_idea.png",
						"FICON_SMILE" => "FICON_IDEA",
						"SORT" => "230",
					),
					Array(
						"TYPING" => ":| :-|",
						"IMAGE" => "icon_neutral.png",
						"FICON_SMILE" => "FICON_NEUTRAL",
						"SORT" => "150",
					),
				);
				$arLang = Array();
				$dbLangs = CLanguage::GetList(($b = ""), ($o = ""), array("ACTIVE" => "Y"));
				while ($arLangs = $dbLangs->Fetch())
				{
					IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/blog/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["IMAGE_WIDTH"] = 16;
					$val["IMAGE_HEIGHT"] = 16;

					$id = CBlogSmile::Add($val);
				}

			}
		}

		return true;
	}
Ejemplo n.º 4
0
</b>
					</td>
					<td class="blogtablebody">
						<table cellspacing=0 cellpadding=0 border=0>
						<tr>
							<td width=100%><textarea name="POST_MESSAGE" style="width:100%" rows=15 id=MESSAGE><?php 
            echo htmlspecialchars($POST_MESSAGE);
            ?>
</textarea></td>
							<td valign=middle>
								<table style="border:1px solid gray;margin-left:10px" cellspacing=5 cellpadding=0  border=0>
									<?php 
            $arSelectFields = array("ID", "SMILE_TYPE", "TYPING", "IMAGE", "DESCRIPTION", "CLICKABLE", "SORT", "IMAGE_WIDTH", "IMAGE_HEIGHT", "LANG_NAME");
            $total = 0;
            $arSmiles = array();
            $res = CBlogSmile::GetList($arOrder = array("SORT" => "ASC", "ID" => "DESC"), $arFilter = array("SMILE_TYPE" => "S", "CLICKABLE" => "Y", "LANG_LID" => LANGUAGE_ID), $arGroupBy = false, $arNavStartParams = false, $arSelectFields);
            while ($arr = $res->Fetch()) {
                $total++;
                $arSmiles[] = $arr;
            }
            $cols = ceil($total / 10);
            for ($i = 0; $i < count($arSmiles); $i++) {
                if ($i == 0) {
                    print "<tr>";
                } elseif ($i % $cols == 0) {
                    print "\n</tr>\n<tr>";
                }
                list($type) = explode(" ", $arSmiles[$i]['TYPING']);
                $type = str_replace("'", "\\'", $type);
                print "\n<td align=center><img src='/bitrix/images/blog/smile/{$arSmiles[$i]['IMAGE']}' width='{$arSmiles[$i]['IMAGE_WIDTH']}' height='{$arSmiles[$i]['IMAGE_HEIGHT']}' title='{$arSmiles[$i]['LANG_NAME']}' OnClick=\"emoticon('{$type}')\" style='cursor:pointer'></td>";
            }
Ejemplo n.º 5
0
                $strErrorMessage .= GetMessage("ERROR_ADD_SMILE") . ". \n";
            }
        }
    }
    if (strlen($strErrorMessage) > 0) {
        $bInitVars = True;
    }
    if (strlen($save) > 0 && strlen($strErrorMessage) <= 0) {
        LocalRedirect("blog_smile.php?lang=" . LANG . "&" . GetFilterParams("filter_", false));
    }
}
$str_SORT = 150;
$str_TYPING = "";
ClearVars("str_");
if ($ID > 0) {
    $db_smile = CBlogSmile::GetList(array(), array("ID" => $ID));
    $db_smile->ExtractFields("str_", True);
}
if ($bInitVars) {
    $DB->InitTableVarsForEdit("b_blog_smile", "", "str_");
}
$sDocTitle = $ID > 0 ? GetMessage("BLOG_EDIT_RECORD", array("#ID#" => $ID)) : GetMessage("BLOG_NEW_RECORD");
$APPLICATION->SetTitle($sDocTitle);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
/*********************************************************************/
/********************  BODY  *****************************************/
/*********************************************************************/
?>

<?php 
$aMenu = array(array("TEXT" => GetMessage("FSN_2FLIST"), "LINK" => "/bitrix/admin/blog_smile.php?lang=" . LANG . "&" . GetFilterParams("filter_", false), "ICON" => "btn_list"));
Ejemplo n.º 6
0
                        $strDirNameOld = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/images/blog/";
                        if ($arOldSmile["SMILE_TYPE"] == "I") {
                            $strDirNameOld .= "icon";
                        } else {
                            $strDirNameOld .= "smile";
                        }
                        $strDirNameOld .= "/" . $arOldSmile["IMAGE"];
                        @unlink($strDirNameOld);
                    }
                }
                $DB->Commit();
                break;
        }
    }
}
$dbResultList = CBlogSmile::GetList(array($by => $order), $arFilter);
$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("BLOG_NAME"), "sort" => "", "default" => true), array("id" => "TYPING", "content" => GetMessage("BLOG_TYPING"), "sort" => "", "default" => true), array("id" => "ICON", "content" => GetMessage("BLOG_SMILE_ICON"), "sort" => "", "default" => true)));
$arVisibleColumns = $lAdmin->GetVisibleHeaderColumns();
// построение списка
while ($arBlog = $dbResultList->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arBlog);
    $row->AddField("ID", '<a href="/bitrix/admin/blog_smile_edit.php?ID=' . $f_ID . '&lang=' . LANGUAGE_ID . '" title="' . GetMessage("BLOG_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)) {
Ejemplo n.º 7
0
 function GetSmilesList()
 {
     $cache = new CPHPCache();
     $cache_id = "blog_smiles_" . LANGUAGE_ID;
     $cache_path = "/blog/smiles/";
     $arParams["CACHE_TIME"] = 60 * 60 * 24 * 30;
     if ($arParams["CACHE_TIME"] > 0 && $cache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path)) {
         $Vars = $cache->GetVars();
         $arSmiles = $Vars["arResult"];
     } else {
         if ($arParams["CACHE_TIME"] > 0) {
             $cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path);
         }
         $arSelectFields = array("ID", "SMILE_TYPE", "TYPING", "IMAGE", "DESCRIPTION", "CLICKABLE", "SORT", "IMAGE_WIDTH", "IMAGE_HEIGHT", "LANG_NAME");
         $arSmiles = array();
         $res = CBlogSmile::GetList(array("SORT" => "ASC", "ID" => "DESC"), array("SMILE_TYPE" => "S", "LANG_LID" => LANGUAGE_ID), false, false, $arSelectFields);
         while ($arr = $res->GetNext()) {
             list($type) = explode(" ", $arr["TYPING"]);
             $arr["TYPE"] = str_replace("'", "\\'", $type);
             $arr["TYPE"] = str_replace("\\", "\\\\", $arr["TYPE"]);
             $arSmiles[] = $arr;
         }
         if ($arParams["CACHE_TIME"] > 0) {
             $cache->EndDataCache(array("arResult" => $arSmiles));
         }
     }
     return $arSmiles;
 }