Beispiel #1
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("blog")) {
    return;
}
$dbGroup = CBlogGroup::GetList(array("ID" => "ASC"), array("SITE_ID" => WIZARD_SITE_ID));
if ($arGroup = $dbGroup->Fetch()) {
    if (WIZARD_B24_TO_CP) {
        $groupID = $arGroup["ID"];
        CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/index.php", array("BLOG_GROUP_ID" => $groupID));
        CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/index_b24.php", array("BLOG_GROUP_ID" => $groupID));
        CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/contacts/personal.php", array("BLOG_GROUP_ID" => $groupID));
        CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/workgroups/index.php", array("BLOG_GROUP_ID" => $groupID));
    }
    return;
}
CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "contacts/personal/user/#user_id#/blog/", "TYPE" => "B"));
CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "contacts/personal/user/#user_id#/blog/#post_id#/", "TYPE" => "P"));
CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "contacts/personal/user/#user_id#/", "TYPE" => "U"));
CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "workgroups/group/#group_id#/blog/", "TYPE" => "G"));
CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "workgroups/group/#group_id#/blog/#post_id#/", "TYPE" => "H"));
$groupID = CBlogGroup::Add(array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("BLOG_SOCNET_GROUP_EXTRANET_NAME")));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/index.php", array("BLOG_GROUP_ID" => $groupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/index_b24.php", array("BLOG_GROUP_ID" => $groupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/contacts/personal.php", array("BLOG_GROUP_ID" => $groupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/workgroups/index.php", array("BLOG_GROUP_ID" => $groupID));
Beispiel #2
0
             } else {
                 CBlogSitePath::Add(array("SITE_ID" => $arSite["LID"], "PATH" => ${"SITE_PATH_" . $arSite["LID"] . "_" . $type}, "TYPE" => $type));
             }
         }
         unset($arPaths[$arSite["LID"]]);
         if (strlen(${"SITE_PATH_" . $arSite["LID"]}) > 0) {
             ${"SITE_PATH_" . $arSite["LID"]} = "/" . trim(str_replace("\\", "/", ${"SITE_PATH_" . $arSite["LID"]}), "/");
         }
         if (array_key_exists($arSite["LID"], $arPathsNullType)) {
             if (strlen(${"SITE_PATH_" . $arSite["LID"]}) > 0) {
                 CBlogSitePath::Update($arPathsNullType[$arSite["LID"]], array("PATH" => ${"SITE_PATH_" . $arSite["LID"]}));
             } else {
                 CBlogSitePath::Delete($arPathsNullType[$arSite["LID"]]);
             }
         } else {
             CBlogSitePath::Add(array("SITE_ID" => $arSite["LID"], "PATH" => ${"SITE_PATH_" . $arSite["LID"]}));
         }
         unset($arPathsNullType[$arSite["LID"]]);
     }
     foreach ($arPaths as $key) {
         foreach ($key as $val) {
             CBlogSitePath::Delete($val);
         }
     }
 }
 if (strlen($strWarning) > 0) {
     CAdminMessage::ShowMessage($strWarning);
 }
 $aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("BLO_TAB_SET"), "ICON" => "blog_settings", "TITLE" => GetMessage("BLO_TAB_SET_ALT")), array("DIV" => "edit2", "TAB" => GetMessage("BLO_TAB_RIGHTS"), "ICON" => "blog_settings", "TITLE" => GetMessage("BLO_TAB_RIGHTS_ALT")));
 $tabControl = new CAdminTabControl("tabControl", $aTabs);
 $tabControl->Begin();
Beispiel #3
0
COption::SetOptionString('blog', 'allow_html', 'Y');
$APPLICATION->SetGroupRight("blog", 1, "W");
COption::SetOptionString("blog", "GROUP_DEFAULT_RIGHT", "D");
$db_res = CBlogSitePath::GetList(array(), array("SITE_ID" => WIZARD_SITE_ID));
if ($db_res && ($res = $db_res->Fetch())) {
    if (WIZARD_INSTALL_DEMO_DATA) {
        $res_tmp = array("B" => WIZARD_SITE_DIR, "P" => WIZARD_SITE_DIR . "#post_id#/");
        do {
            if (array_key_exists($res["TYPE"], $res_tmp) && $res["PATH"] != $res_tmp[$res["TYPE"]]) {
                CBlogSitePath::Update($res["ID"], array("PATH" => $res_tmp[$res["TYPE"]]));
            }
        } while ($db_res && ($res = $db_res->Fetch()));
    }
} else {
    CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR, "TYPE" => "B"));
    CBlogSitePath::Add(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "#post_id#/", "TYPE" => "P"));
}
if ($SocNetGroupID == false) {
    $SocNetGroupID = CBlogGroup::Add(array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("BLOG_DEMO_GROUP") . " (" . WIZARD_SITE_ID . ")"));
}
if ($utilGroupID == false) {
    $utilGroupID = CBlogGroup::Add(array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("BLOG_DEMO_GROUP_UTIL") . " (" . WIZARD_SITE_ID . ")"));
}
/********************************************************************
				Creating Posts array and arranging for Users 
********************************************************************/
$dir = WIZARD_SERVICE_ABSOLUTE_PATH . "/images/";
$arImages = array();
if (is_dir($dir) && ($dh = opendir($dir))) {
    while (($file = readdir($dh)) !== false) {
        if ($file == "." || $file == "..") {
Beispiel #4
0
                CBlog::Delete($res_blog["ID"]);
            } while ($res_blog = $db_blog->Fetch());
        }
    } else {
        CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/blogs/index.php", array("BLOG_GROUP_ID" => $SocNetGroupID));
        return;
    }
}
if (WIZARD_FIRST_INSTAL != 'Y') {
    $arFilters = array(array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "blogs/" . WIZARD_SITE_ID . "_blog_#user_id#/", "TYPE" => "B"), array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "blogs/" . WIZARD_SITE_ID . "_blog_#user_id#/#post_id#.php", "TYPE" => "P"), array("SITE_ID" => WIZARD_SITE_ID, "PATH" => WIZARD_SITE_DIR . "blogs/user/#user_id#.php", "TYPE" => "U"));
    foreach ($arFilters as $arFilter) {
        $dbSitePath = CBlogSitePath::GetList(array(), $arFilter, false, false, array("ID"));
        if ($arSitePath = $dbSitePath->Fetch()) {
            CBlogSitePath::Delete($arSitePath["ID"]);
        }
        CBlogSitePath::Add($arFilter);
    }
}
COption::SetOptionString('blog', 'avatar_max_size', '30000');
COption::SetOptionString('blog', 'avatar_max_width', '100');
COption::SetOptionString('blog', 'avatar_max_height', '100');
COption::SetOptionString('blog', 'image_max_width', '600');
COption::SetOptionString('blog', 'image_max_height', '600');
COption::SetOptionString('blog', 'allow_alias', 'Y');
COption::SetOptionString('blog', 'block_url_change', 'Y');
COption::SetOptionString('blog', 'GROUP_DEFAULT_RIGHT', 'D');
COption::SetOptionString('blog', 'show_ip', 'N');
COption::SetOptionString('blog', 'enable_trackback', 'N');
COption::SetOptionString('blog', 'allow_html', 'N');
$APPLICATION->SetGroupRight("blog", 1, "W");
COption::SetOptionString("blog", "GROUP_DEFAULT_RIGHT", "D");
Beispiel #5
0
 CBlogUserGroupPerms::Add(array("BLOG_ID" => $blogID, "USER_GROUP_ID" => $friends, "PERMS_TYPE" => "P", "PERMS" => "I", "AUTOSET" => "N"));
 CBlogUserGroupPerms::Add(array("BLOG_ID" => $blogID, "USER_GROUP_ID" => $friends, "PERMS_TYPE" => "C", "PERMS" => "P", "AUTOSET" => "N"));
 $categoryID[] = CBlogCategory::Add(array("BLOG_ID" => $blogID, "NAME" => GetMessage("BLOG_DEMO_CATEGORY_1")));
 $categoryID[] = CBlogCategory::Add(array("BLOG_ID" => $blogID, "NAME" => GetMessage("BLOG_DEMO_CATEGORY_2")));
 $postID = CBlogPost::Add(array("TITLE" => GetMessage("BLOG_DEMO_MESSAGE_TITLE_1"), "DETAIL_TEXT" => GetMessage("BLOG_DEMO_MESSAGE_BODY_1"), "DETAIL_TEXT_TYPE" => "text", "BLOG_ID" => $blogID, "AUTHOR_ID" => 1, "=DATE_CREATE" => $DB->GetNowFunction(), "=DATE_PUBLISH" => $DB->GetNowFunction(), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "ENABLE_TRACKBACK" => 'N', "ENABLE_COMMENTS" => 'Y', "CATEGORY_ID" => implode(",", $categoryID), "PERMS_P" => array(1 => BLOG_PERMS_READ, 2 => BLOG_PERMS_READ), "PERMS_C" => array(1 => BLOG_PERMS_WRITE, 2 => BLOG_PERMS_WRITE)));
 foreach ($categoryID as $v) {
     CBlogPostCategory::Add(array("BLOG_ID" => $blogID, "POST_ID" => $postID, "CATEGORY_ID" => $v));
 }
 $arImage = CFile::MakeFileArray(dirname(__FILE__) . '/images/' . GetMessage("BLOG_DEMO_IMG"));
 $arImage["MODULE_ID"] = "blog";
 $arFields = array("BLOG_ID" => $blogID, "POST_ID" => $postID, "USER_ID" => 1, "=TIMESTAMP_X" => $DB->GetNowFunction(), "TITLE" => GetMessage("BLOG_DEMO_IMG_TITLE"), "IMAGE_SIZE" => $arImage["size"], "FILE_ID" => $arImage);
 CBlogImage::Add($arFields);
 CBlogComment::Add(array("TITLE" => GetMessage("BLOG_DEMO_COMMENT_TITLE"), "POST_TEXT" => GetMessage("BLOG_DEMO_COMMENT_BODY"), "BLOG_ID" => $blogID, "POST_ID" => $postID, "PARENT_ID" => 0, "AUTHOR_ID" => 1, "DATE_CREATE" => ConvertTimeStamp(false, "FULL"), "AUTHOR_IP" => "192.168.0.108"));
 CBlogSitePath::Add(array("SITE_ID" => $siteID, "PATH" => "/communication/blog/#blog#/", "TYPE" => "B"));
 CBlogSitePath::Add(array("SITE_ID" => $siteID, "PATH" => "/communication/blog/#blog#/#post_id#.php", "TYPE" => "P"));
 CBlogSitePath::Add(array("SITE_ID" => $siteID, "PATH" => "/communication/blog/user/#user_id#.php", "TYPE" => "U"));
 if (IsModuleInstalled("socialnetwork")) {
     $rsUser = CUser::GetByID(1);
     $arUser = $rsUser->Fetch();
     $blogID = CBlog::Add(array("NAME" => GetMessage("BLG_NAME") . " " . $arUser["NAME"] . " " . $arUser["LAST_NAME"], "DESCRIPTION" => "", "GROUP_ID" => $SocNetGroupID, "ENABLE_IMG_VERIF" => 'Y', "EMAIL_NOTIFY" => 'Y', "USE_SOCNET" => 'Y', "ENABLE_RSS" => "Y", "ALLOW_HTML" => "Y", "URL" => str_replace(" ", "_", $arUser["LOGIN"]) . "-blog", "ACTIVE" => "Y", "=DATE_CREATE" => $DB->GetNowFunction(), "=DATE_UPDATE" => $DB->GetNowFunction(), "OWNER_ID" => 1, "PERMS_POST" => array("1" => BLOG_PERMS_READ, "2" => BLOG_PERMS_READ), "PERMS_COMMENT" => array("1" => BLOG_PERMS_WRITE, "2" => BLOG_PERMS_WRITE)));
     CBlog::AddSocnetRead($blogID);
     $categoryID[] = CBlogCategory::Add(array("BLOG_ID" => $blogID, "NAME" => GetMessage("BLOG_DEMO_CATEGORY_1")));
     $categoryID[] = CBlogCategory::Add(array("BLOG_ID" => $blogID, "NAME" => GetMessage("BLOG_DEMO_CATEGORY_2")));
     $postID = CBlogPost::Add(array("TITLE" => GetMessage("BLOG_DEMO_MESSAGE_TITLE_1"), "DETAIL_TEXT" => str_replace('[IMG ID=1]', "[IMG ID=2]", GetMessage("BLOG_DEMO_MESSAGE_BODY_1")), "DETAIL_TEXT_TYPE" => "text", "BLOG_ID" => $blogID, "AUTHOR_ID" => 1, "=DATE_CREATE" => $DB->GetNowFunction(), "=DATE_PUBLISH" => $DB->GetNowFunction(), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "ENABLE_TRACKBACK" => 'N', "ENABLE_COMMENTS" => 'Y', "CATEGORY_ID" => implode(",", $categoryID), "PERMS_P" => array(1 => BLOG_PERMS_READ, 2 => BLOG_PERMS_READ), "PERMS_C" => array(1 => BLOG_PERMS_WRITE, 2 => BLOG_PERMS_WRITE)));
     foreach ($categoryID as $v) {
         CBlogPostCategory::Add(array("BLOG_ID" => $blogID, "POST_ID" => $postID, "CATEGORY_ID" => $v));
     }
     $arImage = CFile::MakeFileArray(dirname(__FILE__) . '/images/' . GetMessage("BLOG_DEMO_IMG"));
     $arImage["MODULE_ID"] = "blog";
     $arFields = array("BLOG_ID" => $blogID, "POST_ID" => $postID, "USER_ID" => 1, "=TIMESTAMP_X" => $DB->GetNowFunction(), "TITLE" => GetMessage("BLOG_DEMO_IMG_TITLE"), "IMAGE_SIZE" => $arImage["size"], "FILE_ID" => $arImage);
     CBlogImage::Add($arFields);