public static function unRegisterModule($moduleName) { $con = Application::getInstance()->getConnection(); $con->queryExecute("DELETE FROM b_agent WHERE MODULE_ID='" . $con->getSqlHelper()->forSql($moduleName) . "'"); \CMain::DelGroupRight($moduleName); static::delete($moduleName); $event = new Event("main", "OnAfterUnRegisterModule", array($moduleName)); $event->send(); }
private function SaveGroupRight() { CMain::DelGroupRight($this->module_id); $GROUP = $_REQUEST['GROUPS']; $RIGHT = $_REQUEST['RIGHTS']; foreach ($GROUP as $k => $v) { if ($k == 0) { COption::SetOptionString($this->module_id, 'GROUP_DEFAULT_RIGHT', $RIGHT[0], 'Right for groups by default'); } else { CMain::SetGroupRight($this->module_id, $GROUP[$k], $RIGHT[$k]); } } }
function Delete($ID) { global $APPLICATION, $DB; $ID = IntVal($ID); if ($ID <= 2) { return false; } @set_time_limit(600); $bCanDelete = true; $db_events = GetModuleEvents("main", "OnBeforeGroupDelete"); while ($arEvent = $db_events->Fetch()) { if (ExecuteModuleEventEx($arEvent, array($ID)) === false) { $err = GetMessage("MAIN_BEFORE_DEL_ERR") . ' ' . $arEvent['TO_NAME']; if ($ex = $APPLICATION->GetException()) { $err .= ': ' . $ex->GetString(); } $APPLICATION->throwException($err); return false; } } //проверка - оставил ли тут какой-нибудь модуль обработчик на OnDelete $events = GetModuleEvents("main", "OnGroupDelete"); while ($arEvent = $events->Fetch()) { ExecuteModuleEventEx($arEvent, array($ID)); } CMain::DelGroupRight("", array($ID)); if (!$DB->Query("DELETE FROM b_user_group WHERE GROUP_ID=" . $ID . " AND GROUP_ID>2", true)) { return false; } return $DB->Query("DELETE FROM b_group WHERE ID=" . $ID . " AND ID>2", true); }
function Delete($ID) { /** @global CMain $APPLICATION */ global $APPLICATION, $DB; $ID = intval($ID); if ($ID <= 2) { return false; } @set_time_limit(600); foreach (GetModuleEvents("main", "OnBeforeGroupDelete", true) as $arEvent) { if (ExecuteModuleEventEx($arEvent, array($ID)) === false) { $err = GetMessage("MAIN_BEFORE_DEL_ERR") . ' ' . $arEvent['TO_NAME']; if ($ex = $APPLICATION->GetException()) { $err .= ': ' . $ex->GetString(); } $APPLICATION->throwException($err); return false; } } foreach (GetModuleEvents("main", "OnGroupDelete", true) as $arEvent) { ExecuteModuleEventEx($arEvent, array($ID)); } CMain::DelGroupRight("", array($ID)); if (!$DB->Query("DELETE FROM b_user_group WHERE GROUP_ID=" . $ID . " AND GROUP_ID>2", true)) { return false; } return $DB->Query("DELETE FROM b_group WHERE ID=" . $ID . " AND ID>2", true); }
function UnRegisterModule($id) { global $DB; $DB->Query("DELETE FROM b_agent WHERE MODULE_ID='" . $DB->ForSQL($id) . "'"); CMain::DelGroupRight($id); $m = new CModule(); $m->MODULE_ID = $id; $m->Remove(); $res = GetModuleEvents("main", "OnAfterUnRegisterModule"); while ($arEvent = $res->Fetch()) { ExecuteModuleEventEx($arEvent, array($id)); } }
function UnRegisterModule($id) { global $DB; $DB->Query("DELETE FROM b_agent WHERE MODULE_ID='".$DB->ForSQL($id)."'"); CMain::DelGroupRight($id); $m = new CModule; $m->MODULE_ID = $id; $m->Remove(); }