예제 #1
2
 /**
  * Delete
  * @param $CODE
  * @return array
  * @throws \Exception
  */
 public static function Delete($CODE)
 {
     $group = new \CGroup();
     $user = new \CUser();
     if (!empty($CODE)) {
         $by = "ID";
         $order = "asc";
         $dbGroup = $group->GetList($by, $order, array('STRING_ID' => $CODE));
         if ($arGroup = $dbGroup->Fetch()) {
             $arReturn = $arGroup;
         }
     } else {
         throw new BimException('Empty group code');
     }
     if (intval($arReturn['ID']) > 0) {
         $arUsers = $group->GetGroupUser($arReturn['ID']);
         foreach ($arUsers as $UserID) {
             $arGroup = $user->GetUserGroup($UserID);
             $arGroup[] = "3";
             $user->SetUserGroup($UserID, $arGroup);
         }
         $res = $group->Delete($arReturn['ID']);
         if (is_object($res)) {
             return $arReturn['ID'];
         } else {
             throw new BimException($group->LAST_ERROR);
         }
     } else {
         throw new BimException('Group not found');
     }
 }
예제 #2
0
파일: Helper.php 프로젝트: cjp2600/bim-core
 /**
  * Получение массива групп пользователей
  *
  * @return array массив групп пользователей
  */
 public static function getUserGroups()
 {
     $group = new \CGroup();
     $groupOrder = array('sort' => 'asc');
     $groupTmp = 'sort';
     $groupQuery = $group->GetList($groupOrder, $groupTmp);
     $groups = array();
     for ($i = 0; $item = $groupQuery->Fetch(); $i++) {
         $groups[$i] = $item;
     }
     return $groups;
 }
 public function getGroupsByFilter($filter = array())
 {
     $by = 'c_sort';
     $order = 'asc';
     $res = array();
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     $dbRes = \CGroup::GetList($by, $order, $filter);
     while ($aItem = $dbRes->Fetch()) {
         $res[] = $aItem;
     }
     return $res;
 }
예제 #4
0
 function BeforeUserAdd(&$arFields)
 {
     if (strstr($_SERVER['HTTP_REFERER'], "webim")) {
         $filter = array("STRING_ID" => "webim");
         $by = 'c_sort';
         $order = 'DESC';
         $rsGroups = CGroup::GetList($by, $order, $filter);
         $is_filtered = $rsGroups->is_filtered;
         if ($row = $rsGroups->GetNext()) {
             $arFields["GROUP_ID"][] = array("GROUP_ID" => $row["ID"]);
         }
     }
 }
예제 #5
0
 public function BeforeUserAdd(&$arFields)
 {
     if (strstr($_SERVER['HTTP_REFERER'], 'webim')) {
         $filter = array('STRING_ID' => 'webim');
         $by = 'c_sort';
         $order = 'DESC';
         $rsGroups = CGroup::GetList($by, $order, $filter);
         $is_filtered = $rsGroups->is_filtered;
         if ($row = $rsGroups->GetNext()) {
             $arFields['GROUP_ID'][] = array('GROUP_ID' => $row['ID']);
         }
     }
 }
예제 #6
0
 /**
  * @return array
  */
 public function getUserGroups()
 {
     if ($this->groups) {
         return $this->groups;
     }
     $ids = $this->user->GetUserGroupArray();
     $res = array();
     $dbRes = \CGroup::GetList($by = null, $order = null, array('ID' => implode('|', $ids)));
     while ($item = $dbRes->Fetch()) {
         $res[] = $item['STRING_ID'];
     }
     $this->groups = array_filter($res);
     return $this->groups;
 }
예제 #7
0
파일: Group.php 프로젝트: cjp2600/bim-core
 /**
  * Абстрактный метод проверки передаваемых параметров
  *
  * checkParams
  * @param array $groupId
  * @return mixed|void
  * @throws \Exception
  * @internal param array $params
  */
 public function checkParams($groupId)
 {
     $group = new \CGroup();
     if (!isset($groupId) || empty($groupId)) {
         throw new BimException('empty groupId param');
     }
     $this->ownerItemDbData = array();
     $groupDbRes = $group->GetList($by = 'id', $order = 'desc', array('ID' => $groupId));
     if ($groupDbRes === false || !$groupDbRes->SelectedRowsCount()) {
         throw new BimException('Group with id = ' . $groupId . ' not exists');
     }
     $groupData = $groupDbRes->Fetch();
     if (!strlen($groupData['STRING_ID'])) {
         throw new BimException('Group with id = ' . $groupId . ' have empty STRING_ID!');
     }
     $this->ownerItemDbData = $groupData;
 }
예제 #8
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("iblock")) {
    return;
}
$arIBlockType = array();
$rsIBlockType = CIBlockType::GetList(array("sort" => "asc"), array("ACTIVE" => "Y"));
while ($arr = $rsIBlockType->Fetch()) {
    if ($ar = CIBlockType::GetByIDLang($arr["ID"], LANGUAGE_ID)) {
        $arIBlockType[$arr["ID"]] = "[" . $arr["ID"] . "] " . $ar["NAME"];
    }
}
$arIBlock = array();
$rsIBlock = CIBlock::GetList(array("sort" => "asc"), array("TYPE" => $arCurrentValues["IBLOCK_TYPE"], "ACTIVE" => "Y"));
while ($arr = $rsIBlock->Fetch()) {
    $arIBlock[$arr["ID"]] = "[" . $arr["ID"] . "] " . $arr["NAME"];
}
$arUserGroups = array();
$dbGroups = CGroup::GetList($b = "NAME", $o = "ASC", array("ACTIVE" => "Y"));
while ($arGroup = $dbGroups->GetNext()) {
    $arUserGroups[$arGroup["ID"]] = "[" . $arGroup["ID"] . "] " . $arGroup["NAME"];
}
$arComponentParameters = array("GROUPS" => array("VARIABLE_ALIASES" => array("NAME" => GetMessage("INTL_VARIABLE_ALIASES"))), "PARAMETERS" => array("IBLOCK_TYPE" => array("PARENT" => "BASE", "NAME" => GetMessage("INTL_IBLOCK_TYPE"), "TYPE" => "LIST", "VALUES" => $arIBlockType, "REFRESH" => "Y"), "IBLOCK_ID" => array("PARENT" => "BASE", "NAME" => GetMessage("INTL_IBLOCK"), "TYPE" => "LIST", "VALUES" => $arIBlock, "REFRESH" => "Y"), "PAGE_VAR" => array("NAME" => GetMessage("INTL_PAGE_VAR"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "VARIABLE_ALIASES"), "MEETING_VAR" => array("NAME" => GetMessage("INTL_MEETING_VAR"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "VARIABLE_ALIASES"), "MEETING_ID" => array("NAME" => GetMessage("INTL_MEETING_ID"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "BASE"), "ITEM_VAR" => array("NAME" => GetMessage("INTL_ITEM_VAR"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "VARIABLE_ALIASES"), "ITEM_ID" => array("NAME" => GetMessage("INTL_ITEM_ID"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "BASE"), "PATH_TO_MEETING" => array("NAME" => GetMessage("INTL_PATH_TO_MEETING"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "URL_TEMPLATES"), "PATH_TO_MEETING_LIST" => array("NAME" => GetMessage("INTL_PATH_TO_MEETING_LIST"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "URL_TEMPLATES"), "SET_NAVCHAIN" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("INTL_SET_NAVCHAIN"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "SET_TITLE" => array(), "USERGROUPS_RESERVE" => array("PARENT" => "BASE", "NAME" => GetMessage("INTL_USERGROUPS_RESERVE"), "TYPE" => "LIST", "MULTIPLE" => "Y", "VALUES" => $arUserGroups)));
예제 #9
0
        }
        print "</pre>";
    }
}
if ($_GET["date_from"] || $_GET["date_to"]) {
    $date_from = $_GET["date_from"];
    $date_to = $_GET["date_to"];
} else {
    $date_from = date('d.m.Y', time() - 3600 * 24 * 10);
    $date_to = date('d.m.Y', time());
}
$APPLICATION->ShowHead();
CJSCore::Init("jquery");
$APPLICATION->ShowPanel();
$APPLICATION->SetTitle("Статистика приглашений детально");
$groupObj = CGroup::GetList();
$groups = array();
while ($group = $groupObj->Fetch()) {
    if ($group["ID"] == 8 || $group["ID"] == 9) {
        //Усилители / Сотрудники
        $groups[$group["ID"]] = $group["NAME"];
    }
}
$arFilter = array("DATE_REGISTER_1" => $date_from, "DATE_REGISTER_2" => $date_to);
$usersObj = CUser::GetList($sort = "id", $direct = "asc", $arFilter, array("SELECT" => array("UF_*"), "FIELDS" => array("*")));
$counter = array();
while ($user = $usersObj->Fetch()) {
    if ($user["UF_USER_PARENT"]) {
        $counter[$user["UF_USER_PARENT"]][] = $user;
    }
}
예제 #10
0
	?>
</table>
</td></tr>
<?
	if ($USER->IsAdmin())
	{
		if (CBXFeatures::IsFeatureEnabled('SaleRecurring'))
		{
			$tabControl->BeginNextTab();

			$arVal = array();
			$strVal = (string)Option::get('catalog', 'avail_content_groups');
			if ($strVal != '')
				$arVal = explode(',', $strVal);

			$dbUserGroups = CGroup::GetList(($b="c_sort"), ($o="asc"), array("ANONYMOUS" => "N"));
			while ($arUserGroups = $dbUserGroups->Fetch())
			{
				$arUserGroups["ID"] = (int)$arUserGroups["ID"];
				if ($arUserGroups["ID"] == 2)
					continue;
			?>
			<tr>
				<td width="40%"><label for="user_group_<?php 
echo $arUserGroups["ID"];
?>
"><?php 
echo htmlspecialcharsEx($arUserGroups["NAME"]);
?>
</label> [<a href="group_edit.php?ID=<?php 
echo $arUserGroups["ID"];
예제 #11
0
        ?>
 <sup>1)</sup></td>
	</tr>
	<?php 
        $arCurProductGroups = array();
        $dbProductGroups = CCatalogProductGroups::GetList(array(), array("PRODUCT_ID" => $ID), false, false, array("ID", "GROUP_ID", "ACCESS_LENGTH", "ACCESS_LENGTH_TYPE"));
        while ($arProductGroup = $dbProductGroups->Fetch()) {
            $arCurProductGroups[intval($arProductGroup["GROUP_ID"])] = array(intval($arProductGroup["ACCESS_LENGTH"]), $arProductGroup["ACCESS_LENGTH_TYPE"]);
        }
        $arAvailContentGroups = array();
        $availContentGroups = COption::GetOptionString("catalog", "avail_content_groups");
        if (strlen($availContentGroups) > 0) {
            $arAvailContentGroups = explode(",", $availContentGroups);
        }
        $bNoAvailGroups = true;
        $dbGroups = CGroup::GetList($b = "c_sort", $o = "asc", array("ANONYMOUS" => "N"));
        while ($arGroup = $dbGroups->Fetch()) {
            $arGroup["ID"] = intval($arGroup["ID"]);
            if ($arGroup["ID"] == 2 || !in_array($arGroup["ID"], $arAvailContentGroups)) {
                continue;
            }
            if ($bVarsFromForm) {
                if (isset(${"CAT_USER_GROUP_ID_" . $arGroup["ID"]}) && ${"CAT_USER_GROUP_ID_" . $arGroup["ID"]} == "Y") {
                    $arCurProductGroups[$arGroup["ID"]] = array(intval(${"CAT_ACCESS_LENGTH_" . $arGroup["ID"]}), ${"CAT_ACCESS_LENGTH_TYPE_" . $arGroup["ID"]});
                } elseif (array_key_exists($arGroup["ID"], $arCurProductGroups)) {
                    unset($arCurProductGroups[$arGroup["ID"]]);
                }
            }
            $bNoAvailGroups = false;
            ?>
		<tr>
예제 #12
0
//Registered users group
$dbResult = CGroup::GetList($by, $order, array("STRING_ID" => "REGISTERED_USERS"));
if ($dbResult->Fetch()) {
    return;
}
$group = new CGroup();
$arFields = array("ACTIVE" => "Y", "C_SORT" => 3, "NAME" => GetMessage("REGISTERED_GROUP_NAME"), "STRING_ID" => "REGISTERED_USERS");
$groupID = $group->Add($arFields);
if ($groupID > 0) {
    COption::SetOptionString("main", "new_user_registration_def_group", $groupID);
    if ($editProfileTask) {
        CGroup::SetTasks($groupID, array($editProfileTask), true);
    }
}
//Control panel users
$dbResult = CGroup::GetList($by, $order, array("STRING_ID" => "CONTROL_PANEL_USERS"));
$arGroup = $dbResult->Fetch();
if (!$arGroup) {
    $group = new CGroup();
    $arFields = array("ACTIVE" => "Y", "C_SORT" => 4, "NAME" => GetMessage("CONTROL_PANEL_GROUP_NAME"), "STRING_ID" => "CONTROL_PANEL_USERS");
    $groupID = $group->Add($arFields);
    if ($groupID > 0) {
        DemoSiteUtil::SetFilePermission(array("s1", "/bitrix/admin"), array($groupID => "R"));
        if ($editProfileTask) {
            CGroup::SetTasks($groupID, array($editProfileTask), true);
        }
    }
} else {
    $groupID = $arGroup["ID"];
}
if ($groupID > 0 && !strlen(COption::GetOptionString("main", "show_panel_for_users", ""))) {
예제 #13
0
 function Copy($ID, $CHECK_RIGHTS = "Y")
 {
     global $DB, $APPLICATION, $strError;
     $err_mess = CAllForm::err_mess() . "<br>Function: Copy<br>Line: ";
     $ID = intval($ID);
     if ($CHECK_RIGHTS != "Y" || CForm::IsAdmin()) {
         $rsForm = CForm::GetByID($ID);
         $arForm = $rsForm->Fetch();
         if (!is_set($arForm, "FORM_TEMPLATE")) {
             $arForm["FORM_TEMPLATE"] = CForm::GetFormTemplateByID($ID);
         }
         // символьный код формы
         while (true) {
             $SID = $arForm["SID"];
             if (strlen($SID) > 25) {
                 $SID = substr($SID, 0, 25);
             }
             $SID .= "_" . RandString(5);
             $strSql = "SELECT 'x' FROM b_form WHERE SID='" . $DB->ForSql($SID, 50) . "'";
             $z = $DB->Query($strSql, false, $err_mess . __LINE__);
             if (!($zr = $z->Fetch())) {
                 break;
             }
         }
         $arFields = array("NAME" => $arForm["NAME"], "SID" => $SID, "C_SORT" => $arForm["C_SORT"], "FIRST_SITE_ID" => $arForm["FIRST_SITE_ID"], "BUTTON" => $arForm["BUTTON"], "USE_CAPTCHA" => $arForm["USE_CAPTCHA"], "DESCRIPTION" => $arForm["DESCRIPTION"], "DESCRIPTION_TYPE" => $arForm["DESCRIPTION_TYPE"], "SHOW_TEMPLATE" => $arForm["SHOW_TEMPLATE"], "FORM_TEMPLATE" => $arForm["FORM_TEMPLATE"], "USE_DEFAULT_TEMPLATE" => $arForm["USE_DEFAULT_TEMPLATE"], "SHOW_RESULT_TEMPLATE" => $arForm["SHOW_RESULT_TEMPLATE"], "PRINT_RESULT_TEMPLATE" => $arForm["PRINT_RESULT_TEMPLATE"], "EDIT_RESULT_TEMPLATE" => $arForm["EDIT_RESULT_TEMPLATE"], "FILTER_RESULT_TEMPLATE" => $arForm["FILTER_RESULT_TEMPLATE"], "TABLE_RESULT_TEMPLATE" => $arForm["TABLE_RESULT_TEMPLATE"], "STAT_EVENT1" => $arForm["STAT_EVENT1"], "STAT_EVENT2" => $SID, "STAT_EVENT3" => $arForm["STAT_EVENT3"], "arSITE" => CForm::GetSiteArray($ID));
         // пункты меню
         $z = CForm::GetMenuList(array("FORM_ID" => $ID), "N");
         while ($zr = $z->Fetch()) {
             $arFields["arMENU"][$zr["LID"]] = $zr["MENU"];
         }
         // права групп
         $w = CGroup::GetList($v1 = "dropdown", $v2 = "asc", array("ADMIN" => "N"), $v3);
         $arGroups = array();
         while ($wr = $w->Fetch()) {
             $arGroups[] = $wr["ID"];
         }
         if (is_array($arGroups)) {
             foreach ($arGroups as $gid) {
                 $arFields["arGROUP"][$gid] = CForm::GetPermission($ID, array($gid), "Y");
             }
         }
         // картинка
         if (intval($arForm["IMAGE_ID"]) > 0) {
             $arIMAGE = CFile::MakeFileArray(CFile::CopyFile($arForm["IMAGE_ID"]));
             $arIMAGE["MODULE_ID"] = "form";
             $arFields["arIMAGE"] = $arIMAGE;
         }
         $NEW_ID = CForm::Set($arFields, 0);
         if (intval($NEW_ID) > 0) {
             // статусы
             $rsStatus = CFormStatus::GetList($ID, $by, $order, array(), $is_filtered);
             while ($arStatus = $rsStatus->Fetch()) {
                 CFormStatus::Copy($arStatus["ID"], "N", $NEW_ID);
             }
             // вопросы/пол¤
             $rsField = CFormField::GetList($ID, "ALL", $by, $order, array(), $is_filtered);
             while ($arField = $rsField->Fetch()) {
                 CFormField::Copy($arField["ID"], "N", $NEW_ID);
             }
         }
         return $NEW_ID;
     } else {
         $strError .= GetMessage("FORM_ERROR_ACCESS_DENIED") . "<br>";
     }
     return false;
 }
예제 #14
0
		"GROUPS_ID"		=> $find_group_id
		);
}

if(!$USER->CanDoOperation('view_all_users'))
{
	$arUserSubordinateGroups = array();
	$arUserGroups = CUser::GetUserGroup($USER->GetID());
	foreach($arUserGroups as $grp)
		$arUserSubordinateGroups = array_merge($arUserSubordinateGroups, CGroup::GetSubordinateGroups($grp));

	$arFilter["CHECK_SUBORDINATE"] = array_unique($arUserSubordinateGroups);
}

// инициализация списка - выборка данных
$rsData = CGroup::GetList($by, $order, $arFilter, "Y");
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();

// установке параметров списка
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("PAGES")));

// заголовок списка
$lAdmin->AddHeaders(array(
	array("id"=>"ID",				"content"=>"ID", 	"sort"=>"id", "default"=>true, "align"=>"right"),
	array("id"=>"TIMESTAMP_X",		"content"=>GetMessage('TIMESTAMP'), "sort"=>"timestamp_x", "default"=>true),
	array("id"=>"ACTIVE", 			"content"=>GetMessage('ACTIVE'),	"sort"=>"active", "default"=>true),
	array("id"=>"C_SORT", 			"content"=>GetMessage("MAIN_C_SORT"),  "sort"=>"c_sort", "default"=>true, "align"=>"right"),
	array("id"=>"NAME",				"content"=>GetMessage("NAME"), "sort"=>"name",	"default"=>true),
	array("id"=>"DESCRIPTION", 		"content"=>GetMessage("MAIN_DESCRIPTION"),  "sort"=>"description", "default"=>false),
	array("id"=>"USERS", 			"content"=>GetMessage('MAIN_USERS'),  "sort"=>"users", "default"=>true, "align"=>"right"),
예제 #15
0
        $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
    }
}
// copying
if ($copy_id > 0 && check_bitrix_sessid() && $F_RIGHT >= 30) {
    $new_id = CForm::Copy($copy_id);
    if (strlen($strError) <= 0 && intval($new_id) > 0) {
        LocalRedirect("/bitrix/admin/form_edit.php?ID=" . $new_id . "&lang=" . LANGUAGE_ID);
    }
}
// cleaning
if ($reset_id > 0 && check_bitrix_sessid() && $F_RIGHT >= 30) {
    CForm::Reset($reset_id);
    LocalRedirect("/bitrix/admin/form_edit.php?ID=" . $reset_id . "&lang=" . LANGUAGE_ID);
}
$w = CGroup::GetList($v1 = "dropdown", $v2 = "asc", array("ADMIN" => "N"));
$arGroups = array();
while ($wr = $w->Fetch()) {
    $arGroups[] = array("ID" => $wr["ID"], "NAME" => "[<a title=\"" . GetMessage("FORM_GROUP_EDIT") . "\" href=\"/bitrix/admin/group_edit.php?ID=" . intval($wr["ID"]) . "&lang=" . LANGUAGE_ID . "\">" . intval($wr["ID"]) . "</a>] " . htmlspecialcharsbx($wr["NAME"]));
}
$z = CLanguage::GetList($v1, $v2, array("ACTIVE" => "Y"));
$arFormMenuLang = array();
while ($zr = $z->Fetch()) {
    $arFormMenuLang[] = array("LID" => $zr["LID"], "NAME" => $zr["NAME"]);
}
$rs = CSite::GetList($by = "sort", $order = "asc");
$arrSites = array();
while ($ar = $rs->Fetch()) {
    if ($ar["DEF"] == "Y") {
        $def_site_id = $ar["ID"];
    }
예제 #16
0
파일: options.php 프로젝트: ASDAFF/open_bx
 * @global CUser $USER
 * @global CMain $APPLICATION
 * @global CDatabase $DB
 */

IncludeModuleLangFile(__FILE__);
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"].FX_ROOT."/modules/main/admin/task_description.php");

if(!$USER->CanDoOperation('view_other_settings') && !$USER->CanDoOperation('edit_other_settings'))
	$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));

$mid = $_REQUEST["mid"];

$arGROUPS = array();
$groups = array();
$z = CGroup::GetList(($v1=""), ($v2=""), array("ACTIVE"=>"Y", "ADMIN"=>"N", "ANONYMOUS"=>"N"));
while($zr = $z->Fetch())
{
	$ar = array();
	$ar["ID"] = intval($zr["ID"]);
	$ar["NAME"] = htmlspecialcharsbx($zr["NAME"]);
	$arGROUPS[] = $ar;

	$groups[$zr["ID"]] = $zr["NAME"]." [".$zr["ID"]."]";
}

if($_SERVER["REQUEST_METHOD"] == "GET" && $USER->IsAdmin() && $_REQUEST["RestoreDefaults"] <> '' && check_freetrix_sessid())
{
	$aSaveVal = array(
		array("NAME"=>"admin_passwordh", "DEF"=>""),
		array("NAME"=>"PARAM_MAX_SITES", "DEF"=>"2"),
예제 #17
0
						{
							if(msg) msg.innerHTML = '';
						}
					}
					</script>

			</td>
		</tr>
		<tr class="heading">
			<td colspan="2"><?php 
                echo GetMessage("IB_E_GROUP_ACCESS_TITLE");
                ?>
</td>
		</tr>
		<?php 
                $groups = CGroup::GetList($by = "sort", $order = "asc", array("ID" => "~2"));
                while ($r = $groups->GetNext()) {
                    if ($bVarsFromForm) {
                        $strSelected = $GROUP[$r["ID"]];
                    } else {
                        $strSelected = $perm[$r["ID"]];
                    }
                    if ($strSelected == "U" && !CModule::IncludeModule("workflow")) {
                        $strSelected = "R";
                    }
                    if ($strSelected != "R" && $strSelected != "S" && $strSelected != "T" && $strSelected != "U" && $strSelected != "W" && $strSelected != "X" && $ID > 0 && !$bVarsFromForm) {
                        $strSelected = "";
                    }
                    ?>
		<tr>
			<td nowrap width="40%"><?php 
예제 #18
0
파일: Finder.php 프로젝트: marvin255/bxar
 /**
  * Запрашиваем данные из базы
  * @return array
  */
 protected function getList()
 {
     $return = array();
     //сортировка
     $order = $this->getOrder();
     $keys = array_keys($order);
     $by = reset($keys);
     $order = reset($order);
     //условия для поиска
     $filter = $this->getFilter();
     //запрос
     $rsElement = \CGroup::GetList($by, $order, $filter);
     while ($ob = $rsElement->Fetch()) {
         $return[] = $ob;
     }
     return $return;
 }
예제 #19
0
$iblockXMLFile = WIZARD_SERVICE_RELATIVE_PATH . "/ibexp/ru/sannews.xml";
$iblockCode = "news";
//_".WIZARD_SITE_ID;
$iblockType = "news";
$rsIBlock = CIBlock::GetList(array(), array("CODE" => $iblockCode, "TYPE" => $iblockType));
$iblockID = false;
if ($arIBlock = $rsIBlock->Fetch()) {
    $iblockID = $arIBlock["ID"];
    if (WIZARD_INSTALL_DEMO_DATA) {
        CIBlock::Delete($arIBlock["ID"]);
        $iblockID = false;
    }
}
if ($iblockID == false) {
    $permissions = array("1" => "X", "2" => "R");
    $dbGroup = CGroup::GetList($by = "", $order = "", array("STRING_ID" => "content_editor"));
    if ($arGroup = $dbGroup->Fetch()) {
        $permissions[$arGroup["ID"]] = 'W';
    }
    $iblockID = WizardServices::ImportIBlockFromXML($iblockXMLFile, $iblockCode, $iblockType, WIZARD_SITE_ID, $permissions);
    if ($iblockID < 1) {
        return;
    }
    //WizardServices::SetIBlockFormSettings($iblockID, Array ( 'tabs' => GetMessage("W_IB_GROUP_PHOTOG_TAB1").$REAL_PICTURE_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB2").$rating_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB3").$vote_count_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB4").$vote_sum_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB5").$APPROVE_ELEMENT_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB6").$PUBLIC_ELEMENT_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB7"), ));
    //IBlock fields
    $iblock = new CIBlock();
    $arFields = array("ACTIVE" => "Y", "FIELDS" => array('IBLOCK_SECTION' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'ACTIVE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'Y'), 'ACTIVE_FROM' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '=today'), 'ACTIVE_TO' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SORT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'NAME' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => ''), 'PREVIEW_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N')), 'PREVIEW_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'PREVIEW_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'DETAIL_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N')), 'DETAIL_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'DETAIL_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'XML_ID' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'CODE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'TAGS' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '')), "CODE" => $iblockCode, "XML_ID" => $iblockCode, "NAME" => $iblock->GetArrayByID($iblockID, "NAME"));
    $iblock->Update($iblockID, $arFields);
} else {
    $arSites = array();
    $db_res = CIBlock::GetSite($iblockID);
예제 #20
0
use Bitrix\Main\Localization\Loc;
use Bitrix\Currency;
$module_id = 'currency';
$moduleAccessLevel = $APPLICATION->GetGroupRight($module_id);
if ($moduleAccessLevel >= 'R') {
    Loader::includeModule('currency');
    Loc::loadMessages(__FILE__);
    $aTabs = array(array("DIV" => "edit0", "TAB" => Loc::getMessage("CURRENCY_SETTINGS"), "ICON" => "currency_settings", "TITLE" => Loc::getMessage("CURRENCY_SETTINGS_TITLE")), array("DIV" => "edit1", "TAB" => Loc::getMessage("CO_TAB_RIGHTS"), "ICON" => "currency_settings", "TITLE" => Loc::getMessage("CO_TAB_RIGHTS_TITLE")));
    $tabControl = new CAdminTabControl("currencyTabControl", $aTabs, true, true);
    $systemTabs = array(array('DIV' => 'proc_edit0', 'TAB' => Loc::getMessage('CURRENCY_BASE_RATE'), 'ICON' => '', 'TITLE' => Loc::getMessage('CURRENCY_BASE_RATE_TITLE')), array('DIV' => 'proc_edit1', 'TAB' => Loc::getMessage('CURRENCY_AGENTS'), 'ICON' => '', 'TITLE' => Loc::getMessage('CURRENCY_AGENTS_TITLE')));
    $systemTabControl = new CAdminTabControl("currencyProcTabControl", $systemTabs, true, true);
    if ($_SERVER['REQUEST_METHOD'] == "GET" && !empty($_GET['RestoreDefaults']) && $moduleAccessLevel == "W" && check_bitrix_sessid()) {
        COption::RemoveOption("currency");
        $v1 = "id";
        $v2 = "asc";
        $z = CGroup::GetList($v1, $v2, array("ACTIVE" => "Y", "ADMIN" => "N"));
        while ($zr = $z->Fetch()) {
            $APPLICATION->DelGroupRight($module_id, array($zr["ID"]));
        }
        LocalRedirect($APPLICATION->GetCurPage() . '?lang=' . LANGUAGE_ID . '&mid=' . $module_id);
    }
    if ($_SERVER['REQUEST_METHOD'] == 'POST' && $moduleAccessLevel == "W" && check_bitrix_sessid()) {
        if (isset($_POST['Update']) && $_POST['Update'] === 'Y') {
            $newBaseCurrency = '';
            if (isset($_POST['BASE_CURRENCY'])) {
                $newBaseCurrency = (string) $_POST['BASE_CURRENCY'];
            }
            if ($newBaseCurrency != '') {
                $res = CCurrency::SetBaseCurrency($newBaseCurrency);
            }
            ob_start();
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $file = $input->getArgument('file');
     if (!file_exists($file) || !($fh = fopen($file, 'r'))) {
         $output->writeln('<error>Can\'t read data from file</error>');
         return null;
     }
     //выбираем группу
     $group = 0;
     $res = \CGroup::GetList($by = '', $order = '', ['STRING_ID' => 'totaldict_chairman_experts']);
     if ($ob = $res->Fetch()) {
         $group = $ob['ID'];
     }
     //выбираем список статусов
     $statusList = [];
     $rsData = \CUserTypeEntity::GetList([], ['ENTITY_ID' => 'USER', 'FIELD_NAME' => 'UF_TD_ORG_STATUS']);
     if ($fob = $rsData->GetNext()) {
         $ar = ['newby' => 'НОВИЧКИ', 'pretty_boy' => 'КРАСАВЧИКИ', 'catching' => 'ДОГОНЯЮЩИЕ', 'redneck' => 'ДЕРЕВНИ'];
         $res = \CUserFieldEnum::GetList([], ['USER_FIELD_ID' => $fob['ID']]);
         while ($ob = $res->Fetch()) {
             if (empty($ar[$ob['XML_ID']])) {
                 continue;
             }
             $statusList[$ar[$ob['XML_ID']]] = $ob['ID'];
         }
     }
     //список стран для заполнения
     $countries = GetCountryArray();
     $countries = array_combine($countries['reference'], $countries['reference_id']);
     $currentStatus = null;
     while (($data = fgetcsv($fh)) !== false) {
         //если заполнена только вторая колонка то это статус
         if (empty($data[1]) && !empty($data[0]) && isset($statusList[$data[0]])) {
             $currentStatus = $statusList[$data[1]];
             continue;
         }
         //массив для загрузки данных пользователя
         $arLoad = ['ACTIVE' => 'Y', 'PERSONAL_COUNTRY' => isset($countries['Россия']) ? $countries['Россия'] : null, 'PERSONAL_CITY' => $data[0], 'LAST_NAME' => $data[1], 'WORK_POSITION' => $data[3], 'PERSONAL_MOBILE' => $data[4], 'PERSONAL_STREET' => $data[6], 'PERSONAL_WWW' => $data[8], 'PASSWORD' => 'Test,user,passwr0d', 'CONFIRM_PASSWORD' => 'Test,user,passwr0d', 'UF_TD_ORG_STATUS' => $currentStatus, 'GROUP_ID' => [2, $group]];
         //пробуем разбить email
         if (strpos($data[5], ',')) {
             $explode = array_map('trim', explode(',', $data[5]));
             $arLoad['EMAIL'] = $explode[0];
             unset($explode[0]);
             $arLoad['PERSONAL_NOTES'] = implode(', ', $explode);
         } elseif (strpos($data[5], 'и')) {
             $explode = array_map('trim', explode('и', $data[5]));
             $arLoad['EMAIL'] = $explode[0];
             unset($explode[0]);
             $arLoad['PERSONAL_NOTES'] = implode(', ', $explode);
         } elseif (strpos($data[5], ';')) {
             $explode = array_map('trim', explode(';', $data[5]));
             $arLoad['EMAIL'] = $explode[0];
             unset($explode[0]);
             $arLoad['PERSONAL_NOTES'] = implode(', ', $explode);
         } elseif (strpos($data[5], ' ')) {
             $explode = array_map('trim', explode(' ', $data[5]));
             $arLoad['EMAIL'] = $explode[0];
             unset($explode[0]);
             $arLoad['PERSONAL_NOTES'] = implode(', ', $explode);
         } else {
             $arLoad['EMAIL'] = trim($data[5]);
         }
         //пробуем разбить фамилию и имя
         if (strpos($data[2], ' ')) {
             $explode = explode(' ', trim($data[2]));
             $arLoad['NAME'] = $explode[0];
             $arLoad['SECOND_NAME'] = $explode[1];
         } else {
             $arLoad['NAME'] = trim($data[2]);
         }
         //пробуем завести дату в базу
         if (($time = strtotime($data[7])) !== false) {
             $arLoad['PERSONAL_BIRTHDAY'] = ConvertTimeStamp($time, 'SHORT', 'ru');
         }
         //пробуем найти страну, чтобы привязать пользователя к городу
         $country = \bxpimple\Locator::$item->get('countryFinder')->mergeFilterWith(['NAME' => 'Россия'])->one();
         if ($country) {
             //если нашли страну, то пробуем найти и город
             $city = \bxpimple\Locator::$item->get('cityFinder')->mergeFilterWith(['NAME' => trim($data[0]), 'PROPERTY_TOTALDICT_GEO_CITIES_COUNTRY' => $country->getAttribute('ID')->getValue()])->one();
             if ($city) {
                 //если нашли город, то привязываем пользователя
                 $arLoad['UF_TD_CITY_IB'] = $city->getAttribute('ID')->getValue();
             }
         }
         //задаем логин, по умолчанию используем email
         $arLoad['LOGIN'] = $arLoad['EMAIL'];
         //пробуем найти пользователя по его логину
         $user = new \CUser();
         $res = \CUser::GetList($by = '', $order = '', ['LOGIN_EQUAL' => $arLoad['LOGIN']]);
         if ($ob = $res->Fetch()) {
             $arGroups = \CUser::GetUserGroup($ob['ID']);
             if (is_array($arGroups)) {
                 $arLoad['GROUP_ID'] = array_unique(array_merge($arLoad['GROUP_ID'], $arGroups));
             }
             //обновляем
             if (!$user->Update($ob['ID'], $arLoad)) {
                 $output->writeln('<error>User ' . $arLoad['LOGIN'] . ' error: ' . $user->LAST_ERROR . '</error>');
             } else {
                 $output->writeln('<info>User ' . $arLoad['LOGIN'] . ' updated</info>');
             }
         } else {
             //создаем нового
             if (!$user->Add($arLoad)) {
                 $output->writeln('<error>User ' . $arLoad['LOGIN'] . ' error: ' . $user->LAST_ERROR . '</error>');
             } else {
                 $output->writeln('<info>New user ' . $arLoad['LOGIN'] . ' added</info>');
             }
         }
     }
     fclose($fh);
 }
예제 #22
0
 function GetGroupsByRole($role)
 {
     //Todo: определиться с доступом по умолчанию
     global $APPLICATION, $USER;
     if (!is_object($USER)) {
         $USER = new CUser();
     }
     $arGroups = array();
     $arBadGroups = array();
     $res = $APPLICATION->GetGroupRightList(array("MODULE_ID" => "support"));
     while ($ar = $res->Fetch()) {
         if ($ar["G_ACCESS"] == $role) {
             $arGroups[] = $ar["GROUP_ID"];
         } else {
             $arBadGroups[] = $ar["GROUP_ID"];
         }
     }
     $right = COption::GetOptionString("support", "GROUP_DEFAULT_RIGHT", "D");
     if ($right == $role) {
         $res = CGroup::GetList($v1 = "dropdown", $v2 = "asc", array("ACTIVE" => "Y"));
         while ($ar = $res->Fetch()) {
             if (!in_array($ar["ID"], $arGroups) && !in_array($ar["ID"], $arBadGroups)) {
                 $arGroups[] = $ar["ID"];
             }
         }
     }
     return $arGroups;
     /*$arGroups = array();
     
     		$z = CGroup::GetList($v1="dropdown", $v2="asc", array("ACTIVE" => "Y"));
     		while($zr = $z->Fetch())
     		{
     			$arRoles = $APPLICATION->GetUserRoles("support", array(intval($zr["ID"])), "Y", "N");
     			if (in_array($role, $arRoles)) $arGroups[] = intval($zr["ID"]);
     		}
     
     		return array_unique($arGroups);*/
 }
예제 #23
0
	}
}

$arSectProperty_LNS = array();
$arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("IBLOCK_".$arCurrentValues["IBLOCK_ID"]."_SECTION");
foreach($arUserFields as $FIELD_NAME=>$arUserField)
	if($arUserField["USER_TYPE"]["BASE_TYPE"]=="string")
		$arSectProperty_LNS[$FIELD_NAME] = $arUserField["LIST_COLUMN_LABEL"]? $arUserField["LIST_COLUMN_LABEL"]: $FIELD_NAME;

$arAscDesc = array(
	"asc" => GetMessage("IBLOCK_SORT_ASC"),
	"desc" => GetMessage("IBLOCK_SORT_DESC"),
);

$arUGroupsEx = Array();
$dbUGroups = CGroup::GetList($by = "c_sort", $order = "asc");
while($arUGroups = $dbUGroups -> Fetch())
{
	$arUGroupsEx[$arUGroups["ID"]] = $arUGroups["NAME"];
}

$arComponentParameters = array(
	"GROUPS" => array(
		"RATING_SETTINGS" => array(
			"NAME" => GetMessage("T_IBLOCK_DESC_RATING_SETTINGS"),
		),
		"REVIEW_SETTINGS" => array(
			"NAME" => GetMessage("T_IBLOCK_DESC_REVIEW_SETTINGS"),
		),
		"FILTER_SETTINGS" => array(
			"NAME" => GetMessage("T_IBLOCK_DESC_FILTER_SETTINGS"),
예제 #24
0
 public function GetNames($arCodes)
 {
     $aID = array();
     foreach ($arCodes as $code) {
         if (preg_match('/^G[0-9]+$/', $code)) {
             $aID[] = substr($code, 1);
         }
     }
     if (!empty($aID)) {
         $arResult = array();
         $res = CGroup::GetList($by = "id", $order = "", array("ANONYMOUS" => "N", "ID" => implode("|", $aID)));
         while ($arGroup = $res->Fetch()) {
             $arResult["G" . $arGroup["ID"]] = array("provider" => GetMessage("authprov_group_prov"), "name" => $arGroup["NAME"]);
         }
         return $arResult;
     }
     return false;
 }
<?
$module_id = "ws.projectsettings";
$CAT_RIGHT = $APPLICATION->GetGroupRight($module_id);
if ($CAT_RIGHT >= "R") :
    global $MESS;
    include(GetLangFileName($GLOBALS["DOCUMENT_ROOT"] . "/bitrix/modules/main/lang/", "/options.php"));

    if ($REQUEST_METHOD == "GET" && strlen($RestoreDefaults) > 0 && $CAT_RIGHT == "W" && check_bitrix_sessid()) {
        COption::RemoveOption("ws.projectsettings");
        $z  = CGroup::GetList($v1 = "id", $v2 = "asc", array("ACTIVE" => "Y", "ADMIN"  => "N"));
        while ($zr      = $z->Fetch())
            $APPLICATION->DelGroupRight($module_id, array($zr["ID"]));
        LocalRedirect($APPLICATION->GetCurPage() . "?lang=" . LANG . "&mid=" . urlencode($mid));
    }

    $aTabs = array(
        array("DIV"       => "edit1", "TAB"       => GetMessage("MAIN_TAB_RIGHTS"), "TITLE"     => GetMessage("MAIN_TAB_TITLE_RIGHTS")),
    );
    $tabControl = new CAdminTabControl("tabControl", $aTabs);

    $tabControl->Begin();
    ?>
    <form method="POST" action="<? echo $APPLICATION->GetCurPage() ?>?mid=<?php 
echo htmlspecialchars($mid);
?>
&lang=<? echo LANG ?>" name="ara">
        <?php 
echo bitrix_sessid_post();
?>
        <?
        $tabControl->BeginNextTab();
예제 #26
0
<? if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();

$group_list = CGroup::GetList(($by = "id"), ($order = "asc"), array("ACTIVE" => "Y"));
$groups = array();

while($group =  $group_list->GetNext()){
    $groups[$group['ID']] = $group['NAME'];
}

$arComponentParameters = array(
    'PARAMETERS' => array(
        'ULOGINID1' => array(
            'NAME' => GetMessage("TALKHARD_ULOGIN_PANEL_ID1"),
            'TYPE' => 'STRING',
            'MULTIPLE' => 'N',
            'DEFAULT' => '',
            'PARENT' => 'BASE',
        ),
        'ULOGINID2' => array(
            'NAME' => GetMessage("TALKHARD_ULOGIN_PANEL_ID2"),
            'TYPE' => 'STRING',
            'MULTIPLE' => 'N',
            'DEFAULT' => '',
            'PARENT' => 'BASE',
        ),
	"SEND_MAIL" => array(
	  'NAME' => GetMessage("TALKHARD_ULOGIN_OTPRAVLATQ").' email '.GetMessage("TALKHARD_ULOGIN_ADMINISTRATORU_PRI_R"),
	  'TYPE' => 'CHECKBOX',
	  'PARENT' => 'BASE',
	  'DEFAULT' => 'N'
	),
예제 #27
0
}
if ($templateID === false) {
    //Get default template if templateID not set
    $obTemplate = CSite::GetTemplateList($site);
    while ($arSiteTemplate = $obTemplate->Fetch()) {
        if (strlen($arSiteTemplate["CONDITION"]) <= 0) {
            $templateID = $arSiteTemplate["TEMPLATE"];
            break;
        }
    }
}
//default edit groups - need to limit access
$edit_groups = explode(",", COption::GetOptionString('fileman', 'default_edit_groups', ''));
$arGroupList = array();
$arEditGroups = array();
$gr = CGroup::GetList($v1 = "sort", $v2 = "asc", array("ACTIVE" => "Y", "ADMIN" => "N", "ANONYMOUS" => "N"));
while ($group = $gr->Fetch()) {
    $arGroupList[$group["ID"]] = $group;
    if (in_array($group["ID"], $edit_groups)) {
        $arEditGroups[$group["ID"]] = $group["ID"];
    }
}
$bAdmin = $USER->CanDoFileOperation("fm_edit_permission", array($site, $path));
$strWarning = "";
//Check post values
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_REQUEST["save"])) {
    CUtil::JSPostUnescape();
    $fileName = isset($_REQUEST["fileName"]) ? $_REQUEST["fileName"] : "";
    $pageTitle = isset($_REQUEST["pageTitle"]) ? $_REQUEST["pageTitle"] : "";
    $editAfterSave = isset($_REQUEST["editAfterSave"]) && $_REQUEST["editAfterSave"] == "Y";
    $addToMenu = isset($_REQUEST["addToMenu"]) && $_REQUEST["addToMenu"] == "Y";
예제 #28
0
 function InstallService($serviceID, $serviceStage)
 {
     $wizard =& $this->GetWizard();
     $siteID = WizardServices::GetCurrentSiteID($wizard->GetVar("siteID"));
     define("WIZARD_SITE_ID", $siteID);
     define("WIZARD_SITE_ROOT_PATH", $_SERVER["DOCUMENT_ROOT"]);
     $rsSites = CSite::GetByID($siteID);
     if ($arSite = $rsSites->Fetch()) {
         define("WIZARD_SITE_DIR", $arSite["DIR"]);
     } else {
         define("WIZARD_SITE_DIR", "/");
     }
     define("WIZARD_SITE_PATH", str_replace("//", "/", WIZARD_SITE_ROOT_PATH . "/" . WIZARD_SITE_DIR . "/"));
     $wizardPath = $wizard->GetPath();
     define("WIZARD_RELATIVE_PATH", $wizardPath);
     define("WIZARD_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . $wizardPath);
     $templatesPath = WizardServices::GetTemplatesPath(WIZARD_RELATIVE_PATH . "/site");
     $arTemplates = WizardServices::GetTemplates($templatesPath);
     $templateID = $wizard->GetVar("templateID");
     define("WIZARD_TEMPLATE_ID", $templateID);
     define("WIZARD_TEMPLATE_RELATIVE_PATH", $templatesPath . "/" . WIZARD_TEMPLATE_ID);
     define("WIZARD_TEMPLATE_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . WIZARD_TEMPLATE_RELATIVE_PATH);
     $themeID = $wizard->GetVar($templateID . "_themeID");
     $arThemes = WizardServices::GetThemes(WIZARD_TEMPLATE_RELATIVE_PATH . "/themes");
     define("WIZARD_THEME_ID", $themeID);
     define("WIZARD_THEME_RELATIVE_PATH", WIZARD_TEMPLATE_RELATIVE_PATH . "/themes/" . WIZARD_THEME_ID);
     define("WIZARD_THEME_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . WIZARD_THEME_RELATIVE_PATH);
     $servicePath = WIZARD_RELATIVE_PATH . "/site/services/" . $serviceID;
     define("WIZARD_SERVICE_RELATIVE_PATH", $servicePath);
     define("WIZARD_SERVICE_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . $servicePath);
     define("WIZARD_IS_RERUN", $_SERVER["PHP_SELF"] != "/index.php");
     define("WIZARD_SITE_LOGO", intval($wizard->GetVar("siteLogo")));
     define("WIZARD_INSTALL_DEMO_DATA", $wizard->GetVar("installDemoData") == "Y");
     define("WIZARD_REINSTALL_DATA", false);
     define("WIZARD_FIRST_INSTAL", $firstStep = COption::GetOptionString("main", "wizard_first" . substr($wizard->GetID(), 7) . "_" . $wizard->GetVar("siteID"), false, $wizard->GetVar("siteID")));
     $dbUsers = CGroup::GetList($by = "id", $order = "asc", array("ACTIVE" => "Y"));
     while ($arUser = $dbUsers->Fetch()) {
         define("WIZARD_" . $arUser["STRING_ID"] . "_GROUP", $arUser["ID"]);
     }
     if (!file_exists(WIZARD_SERVICE_ABSOLUTE_PATH . "/" . $serviceStage)) {
         return false;
     }
     if (LANGUAGE_ID != "en" && LANGUAGE_ID != "ru") {
         if (file_exists($fname = WIZARD_SERVICE_ABSOLUTE_PATH . "/lang/" . LangSubst(LANGUAGE_ID) . "/" . $serviceStage)) {
             __IncludeLang($fname, false, true);
         }
     }
     if (file_exists($fname = WIZARD_SERVICE_ABSOLUTE_PATH . "/lang/" . LANGUAGE_ID . "/" . $serviceStage)) {
         __IncludeLang($fname, false, true);
     }
     @set_time_limit(3600);
     global $DB, $DBType, $APPLICATION, $USER, $CACHE_MANAGER;
     include WIZARD_SERVICE_ABSOLUTE_PATH . "/" . $serviceStage;
 }
예제 #29
0
	/**
	 * Shows data form in admin part when you edit or add usertype.
	 * @param bool $arUserField
	 * @param string $arHtmlControl
	 * @param bool $bVarsFromForm
	 * @return string
	 */
	function GetSettingsHTML($arUserField = false, $arHtmlControl, $bVarsFromForm)
	{
		if (!CModule::IncludeModule("vote"))
			return '';
		$value = "";
		if($bVarsFromForm)
			$value = $GLOBALS[$arHtmlControl["NAME"]]["CHANNEL_ID"];
		elseif(is_array($arUserField)){
			$value = $arUserField["SETTINGS"]["CHANNEL_ID"];
			$GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"] = $arUserField["SETTINGS"]["NOTIFY"];
		}
		$value = (!empty($value) ? intval($value) : "add");
		$db_res = CVoteChannel::GetList($by = "", $order = "", array("ACTIVE" => "Y"), $is_filtered);
		$arVoteChannels = array("reference" => array(GetMessage("V_NEW_CHANNEL")), "reference_id" => array("add"));
		if ($db_res && $res = $db_res->Fetch())
		{
			do
			{
				$arVoteChannels["reference"][] = $res["TITLE"];
				$arVoteChannels["reference_id"][] = $res["ID"];
			} while ($res = $db_res->Fetch());
		}

		ob_start();
?>
	<tr>
		<td><?php 
echo GetMessage("V_CHANNEL_ID_COLON");
?>
</td>
		<td><?php 
echo str_replace("<select", "<select onchange='if(this.value!=\"add\"){BX.hide(BX(\"channel_create\"));BX.show(this.nextSibling);}" . "else{BX(\"channel_create\").style.display=\"\";BX.hide(this.nextSibling);}' ", SelectBoxFromArray($arHtmlControl["NAME"] . "[CHANNEL_ID]", $arVoteChannels, $value));
?>
<a style="margin-left: 1em;" href="" rel="/bitrix/admin/vote_channel_edit.php?ID=#id#" <?
			?>onmousedown="this.href=this.rel.replace('#id#',this.previousSibling.value);"><?php 
echo GetMessage("V_CHANNEL_ID_EDIT");
?>
</a></td>
	</tr>
	<tbody id="channel_create" style="<?if ($value != "add") {?>display:none;<?}?>">
	<tr class="adm-detail-required-field">
		<td class="adm-detail-content-cell-l" width="40%"><?php 
echo GetMessage("V_CHANNEL_ID_TITLE");
?>
</td>
		<td class="adm-detail-content-cell-r" width="60%"><input type="text" name="<?php 
echo $arHtmlControl["NAME"];
?>
[CHANNEL_TITLE]" <?
			?>value="<?php 
echo htmlspecialcharsbx($GLOBALS[$arHtmlControl["NAME"]]["CHANNEL_TITLE"]);
?>
" /></td>
	</tr>
	<tr class="adm-detail-required-field">
		<td class="adm-detail-content-cell-l"><?php 
echo GetMessage("V_CHANNEL_ID_SYMBOLIC_NAME");
?>
</td>
		<td class="adm-detail-content-cell-r"><input type="text" name="<?php 
echo $arHtmlControl["NAME"];
?>
[CHANNEL_SYMBOLIC_NAME]" <?
			?>value="<?php 
echo htmlspecialcharsbx($GLOBALS[$arHtmlControl["NAME"]]["CHANNEL_SYMBOLIC_NAME"]);
?>
" /></td>
	</tr>
	<tr>
		<td class="adm-detail-content-cell-l">&nbsp;</td>
		<td class="adm-detail-content-cell-r"><input type="checkbox" name="<?php 
echo $arHtmlControl["NAME"];
?>
[CHANNEL_USE_CAPTCHA]" <?
			?>id="CHANNEL_USE_CAPTCHA" <?if ($GLOBALS[$arHtmlControl["NAME"]]["CHANNEL_USE_CAPTCHA"] == "Y"){?> checked <?}
			?>value="Y" /> <label for="CHANNEL_USE_CAPTCHA"><?php 
echo GetMessage("V_CHANNEL_ID_USE_CAPTCHA");
?>
</label></td>
	</tr><?
	$db_res = CGroup::GetList($by = "sort", $order = "asc", Array("ADMIN" => "N"));
	while ($group = $db_res->GetNext())
	{
		if($bVarsFromForm)
			$value = $GLOBALS[$arHtmlControl["NAME"]]["GROUP_ID"][$group["ID"]];
		else
			$value = ($group["ID"] == 2 ? 1 : ($group["ID"] == 1 ? 4 : 2));
?>
	<tr>
		<td class="adm-detail-content-cell-l"><?php 
echo $group["NAME"] . ":";
?>
</td>
		<td class="adm-detail-content-cell-r"><?php 
echo SelectBoxFromArray("GROUP_ID[" . $group["ID"] . "]", $GLOBALS["aVotePermissions"], $value);
?>
</td>
	</tr><?
	}

?>
	</tbody>
<?
		if($bVarsFromForm)
		{
			$GLOBALS[$arHtmlControl["NAME"]]['UNIQUE'] = is_array($GLOBALS[$arHtmlControl["NAME"]]['UNIQUE']) ?
				$GLOBALS[$arHtmlControl["NAME"]]['UNIQUE'] : array();
			$uniqType = 0;
			foreach ($GLOBALS[$arHtmlControl["NAME"]]['UNIQUE'] as $res)
				$uniqType |= $res;
		}
		else
		{
			$uniqType = ($arUserField["SETTINGS"]["UNIQUE"] ? $arUserField["SETTINGS"]["UNIQUE"] : 13);
			if (is_array($arUserField["SETTINGS"]["UNIQUE"])) {
				foreach ( $arUserField["SETTINGS"]["UNIQUE"] as $res) {
					$uniqType |= $res; }
				$uniqType += 5;
			}
			$uniqType -=5;
		}
?>
<script language="javascript">
function __utch(show)
{
	if (BX("UNIQUE_TYPE_IP").checked)
		BX.show(BX("DELAY_TYPE"), "");
	else
		BX.hide(BX("DELAY_TYPE"));

	var
		show = BX("UNIQUE_TYPE_USER_ID").checked,
		res = BX("UNIQUE_TYPE_USER_ID_NEW");
	res.disabled = !show;
	if (!!show)
		BX.show(res.parentNode.parentNode, "");
	else
		BX.hide(res.parentNode.parentNode);
}
</script>
	<tr>
		<td class="adm-detail-content-cell-l adm-detail-valign-top" width="40%"><?php 
echo GetMessage("VOTE_NOTIFY");
?>
</td>
		<td class="adm-detail-content-cell-r" width="60%"><?
			$GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"] = (
				$GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"] != "I" && $GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"] != "Y" ?
					"N" : $GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"]);
			if (IsModuleInstalled("im")){?>
				<?php 
echo InputType("radio", $arHtmlControl["NAME"] . "[NOTIFY]", "I", $GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"], false, GetMessage("VOTE_NOTIFY_IM"));
?>
<br /><?
			} else {
				$GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"] = ($GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"] == "I" ?
					"N" : $GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"]);
			}?>
			<?php 
echo InputType("radio", $arHtmlControl["NAME"] . "[NOTIFY]", "Y", $GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"], false, GetMessage("VOTE_NOTIFY_EMAIL"));
?>
<br />
			<?php 
echo InputType("radio", $arHtmlControl["NAME"] . "[NOTIFY]", "N", $GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"], false, GetMessage("VOTE_NOTIFY_N"));
?>
<?
			?></td>
	</tr>
	<tr>
		<td class="adm-detail-content-cell-l adm-detail-valign-top"><?php 
echo GetMessage("V_UNIQUE");
?>
</td>
		<td class="adm-detail-content-cell-r">
			<? if (IsModuleInstalled('statistic')) { ?>
			<input type="checkbox" name="<?php 
echo $arHtmlControl["NAME"];
?>
[UNIQUE][]" id="UNIQUE_TYPE_SESSION" value="1" <?php 
echo $uniqType & 1 ? " checked" : "";
?>
 />
			<label for="UNIQUE_TYPE_SESSION"><?php 
echo GetMessage("V_UNIQUE_SESSION");
?>
</label><br />
			<? } ?>
			<input type="checkbox" name="<?php 
echo $arHtmlControl["NAME"];
?>
[UNIQUE][]" id="UNIQUE_TYPE_COOKIE" value="2" <?php 
echo $uniqType & 2 ? " checked" : "";
?>
 />
			<label for="UNIQUE_TYPE_COOKIE"><?php 
echo GetMessage("V_UNIQUE_COOKIE_ONLY");
?>
</label><br />
			<input type="checkbox" name="<?php 
echo $arHtmlControl["NAME"];
?>
[UNIQUE][]" id="UNIQUE_TYPE_IP" onclick="__utch()" value="4" <?
				?><?php 
echo $uniqType & 4 ? " checked" : "";
?>
 />
			<label for="UNIQUE_TYPE_IP"><?php 
echo GetMessage("V_UNIQUE_IP_ONLY");
?>
</label><br />
			<input type="checkbox" name="<?php 
echo $arHtmlControl["NAME"];
?>
[UNIQUE][]" id="UNIQUE_TYPE_USER_ID" onclick="__utch();" value="8" <?
				?><?php 
echo $uniqType & 8 ? " checked" : "";
?>
 />
			<label for="UNIQUE_TYPE_USER_ID"><?php 
echo GetMessage("V_UNIQUE_USER_ID_ONLY");
?>
</label><br />
		</td>
	</tr>
	<tr>
		<td class="adm-detail-content-cell-l" width="40%">&nbsp;</td>
		<td class="adm-detail-content-cell-r" width="60%"><input type="checkbox" name="<?php 
echo $arHtmlControl["NAME"];
?>
[UNIQUE][]" id="UNIQUE_TYPE_USER_ID_NEW" value="16" <?
			?><?php 
echo $uniqType & 16 ? " checked " : "";
?>
<?
			?><?php 
echo $uniqType & 8 ? "" : " disabled";
?>
 /> <label for="UNIQUE_TYPE_USER_ID_NEW"><?php 
echo GetMessage("V_UNIQUE_USER_ID_NEW");
?>
</label>
		</td>
	</tr>
	<?
		if($bVarsFromForm)
			$value = $GLOBALS[$arHtmlControl["NAME"]]["UNIQUE_IP_DELAY"];
		else
			$value = (is_array($arUserField) ?
				$arUserField["SETTINGS"]["UNIQUE_IP_DELAY"] :
					array("DELAY" => "10", "DELAY_TYPE" => "D"));
		?>
	<tr id="DELAY_TYPE">
		<td class="adm-detail-content-cell-l" width="40%"><?php 
echo GetMessage("V_UNIQUE_IP_DELAY");
?>
</td>
		<td class="adm-detail-content-cell-r" width="60%">
			<input type="text" name="<?php 
echo $arHtmlControl["NAME"];
?>
[UNIQUE_IP_DELAY][DELAY]" value="<?php 
echo htmlspecialcharsbx($value["DELAY"]);
?>
" />
			<?php 
echo SelectBoxFromArray($arHtmlControl["NAME"] . "[UNIQUE_IP_DELAY][DELAY_TYPE]", array("reference_id" => array("S", "M", "H", "D"), "reference" => array(GetMessage("V_SECONDS"), GetMessage("V_MINUTES"), GetMessage("V_HOURS"), GetMessage("V_DAYS"))), $value["DELAY_TYPE"]);
?>
<script type="text/javascript">
BX.ready(function(){
	if (!!document.forms.post_form.MULTIPLE)
		BX.hide(document.forms.post_form.MULTIPLE.parentNode.parentNode);
	__utch();
});
</script>

		</td>
	</tr>
	<?
	return ob_get_clean();
	}
예제 #30
0
 function GetGroupsByRole($role)
 {
     global $APPLICATION, $USER;
     if (!is_object($USER)) {
         $USER = new CUser();
     }
     $arGroups = array();
     $z = CGroup::GetList($v1 = "dropdown", $v2 = "asc", array("ACTIVE" => "Y"));
     while ($zr = $z->Fetch()) {
         $arRoles = $APPLICATION->GetUserRoles("advertising", array(intval($zr["ID"])), "Y", "N");
         if (in_array($role, $arRoles)) {
             $arGroups[] = intval($zr["ID"]);
         }
     }
     return array_unique($arGroups);
 }