}
    set_exception_handler('wfeexception_handler');
    try {
        if ($ID > 0) {
            CBPWorkflowTemplateLoader::Update($ID, $arFields);
        } else {
            $ID = CBPWorkflowTemplateLoader::Add($arFields);
        }
    } catch (Exception $e) {
        wfeexception_handler($e);
    }
    restore_exception_handler();
    ?>
	<script type="text/javascript">
		window.location = '<?php 
    echo $_REQUEST["apply"] == "Y" ? Cutil::JSEscape("/bitrix/admin/" . MODULE_ID . "_bizproc_workflow_edit.php?lang=" . LANGUAGE_ID . "&entity=" . AddSlashes(ENTITY) . "&ID=" . $ID . "&back_url_list=" . urlencode($_REQUEST["back_url_list"])) : Cutil::JSEscape($back_url);
    ?>
';
	</script>
	<?php 
    die;
}
if ($_SERVER['REQUEST_METHOD'] == 'GET' && $_REQUEST['export_template'] == 'Y' && check_bitrix_sessid()) {
    $APPLICATION->RestartBuffer();
    if ($ID > 0) {
        $datum = CBPWorkflowTemplateLoader::ExportTemplate($ID);
        header("HTTP/1.1 200 OK");
        header("Content-Type: application/force-download; name=\"bp-" . $ID . ".bpt\"");
        header("Content-Transfer-Encoding: binary");
        header("Content-Length: " . (function_exists('mb_strlen') ? mb_strlen($datum, 'ISO-8859-1') : strlen($datum)));
        header("Content-Disposition: attachment; filename=\"bp-" . $ID . ".bpt\"");
Beispiel #2
0
         if ($res["AUTHOR_ID"] > 0) {
             if (!empty($arParams["URL_TEMPLATES_PROFILE_VIEW"])) {
                 $res["AUTHOR_URL"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["AUTHOR_ID"], "USER_ID" => $res["AUTHOR_ID"], "ID" => $res["AUTHOR_ID"]));
             }
             // avatar
             $id = $arParams['SHOW_AVATAR'] == 'Y' ? $res["AVATAR"] > 0 ? $res["AVATAR"] : $res["PERSONAL_PHOTO"] : ($arParams['SHOW_AVATAR'] == 'PHOTO' ? $res["PERSONAL_PHOTO"] : 0);
             if ($id > 0) {
                 $res["AVATAR"] = array("ID" => $id, "FILE" => CFile::ResizeImageGet($id, array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_EXACT, false));
                 if (!empty($res["AVATAR"]["FILE"])) {
                     $res["AVATAR"]["HTML"] = CFile::ShowImage($res["AVATAR"]["FILE"]['src'], 30, 30, "border=0 align='right'");
                 }
             }
         }
         /************** Author info/****************************************/
         // For quote JS
         $res["FOR_JS"] = array("AUTHOR_NAME" => Cutil::JSEscape($res["AUTHOR_NAME"]), "POST_MESSAGE_TEXT" => Cutil::JSEscape(htmlspecialcharsbx($res["POST_MESSAGE_TEXT"])));
         $arMessages[$res["ID"]] = $res;
     }
 }
 /************** Attach files ***************************************/
 if (!empty($arMessages)) {
     $res = array_keys($arMessages);
     $arFilter = array("FORUM_ID" => $arParams["FORUM_ID"], "TOPIC_ID" => $arResult["FORUM_TOPIC_ID"]);
     if ($arResult["USER"]["RIGHTS"]["MODERATE"] != "Y") {
         $arFilter["APPROVED"] = "Y";
     }
     $arFilterProps = $arFilter;
     if (min($res) > 1) {
         $arFilterProps[">ID"] = $arFilter[">MESSAGE_ID"] = intval(min($res) - 1);
     }
     $arFilterProps["<ID"] = $arFilter["<MESSAGE_ID"] = intval(max($res) + 1);
Beispiel #3
0
 public function SetTitle($className, $forHint = false)
 {
     if (!self::$optUse) {
         return false;
     }
     $arCodes = self::$codes->GetCodeByClassName($className);
     if (!is_array($arCodes)) {
         return false;
     }
     $retHtml = "";
     foreach ($arCodes as $arCode) {
         if (!$arCode["TITLE_OBJ"]) {
             continue;
         }
         $arHK = $this->GetByCodeID($arCode["ID"]);
         $space = $forHint ? "&nbsp;" : " ";
         if (!is_array($arHK)) {
             continue;
         }
         $retHtml .= "<script type='text/javascript'> var d = BX('" . $arCode["TITLE_OBJ"] . "'); if (!d) d=BX.findChild(document, {attribute: {'name': '" . $arCode["TITLE_OBJ"] . "'}}, true ); if(d) d.title+=' (" . $space . Cutil::JSEscape($this->ShowHKAsChar($arHK["KEYS_STRING"])) . $space . ") ';</script>";
     }
     return $retHtml;
 }
Beispiel #4
0
    ?>
': '<?php 
    echo Cutil::JSEscape($p["LDAP"]);
    ?>
'<?php 
}
?>
};
	var arMasName = {'_': '' <?php 
foreach ($arSyncFields as $k => $p) {
    ?>
, '<?php 
    echo Cutil::JSEscape($k);
    ?>
': '<?php 
    echo Cutil::JSEscape($p["NAME"]);
    ?>
'<?php 
}
?>
};

	function __UFChange(id)
	{
		var oSelect = document.getElementById("MAP["+id+"][USER]");
		var oInput =  document.getElementById("MAP["+id+"][LDAP]");
		var name = oSelect.value;
		oInput.value = arMas[name];
	}
	function __UFDel(id)
	{
Beispiel #5
0
			window.parent.document.getElementById("div_USER_ID").innerHTML='<i><?php 
        echo GetMessage("PM_NOT_FINED");
        ?>
</i>';
		<?php 
    } elseif ($arResult["SHOW_MODE"] == "light") {
        ?>
			window.parent.document.getElementById("div_USER_ID").innerHTML='<?php 
        echo GetMessage("PM_IS_FINED");
        ?>
';
		<?php 
    } elseif ($arResult["SHOW_MODE"] == "full") {
        ?>
			window.parent.document.getElementById("div_USER_ID").innerHTML='<?php 
        echo Cutil::JSEscape("[<a href=\"" . $arResult["profile_view"] . "\">" . htmlspecialchars($arResult["SHOW_NAME"]) . "</a>]");
        ?>
';
		<?php 
    } else {
        ?>
		opener.switcher='<?php 
        echo CUtil::JSEscape($arResult["SHOW_NAME"]);
        ?>
';
		var handler = opener.document.getElementById('USER_ID');
		if (handler)
			handler.value = '<?php 
        echo CUtil::JSEscape($arResult["UID"]);
        ?>
';
Beispiel #6
0
    if (!CFileMan::IsWindows()) {
        // $arGrActionAr["server_access"] = array(
        // "action" => "setAccess('".Cutil::JSEscape($site)."', '".Cutil::JSEscape($path)."', true)",
        // "value" => "server_access",
        // "name" => GetMessage('FILEMAN_ADMIN_ACCESS_PERMS')
        // );
    }
}
if ($USER->CanDoFileOperation('fm_create_new_' . $type, $arPath)) {
    //$arGrActionAr["copy"] = GetMessage("FILEMAN_ADM_COPY");
    $arGrActionAr["copy"] = array("action" => "setCopyMove('" . Cutil::JSEscape($site) . "', '" . Cutil::JSEscape($path) . "', true, " . CUtil::PhpToJSObject($arrIsDir) . ")", "value" => "copy", "name" => GetMessage("FILEMAN_ADM_COPY"));
    $arGrActionAr["pack"] = array("action" => "setPackUnpack('" . Cutil::JSEscape($site) . "', '" . Cutil::JSEscape($path) . "', true, " . CUtil::PhpToJSObject($arrIsDir) . ")", "value" => "pack", "name" => GetMessage("FILEMAN_ADMIN_ARC_PACK"));
}
if ($USER->CanDoFileOperation('fm_create_new_' . $type, $arPath) && $USER->CanDoFileOperation('fm_delete_' . $type, $arPath)) {
    //$arGrActionAr["move"] = GetMessage("FILEMAN_ADM_MOVE");
    $arGrActionAr["move"] = array("action" => "setCopyMove('" . Cutil::JSEscape($site) . "', '" . Cutil::JSEscape($path) . "', false, " . CUtil::PhpToJSObject($arrIsDir) . ")", "value" => "move", "name" => GetMessage("FILEMAN_ADM_MOVE"));
}
// if($USER->CanDoFileOperation('fm_create_new_'.$type, $arPath))
// {
// $arGrActionAr["copy2"] = array(
// "type" => "html",
// "value" => "&nbsp;".GetMessage("FILEMAN_ADMIN_IN")."&nbsp;"
// );
// $arGrActionAr["copy1"] = array(
// "type" => "html",
// "value" => $strHTML
// );
// }
if ($logical != "Y") {
    $lAdmin->AddGroupActionTable($arGrActionAr, array());
}
Beispiel #7
0
	}
	if ($bResult == true)
		$arGroups = __array_merge($arGroups, $res);
}
$arResult["GROUPS_FORUMS"] = $arGroups;
/************** Topics *********************************************/
if ($arResult["TID"] > 0)
{
	$res = CForumTopic::GetByIDEx($arResult["TID"]);
	if (!empty($res) && $res["STATE"] != "L" && !empty($arResult["FORUMS"][$res["FORUM_ID"]]))
	{
		$arResult["TOPIC"] = $res;
		$arResult["FORUM"] = $arResult["FORUMS"][$res["FORUM_ID"]];
		
		$arResult["TOPIC"]["~TITLE"] = $arResult["TOPIC"]["TITLE"];
		$arResult["TOPIC"]["TITLE"] = Cutil::JSEscape($arResult["TOPIC"]["TITLE"]);
		$arResult["TOPIC"]["LINK"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_READ"], 
			array("FID" => $arResult["FORUM"]["ID"], "TID" => $arResult["TOPIC"]["ID"], "MID" => "s"));
		$arResult["FORUM"]["LINK"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_LIST"], 
			array("FID" => $arResult["FORUM"]["ID"]));
	}
}
elseif (strlen($_REQUEST["search_template"]) > 0) 
{
	$arFilter = array("@FORUM_ID" => array_keys($arResult["FORUMS"]));
	if (intVal($_REQUEST["FID"]) > 0)
		$arFilter["FORUM_ID"] = intVal($_REQUEST["FID"]);
	if (($_REQUEST["search_field"] == "title") || ($_REQUEST["search_field"] == "description"))
		$arFilter[strToUpper($_REQUEST["search_field"])] = $_REQUEST["search_template"];
	else
		$arFilter["TITLE_ALL"] = $_REQUEST["search_template"];
Beispiel #8
0
						oRow = imgTable.insertRow(-1);
				}
				else
					oRow = imgTable.insertRow(-1);
				
				oRow.vAlign = 'top';

				oCell = oRow.insertCell(-1);
				oCell.vAlign = 'top';
				oCell.innerHTML = my_html;
				
				<?php 
                if ($_GET["htmlEditor"] == "Y") {
                    ?>
					var editorId = '<?php 
                    echo Cutil::JSEscape($_GET["editorId"]);
                    ?>
';
					if(editorId)
					{
						var pMainObj = window.opener.GLOBAL_pMainObj[editorId];
						if(pMainObj)
						{
							imageSrc = window.opener.document.getElementById(<?php 
                    echo $arResult["Image"]["ID"];
                    ?>
).src;
							_str = '<img __bxtagname="blogImage" __bxcontainer="<?php 
                    echo $arResult["Image"]["ID"];
                    ?>
" src="'+imageSrc+'">';
Beispiel #9
0
            echo Cutil::JSEscape(htmlspecialcharsbx($arBlock["EDIT_URL"]));
            ?>
'); return false;" title="<?php 
            echo GetMessage("BPWC_WICT_EDIT");
            ?>
"><span style="display:none">Edit</span></a><a rel="nofollow" href="javascript:if(confirm('<?php 
            echo GetMessage("BPWC_WICT_DELETE_PROMT");
            ?>
'))jsUtils.Redirect([], '<?php 
            echo Cutil::JSEscape(htmlspecialcharsbx($arBlock["DELETE_URL"]));
            ?>
')" class="bpcw-item-menu-delete" onclick="jsUtils.PreventDefault(event); if(confirm('<?php 
            echo GetMessage("BPWC_WICT_DELETE_PROMT");
            ?>
'))jsUtils.Redirect([], '<?php 
            echo Cutil::JSEscape(htmlspecialcharsbx($arBlock["DELETE_URL"]));
            ?>
'); return false;"  title="<?php 
            echo GetMessage("BPWC_WICT_DELETE");
            ?>
"><span style="display:none">Delete</span></a></div></div>
						<?php 
        }
        ?>

					<div class="bpcw-item-info-container">
						<div style="height:160px;">
						<?php 
        echo CFile::ShowImage($arBlock["PICTURE"], 150, 150, null, $arBlock["LIST_URL"]);
        ?>
						</div>
Beispiel #10
0
$arParams["SEO_USER"] = in_array($arParams["SEO_USER"], array("Y", "N", "TEXT")) ? $arParams["SEO_USER"] : "******";
$arParams["USER_TMPL"] = '<noindex><a rel="nofollow" href="#URL#" title="' . GetMessage("F_USER_PROFILE") . '">#NAME#</a></noindex>';
if ($arParams["SEO_USER"] == "N") {
    $arParams["USER_TMPL"] = '<a href="#URL#" title="' . GetMessage("F_USER_PROFILE") . '">#NAME#</a>';
} elseif ($arParams["SEO_USER"] == "TEXT") {
    $arParams["USER_TMPL"] = '#NAME#';
}
if ($arResult["SHOW_SELF_CLOSE"] == "Y") {
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><body>
<script type="text/javascript">
<?php 
    echo $_REQUEST["search_insert"] == "Y" ? "opener" : "top";
    ?>
.document.getElementById("div_USER_ID").innerHTML = '<?php 
    echo $arResult["SHOW_MODE"] == "none" ? "<i>" . GetMessageJS("PM_NOT_FINED") . "</i>" : ($arResult["SHOW_MODE"] == "light" ? GetMessageJS("PM_IS_FINED") : "[" . Cutil::JSEscape(str_replace(array("#URL#", "#NAME#"), array($arResult["profile_view"], $arResult["SHOW_NAME"]), $arParams["USER_TMPL"])) . "]");
    ?>
';
<?php 
    echo $_REQUEST["search_insert"] == "Y" ? "opener" : "top";
    ?>
.document.getElementById('USER_ID').value = '<?php 
    echo $arResult["UID"];
    ?>
';
self.close();
</script>
</body>
</html>
<?php 
    die;
Beispiel #11
0
			window.parent.document.getElementById("div_USER_ID").innerHTML='<i><?php 
        echo GetMessage("PM_NOT_FINED");
        ?>
</i>';
		<?php 
    } elseif ($arResult["SHOW_MODE"] == "light") {
        ?>
			window.parent.document.getElementById("div_USER_ID").innerHTML='<?php 
        echo GetMessage("PM_IS_FINED");
        ?>
';
		<?php 
    } elseif ($arResult["SHOW_MODE"] == "full") {
        ?>
			window.parent.document.getElementById("div_USER_ID").innerHTML='<?php 
        echo Cutil::JSEscape("[<a href=\"" . $arResult["profile_view"] . "\">" . $arResult["SHOW_NAME"] . "</a>]");
        ?>
';
		<?php 
    } else {
        ?>
		opener.switcher='<?php 
        echo $arResult["SHOW_NAME"];
        ?>
';
		var handler = opener.document.getElementById('USER_ID');
		if (handler)
			handler.value = '<?php 
        echo $arResult["UID"];
        ?>
';
Beispiel #12
0
            $arUser["Perms"] = CForumNew::GetUserPermission($arMessage["FORUM_ID"], $arUser["Groups"]);
            if ($arUser["Perms"] <= "Q" && COption::GetOptionString("forum", "SHOW_VOTES", "Y") == "Y") {
                $arUser["Rank"] = CForumUser::GetUserRank($arMessage["AUTHOR_ID"], LANGUAGE_ID);
            }
            if (intVal($arMessage["POINTS"]) > 0) {
                $arUser["Points"] = array("POINTS" => $arMessage["POINTS"], "DATE_UPDATE" => $arMessage["DATE_UPDATE"]);
            } else {
                $arUser["Points"] = false;
            }
            $UserInfo[$arMessage["AUTHOR_ID"]] = $arUser;
        } elseif ($arMessage["AUTHOR_ID"] > 0 && isset($UserInfo[$arMessage["AUTHOR_ID"]])) {
            $arUser = $UserInfo[$arMessage["AUTHOR_ID"]];
        }
        $arMessage["AUTHOR_ID"] = intVal($arMessage["AUTHOR_ID"]);
        $arMessage["FOR_JS"]["AUTHOR_NAME"] = Cutil::JSEscape(htmlspecialchars($arMessage["AUTHOR_NAME"]));
        $arMessage["FOR_JS"]["POST_MESSAGE"] = Cutil::JSEscape(htmlspecialchars($arMessage["POST_MESSAGE"]));
        ?>
<tr valign="top" class="forumbody">
			<td align="left" rowspan="2" width="140" class="forumbrd" style="border-right:none;">
				<a name="message<?php 
        echo $arMessage["ID"];
        ?>
"></a>
				<font class="forumbodytext"><b><?php 
        echo htmlspecialcharsEx($arMessage["AUTHOR_NAME"]);
        ?>
</b>
				<?php 
        if ($arMessage["AUTHOR_ID"] > 0) {
            if ($arUser["Perms"] == "Q") {
                echo "<br><font class=\"forumheadcolor\">" . GetMessage("FR_MODERATOR") . "</font>";
Beispiel #13
0
         }
         $res["AUTHOR_PHOTO"] = $arAvatars[$res["AUTHOR_ID"]];
         /************** Author info/*************************************** */
         // For quote JS
         $res["FOR_JS"]["AUTHOR_NAME"] = Cutil::JSEscape($res["AUTHOR_NAME"]);
         $res["FOR_JS"]["POST_MESSAGE_TEXT"] = Cutil::JSEscape(htmlspecialcharsbx($res["POST_MESSAGE_TEXT"]));
         $res["FOR_JS"]["POST_MESSAGE"] = Cutil::JSEscape(htmlspecialcharsbx($res["~POST_MESSAGE"]));
         // Forum store name of author permamently
         // When name of author changes => in comments we see old name
         // So, we just get dynamically name on every request (except cache)
         $res['AUTHOR_DYNAMIC_NAME_AS_ARRAY'] = false;
         $rc = CUser::GetByID($res['AUTHOR_ID']);
         if ($arDynName = $rc->Fetch()) {
             $res['AUTHOR_DYNAMIC_NAME_AS_ARRAY'] = array('LOGIN' => $arDynName['LOGIN'], 'NAME' => $arDynName['NAME'], 'SECOND_NAME' => $arDynName['SECOND_NAME'], 'LAST_NAME' => $arDynName['LAST_NAME']);
         }
         $res["FOR_JS"]["AUTHOR_DYNAMIC_NAME"] = Cutil::JSEscape(tasksFormatName($res['AUTHOR_DYNAMIC_NAME_AS_ARRAY']['NAME'], $res['AUTHOR_DYNAMIC_NAME_AS_ARRAY']['LAST_NAME'], $res['AUTHOR_DYNAMIC_NAME_AS_ARRAY']['LOGIN'], $res['AUTHOR_DYNAMIC_NAME_AS_ARRAY']['SECOND_NAME'], $arParams['NAME_TEMPLATE'], true));
         $arMessages[$res["ID"]] = $res;
     }
 }
 /*		 * ************ Attach files ************************************** */
 if (!empty($arMessages)) {
     $res = array_keys($arMessages);
     $arFilter = array("FORUM_ID" => $arParams["FORUM_ID"], "TOPIC_ID" => $arResult["FORUM_TOPIC_ID"], "APPROVED" => "Y", ">MESSAGE_ID" => intVal(min($res)) - 1, "<MESSAGE_ID" => intVal(max($res)) + 1);
     $db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), $arFilter);
     if ($db_files && ($res = $db_files->Fetch())) {
         do {
             $res["SRC"] = CFile::GetFileSRC($res);
             if ($arMessages[$res["MESSAGE_ID"]]["~ATTACH_IMG"] == $res["FILE_ID"]) {
                 // attach for custom
                 $arMessages[$res["MESSAGE_ID"]]["~ATTACH_FILE"] = $res;
                 $arMessages[$res["MESSAGE_ID"]]["ATTACH_IMG"] = CFile::ShowFile($res["FILE_ID"], 0, $arParams["IMAGE_SIZE"], $arParams["IMAGE_SIZE"], true, "border=0", false);
Beispiel #14
0
						$id,
						array("width" => 30, "height" => 30),
						BX_RESIZE_IMAGE_EXACT,
						false
					)
			);
			if (!empty($res["AVATAR"]["FILE"]))
				$res["AVATAR"]["HTML"] = CFile::ShowImage($res["AVATAR"]["FILE"]['src'], 30, 30, "border=0 align='right'");
		}
	}

/************** Author info/****************************************/
	// For quote JS
	$res["FOR_JS"] = array(
		"AUTHOR_NAME" => Cutil::JSEscape($res["AUTHOR_NAME"]),
		"POST_MESSAGE_TEXT" => Cutil::JSEscape(htmlspecialcharsbx($res["POST_MESSAGE_TEXT"]))
	);
	$arMessages[$res["ID"]] = $res;
			}
		}
/************** Attach files ***************************************/
		if (!empty($arMessages))
		{
			$res = array_keys($arMessages);

			$arFilter = array("FORUM_ID" => $arParams["FORUM_ID"], "TOPIC_ID" => $arResult["FORUM_TOPIC_ID"]);
			if ($arResult["USER"]["RIGHTS"]["MODERATE"] != "Y")
				$arFilter["APPROVED"] = "Y";
			$arFilterProps = $arFilter;
			if (min($res) > 1)
				$arFilterProps[">ID"] = $arFilter[">MESSAGE_ID"] = intval(min($res) - 1);
Beispiel #15
0
	public static function ShowParameterField($type, $name, $values, $arParams = Array())
	{
		/*
		"string" => "Строка",
		"text" => "Многострочный текст",
		"int" => "Целое число",
		"double" => "Число",
		"select" => "Список",
		"bool" => "Да/Нет",
		"date" => "Дата",
		"datetime" => "Дата/Время",
		"user" => "Пользователь",
		*/
		if(strlen($arParams['id'])>0)
			$id = $arParams['id'];
		else
			$id = md5(uniqid());

		if($type == "text")
		{
			$s = '<table><tr><td><textarea ';
			$s .= 'rows="'.($arParams['rows']>0?intval($arParams['rows']):5).'" ';
			$s .= 'cols="'.($arParams['cols']>0?intval($arParams['cols']):50).'" ';
			$s .= 'name="'.htmlspecialcharsbx($name).'" ';
			$s .= 'id="'.htmlspecialcharsbx($id).'" ';
			$s .= '>'.htmlspecialcharsbx($values);
			$s .= '</textarea></td>';
			$s .= '<td style="vertical-align: top !important"><input type="button" value="..." onclick="BPAShowSelector(\''.Cutil::JSEscape(htmlspecialcharsbx($id)).'\', \''.Cutil::JSEscape($type).'\');"></td></tr></table>';
		}
		elseif($type == "user")
		{
			$s = '<nobr><textarea onkeydown="if(event.keyCode==45)BPAShowSelector(\''.Cutil::JSEscape(htmlspecialcharsbx($id)).'\', \''.Cutil::JSEscape($type).'\');" ';
			$s .= 'rows="'.($arParams['rows']>0?intval($arParams['rows']):3).'" ';
			$s .= 'cols="'.($arParams['cols']>0?intval($arParams['cols']):45).'" ';
			$s .= 'name="'.htmlspecialcharsbx($name).'" ';
			$s .= 'id="'.htmlspecialcharsbx($id).'">'.htmlspecialcharsbx($values).'</textarea>';
			$s .= '<input type="button" value="..." title="'.GetMessage("BIZPROC_AS_SEL_FIELD_BUTTON").' (Insert)'.'" onclick="BPAShowSelector(\''.Cutil::JSEscape(htmlspecialcharsbx($id)).'\', \''.Cutil::JSEscape($type).'\');"></nobr>';
		}
		elseif($type == "bool")
		{
			$s = '<select name="'.htmlspecialcharsbx($name).'"><option value=""></option><option value="Y"'.($values=='Y'?' selected':'').'>'.GetMessage('MAIN_YES').'</option><option value="N"'.($values=='N'?' selected':'').'>'.GetMessage('MAIN_NO').'</option>';
			$s .= '<input type="text" ';
			$s .= 'size="20" ';
			$s .= 'name="'.htmlspecialcharsbx($name).'_X" ';
			$s .= 'id="'.htmlspecialcharsbx($id).'" ';
			$s .= 'value="'.($values=="Y" || $values=="N"?"":htmlspecialcharsbx($values)).'"> ';
			$s .= '<input type="button" value="..." onclick="BPAShowSelector(\''.Cutil::JSEscape(htmlspecialcharsbx($id)).'\', \''.Cutil::JSEscape($type).'\');">';
		}
		else
		{
			$s = '<input type="text" ';
			$s .= 'size="'.($arParams['size']>0?intval($arParams['size']):70).'" ';
			$s .= 'name="'.htmlspecialcharsbx($name).'" ';
			$s .= 'id="'.htmlspecialcharsbx($id).'" ';
			$s .= 'value="'.htmlspecialcharsbx($values).'"> ';
			$s .= '<input type="button" value="..." onclick="BPAShowSelector(\''.Cutil::JSEscape(htmlspecialcharsbx($id)).'\', \''.Cutil::JSEscape($type).'\');">';
		}

		return $s;
	}
Beispiel #16
0
    public function GetJSFunctionsForFields($parameterDocumentType, $objectName, $arDocumentFields = array(), $arDocumentFieldTypes = array())
    {
        if (!is_array($arDocumentFields) || count($arDocumentFields) <= 0) {
            $arDocumentFields = self::GetDocumentFields($parameterDocumentType);
        }
        if (!is_array($arDocumentFieldTypes) || count($arDocumentFieldTypes) <= 0) {
            $arDocumentFieldTypes = self::GetDocumentFieldTypes($parameterDocumentType);
        }
        list($moduleId, $entity, $documentType) = CBPHelper::ParseDocumentId($parameterDocumentType);
        if (strlen($moduleId) > 0) {
            CModule::IncludeModule($moduleId);
        }
        $documentFieldsString = "";
        foreach ($arDocumentFields as $fieldKey => $arFieldValue) {
            if (strlen($documentFieldsString) > 0) {
                $documentFieldsString .= ",";
            }
            $documentFieldsString .= "'" . Cutil::JSEscape($fieldKey) . "':{";
            $documentFieldsString .= "'Name':'" . CUtil::JSEscape($arFieldValue["Name"]) . "',";
            $documentFieldsString .= "'Type':'" . CUtil::JSEscape($arFieldValue["Type"]) . "',";
            $documentFieldsString .= "'Multiple':'" . CUtil::JSEscape($arFieldValue["Multiple"] ? "Y" : "N") . "',";
            $documentFieldsString .= "'Complex':'" . CUtil::JSEscape($arFieldValue["Complex"] ? "Y" : "N") . "',";
            $documentFieldsString .= "'Options':";
            if (array_key_exists("Options", $arFieldValue)) {
                if (is_array($arFieldValue["Options"])) {
                    $documentFieldsString .= "{";
                    $flTmp = false;
                    foreach ($arFieldValue["Options"] as $k => $v) {
                        if ($flTmp) {
                            $documentFieldsString .= ",";
                        }
                        $documentFieldsString .= "'" . CUtil::JSEscape($k) . "':'" . CUtil::JSEscape($v) . "'";
                        $flTmp = true;
                    }
                    $documentFieldsString .= "}";
                } else {
                    $documentFieldsString .= "'" . CUtil::JSEscape($arFieldValue["Options"]) . "'";
                }
            } else {
                $documentFieldsString .= "''";
            }
            $documentFieldsString .= "}";
        }
        $fieldTypesString = "";
        $ind = -1;
        foreach ($arDocumentFieldTypes as $typeKey => $arTypeValue) {
            $ind++;
            if (strlen($fieldTypesString) > 0) {
                $fieldTypesString .= ",";
            }
            $fieldTypesString .= "'" . CUtil::JSEscape($typeKey) . "':{";
            $fieldTypesString .= "'Name':'" . CUtil::JSEscape($arTypeValue["Name"]) . "',";
            $fieldTypesString .= "'BaseType':'" . CUtil::JSEscape($arTypeValue["BaseType"]) . "',";
            $fieldTypesString .= "'Complex':'" . CUtil::JSEscape($arTypeValue["Complex"] ? "Y" : "N") . "',";
            $fieldTypesString .= "'Index':" . $ind . "";
            $fieldTypesString .= "}";
        }
        $documentTypeString = CUtil::PhpToJSObject($parameterDocumentType);
        $bitrixSessId = bitrix_sessid();
        $result = <<<EOS
<script type="text/javascript">
var {$objectName} = {};

{$objectName}.arDocumentFields = { {$documentFieldsString} };
{$objectName}.arFieldTypes = { {$fieldTypesString} };

{$objectName}.AddField = function(fldCode, fldName, fldType, fldMultiple, fldOptions)
{
\tthis.arDocumentFields[fldCode] = {};
\tthis.arDocumentFields[fldCode]["Name"] = fldName;
\tthis.arDocumentFields[fldCode]["Type"] = fldType;
\tthis.arDocumentFields[fldCode]["Multiple"] = fldMultiple;
\tthis.arDocumentFields[fldCode]["Options"] = fldOptions;
}

{$objectName}._PrepareResponse = function(v)
{
\tv = v.replace(/^\\s+|\\s+\$/g, '');
\twhile (v.length > 0 && v.charCodeAt(0) == 65279)
\t\tv = v.substring(1);

\tif (v.length <= 0)
\t\treturn undefined;

\teval("v = " + v);

\treturn v;
}

{$objectName}.GetFieldInputControl4Type = function(type, value, name, subtypeFunctionName, func)
{
\tthis.GetFieldInputControlInternal(
\t\ttype,
\t\tvalue,
\t\tname,
\t\tfunction(v)
\t\t{
\t\t\tvar p = v.indexOf('<!--__defaultOptionsValue:');
\t\t\tif (p >= 0)
\t\t\t{
\t\t\t\tp = p + '<!--__defaultOptionsValue:'.length;
\t\t\t\tvar p1 = v.indexOf('-->', p);
\t\t\t\ttype['Options'] = v.substring(p, p1);
\t\t\t}

\t\t\tvar newPromt = "";

\t\t\tp = v.indexOf('<!--__modifyOptionsPromt:');
\t\t\tif (p >= 0)
\t\t\t{
\t\t\t\tp = p + '<!--__modifyOptionsPromt:'.length;
\t\t\t\tp1 = v.indexOf('-->', p);
\t\t\t\tnewPromt = v.substring(p, p1);
\t\t\t}

\t\t\tfunc(v, newPromt);
\t\t},
\t\tfalse,
\t\tsubtypeFunctionName,
\t\t'Type'
\t);
}

{$objectName}.GetFieldInputControl4Subtype = function(type, value, name, func)
{
\t{$objectName}.GetFieldInputControlInternal(type, value, name, func, false, '', '');
}

{$objectName}.GetFieldInputControl = function(type, value, name, func, als)
{
\t{$objectName}.GetFieldInputControlInternal(type, value, name, func, als, '', '');
}

{$objectName}.GetFieldInputControlInternal = function(type, value, name, func, als, subtypeFunctionName, mode)
{
\tif (typeof name == "undefined" || name.length <= 0)
\t\tname = "BPVDDefaultValue";

\tif (typeof type != "object")
\t\ttype = {'Type' : type, 'Multiple' : 0, 'Required' : 0, 'Options' : null};

\tif (typeof name != "object")
\t\tname = {'Field' : name, 'Form' : null};

\tBX.ajax.post(
\t\t'/bitrix/tools/bizproc_get_field.php',
\t\t{
\t\t\t'DocumentType' : {$documentTypeString},
\t\t\t'Field' : name,
\t\t\t'Value' : value,
\t\t\t'Type' : type,
\t\t\t'Als' : als ? 1 : 0,
\t\t\t'rnd' : Math.random(),
\t\t\t'Mode' : mode,
\t\t\t'Func' : subtypeFunctionName,
\t\t\t'sessid' : '{$bitrixSessId}'
\t\t},
\t\tfunc
\t);
}

{$objectName}.GetFieldValueByTagName = function(tag, name, form)
{
\tvar fieldValues = {};

\tvar ar;
\tif (form && (form.length > 0))
\t{
\t\tvar obj = document.getElementById(form);
\t\tif (!obj)
\t\t{
\t\t\tfor (var i in document.forms)
\t\t\t{
\t\t\t\tif (document.forms[i].name == form)
\t\t\t\t{
\t\t\t\t\tobj = document.forms[i];
\t\t\t\t\tbreak;
\t\t\t\t}
\t\t\t}
\t\t}

\t\tif (!obj)
\t\t\treturn;

\t\tar = obj.getElementsByTagName(tag);
\t}
\telse
\t{
\t\tar = document.getElementsByTagName(tag);
\t}

\tfor (var i in ar)
\t{
\t\tif (ar[i] && ar[i].name && (ar[i].name.length >= name.length) && (ar[i].name.substr(0, name.length) == name))
\t\t{
\t\t\tif (ar[i].type.substr(0, "select".length) == "select")
\t\t\t{
\t\t\t\tif (ar[i].multiple)
\t\t\t\t{
\t\t\t\t\tvar newName = ar[i].name.replace(/\\[\\]/g, "");
\t\t\t\t\tfor (var j = 0; j < ar[i].options.length; j++)
\t\t\t\t\t{
\t\t\t\t\t\tif (ar[i].options[j].selected)
\t\t\t\t\t\t{
\t\t\t\t\t\t\tif ((typeof(fieldValues[newName]) != 'object') || !(fieldValues[newName] instanceof Array))
\t\t\t\t\t\t\t{
\t\t\t\t\t\t\t\tif (fieldValues[newName])
\t\t\t\t\t\t\t\t\tfieldValues[newName] = [fieldValues[newName]];
\t\t\t\t\t\t\t\telse
\t\t\t\t\t\t\t\t\tfieldValues[newName] = [];
\t\t\t\t\t\t\t}
\t\t\t\t\t\t\tfieldValues[newName][fieldValues[newName].length] = ar[i].options[j].value;
\t\t\t\t\t\t}
\t\t\t\t\t}
\t\t\t\t}
\t\t\t\telse
\t\t\t\t{
\t\t\t\t\tif (ar[i].selectedIndex >= 0)
\t\t\t\t\t\tfieldValues[ar[i].name] = ar[i].options[ar[i].selectedIndex].value;
\t\t\t\t}
\t\t\t}
\t\t\telse
\t\t\t{
\t\t\t\tif (ar[i].name.indexOf("[]", 0) >= 0)
\t\t\t\t{
\t\t\t\t\tvar newName = ar[i].name.replace(/\\[\\]/g, "");

\t\t\t\t\tif ((typeof(fieldValues[newName]) != 'object') || !(fieldValues[newName] instanceof Array))
\t\t\t\t\t{
\t\t\t\t\t\tif (fieldValues[newName])
\t\t\t\t\t\t\tfieldValues[newName] = [fieldValues[newName]];
\t\t\t\t\t\telse
\t\t\t\t\t\t\tfieldValues[newName] = [];
\t\t\t\t\t}

\t\t\t\t\tfieldValues[newName][fieldValues[newName].length] = ar[i].value;
\t\t\t\t}
\t\t\t\telse
\t\t\t\t{
\t\t\t\t\tfieldValues[ar[i].name] = ar[i].value;
\t\t\t\t}
\t\t\t}
\t\t}
\t}

\treturn fieldValues;
}

{$objectName}.GetFieldInputValue = function(type, name, func)
{
\tif (typeof name == "undefined" || name.length <= 0)
\t\tname = "BPVDDefaultValue";

\tif (typeof type != "object")
\t\ttype = {'Type' : type, 'Multiple' : 0, 'Required' : 0, 'Options' : null};

\tif (typeof name != "object")
\t\tname = {'Field' : name, 'Form' : null};

\tvar s = {
\t\t'DocumentType' : {$documentTypeString},
\t\t'Field' : name,
\t\t'Type' : type,
\t\t'rnd' : Math.random(),
\t\t'sessid' : '{$bitrixSessId}'
\t};

\tif (type != null && type['Type'] != "F")
\t{
\t\tvar ar = this.GetFieldValueByTagName('input', name['Field'], name['Form']);
\t\tfor (var v in ar)
\t\t\ts[v] = ar[v];
\t\tar = this.GetFieldValueByTagName('select', name['Field'], name['Form']);
\t\tfor (var v in ar)
\t\t\ts[v] = ar[v];
\t\tar = this.GetFieldValueByTagName('textarea', name['Field'], name['Form']);
\t\tfor (var v in ar)
\t\t\ts[v] = ar[v];
\t\tar = this.GetFieldValueByTagName('hidden', name['Field'], name['Form']);
\t\tfor (var v in ar)
\t\t\ts[v] = ar[v];
\t}

\tBX.ajax.post('/bitrix/tools/bizproc_set_field.php', s, function(v){v = {$objectName}._PrepareResponse(v); func(v);});
}

{$objectName}.HtmlSpecialChars = function(string, quote)
{
\tstring = string.toString();
\tstring = string.replace(/&/g, '&amp;');
\tstring = string.replace(/</g, '&lt;');
\tstring = string.replace(/>/g, '&gt;');
\tstring = string.replace(/"/g, '&quot;');

\tif (quote)
\t\tstring = string.replace(/'/g, '&#039;');

\treturn string;
}

{$objectName}.GetGUITypeEdit = function(type)
{
\treturn "";
}

{$objectName}.SetGUITypeEdit = function(type)
{
\treturn "";
}

function __dump_bx(arr, limitLevel, txt)
{
\tif (limitLevel == undefined)
\t\tlimitLevel = 3;
\tif (txt == undefined)
\t\ttxt = "";
\telse
\t\ttxt += ":\\n";
\talert(txt+__dumpInternal_bx(arr, 0, limitLevel));
}
function __dumpInternal_bx(arr, level, limitLevel) {
\tvar dumped_text = "";
\tif(!level) level = 0;
\tif (level > limitLevel)
\t\treturn "";
\tvar level_padding = "";
\tfor(var j=0;j<level+1;j++) level_padding += "    ";
\tif(typeof(arr) == 'object') {
\t\tfor(var item in arr) {
\t\t\tvar value = arr[item];
\t\t\tif(typeof(value) == 'object') {
\t\t\t\tdumped_text += level_padding + "'" + item + "' ...\\n";
\t\t\t\tdumped_text += __dumpInternal_bx(value, level+1, limitLevel);
\t\t\t} else {
\t\t\t\tdumped_text += level_padding + "'" + item + "' => '" + value + "'\\n";
\t\t\t}
\t\t}
\t} else {
\t\tdumped_text = "===>"+arr+"<===("+typeof(arr)+")";
\t}

\treturn dumped_text;
}

</script>
EOS;
        if (class_exists($entity) && method_exists($entity, "GetJSFunctionsForFields")) {
            $result .= call_user_func_array(array($entity, "GetJSFunctionsForFields"), array($documentType, $objectName, $arDocumentFields, $arDocumentFieldTypes));
        } else {
            if (!is_array($arDocumentFields) || count($arDocumentFields) <= 0) {
                $arDocumentFields = $this->GetDocumentFields($parameterDocumentType);
            }
            if (!is_array($arDocumentFieldTypes) || count($arDocumentFieldTypes) <= 0) {
                $arDocumentFieldTypes = $this->GetDocumentFieldTypes($parameterDocumentType);
            }
            $result .= CBPHelper::GetJSFunctionsForFields($objectName, $arDocumentFields, $arDocumentFieldTypes);
        }
        return $result;
    }
Beispiel #17
0
		<script>
			<?php 
        if (!empty($arResult["Image"])) {
            ?>
			var imgTable = top.BX('blog-post-image');
			if (imgTable)
			{
				imgTable.innerHTML += '<div class="blog-post-image-item"><div class="blog-post-image-item-border"><?php 
            echo $arResult["ImageModified"];
            ?>
</div>' +
				'<div class="blog-post-image-item-input"><input name=IMAGE_ID_title[<?php 
            echo $arResult["Image"]["ID"];
            ?>
] value="<?php 
            echo Cutil::JSEscape($arResult["Image"]["TITLE"]);
            ?>
"></div>' +
				'<div><input type=checkbox name=IMAGE_ID_del[<?php 
            echo $arResult["Image"]["ID"];
            ?>
] id=img_del_<?php 
            echo $arResult["Image"]["ID"];
            ?>
> <label for=img_del_<?php 
            echo $arResult["Image"]["ID"];
            ?>
><?php 
            echo GetMessage("BLOG_DELETE");
            ?>
</label></div></div>';
Beispiel #18
0
             $bVote = $bVote ? $bVote : $GLOBALS["APPLICATION"]->GetGroupRight("forum") >= "W";
             $arUData["VOTING"] = $bVote ? "VOTE" : ($bUnVote ? "UNVOTE" : "N");
         }
         // data
         $arUData["DATE_REG"] = CForumFormat::DateFormat($arParams["DATE_FORMAT"], MakeTimeStamp($res["DATE_REG"], CSite::GetDateFormat()));
         // Another data
         $arUData["DESCRIPTION"] = $parser->wrap_long_words($res["DESCRIPTION"]);
         if (!empty($res["SIGNATURE"])) {
             $arUData["SIGNATURE"] = $parser->convert($res["~SIGNATURE"], array_merge($arAllow, array("SMILES" => "N")));
         }
         $UserInfo[$res["AUTHOR_ID"]] = $arUData;
     }
     $res = array_merge($res, $UserInfo[$res["AUTHOR_ID"]]);
 }
 $res["FOR_JS"]["AUTHOR_NAME"] = Cutil::JSEscape(htmlspecialcharsbx($res["~AUTHOR_NAME"]));
 $res["FOR_JS"]["POST_MESSAGE"] = Cutil::JSEscape(htmlspecialcharsbx($res["~POST_MESSAGE_TEXT"]));
 /************** Author info/****************************************/
 /************** Panels *********************************************/
 $res["PANELS"] = array("MODERATE" => $arResult["PANELS"]["MODERATE"], "DELETE" => $arResult["PANELS"]["DELETE"], "SUPPORT" => $arResult["PANELS"]["SUPPORT"] == "Y" && $res["AUTHOR_ID"] > 0 ? "Y" : "N", "EDIT" => $arResult["PANELS"]["EDIT"], "STATISTIC" => $arResult["PANELS"]["STATISTIC"] == "Y" && intVal($res["GUEST_ID"]) > 0 ? "Y" : "N", "MAIN" => $arResult["PANELS"]["MAIN"] == "Y" && $res["AUTHOR_ID"] > 0 ? "Y" : "N", "MAIL" => $arResult["PANELS"]["MAIL"], "VOTES" => $res["VOTING"] != "N" ? "Y" : "N");
 // here should be a trigger for turning off edit right for the archive group even for message author
 if ($arResult["USER"]["RIGHTS"]["ADD_MESSAGE"] == "Y" && $res["PANELS"]["EDIT"] != "Y" && $USER->IsAuthorized() && $res["AUTHOR_ID"] == $USER->GetId() && (COption::GetOptionString("forum", "USER_EDIT_OWN_POST", "N") == "Y" || $arResult["TOPIC"]["iLAST_TOPIC_MESSAGE"] == intVal($res["ID"]))) {
     $res["PANELS"]["EDIT"] = "Y";
 }
 $res["SHOW_PANEL"] = in_array("Y", $res["PANELS"]) ? "Y" : "N";
 if ($arParams["PERMISSION_ORIGINAL"] >= "Q") {
     $bIP = preg_match("/^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\$/", $res["~AUTHOR_IP"]) ? true : false;
     $res["AUTHOR_IP"] = $bIP ? GetWhoisLink($res["~AUTHOR_IP"], "") : $res["AUTHOR_IP"];
     $bIP = preg_match("/^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\$/", $res["~AUTHOR_REAL_IP"]) ? true : false;
     $res["AUTHOR_REAL_IP"] = $bIP ? GetWhoisLink($res["~AUTHOR_REAL_IP"], "") : $res["AUTHOR_REAL_IP"];
     $res["IP_IS_DIFFER"] = $res["AUTHOR_IP"] != $res["AUTHOR_REAL_IP"] ? "Y" : "N";
 }
Beispiel #19
0
		"value" => "copy",
		"name" => GetMessage("FILEMAN_ADM_COPY")
	);

	$arGrActionAr["pack"] = array(
		"action" => "setPackUnpack('".Cutil::JSEscape($site)."', '".Cutil::JSEscape($path)."', true)",
		"value" => "pack",
		"name" => GetMessage("FILEMAN_ADMIN_ARC_PACK"),
	);
}

if($USER->CanDoFileOperation('fm_create_new_'.$type, $arPath) && $USER->CanDoFileOperation('fm_delete_'.$type,$arPath))
{
	//$arGrActionAr["move"] = GetMessage("FILEMAN_ADM_MOVE");
	$arGrActionAr["move"] = array(
		"action" => "setCopyMove('".Cutil::JSEscape($site)."', '".Cutil::JSEscape($path)."', false)",
		"value" => "move",
		"name" => GetMessage("FILEMAN_ADM_MOVE")
	);
}

// if($USER->CanDoFileOperation('fm_create_new_'.$type, $arPath))
// {
	// $arGrActionAr["copy2"] = array(
		// "type" => "html",
		// "value" => "&nbsp;".GetMessage("FILEMAN_ADMIN_IN")."&nbsp;"
	// );
	// $arGrActionAr["copy1"] = array(
		// "type" => "html",
		// "value" => $strHTML
	// );