本文整理匯總了PHP中is_set函數的典型用法代碼示例。如果您正苦於以下問題:PHP is_set函數的具體用法?PHP is_set怎麽用?PHP is_set使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了is_set函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: CheckFields
function CheckFields($ACTION, &$arFields, $ID = 0)
{
if ((is_set($arFields, "SITE_ID") || $ACTION == "ADD") && StrLen($arFields["SITE_ID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SCGAT1_NO_SITE"), "EMPTY_SITE_ID");
return false;
}
if (is_set($arFields, "RATE1")) {
$arFields["RATE1"] = str_replace(",", ".", $arFields["RATE1"]);
$arFields["RATE1"] = DoubleVal($arFields["RATE1"]);
}
if (is_set($arFields, "RATE2")) {
$arFields["RATE2"] = str_replace(",", ".", $arFields["RATE2"]);
$arFields["RATE2"] = DoubleVal($arFields["RATE2"]);
}
if (is_set($arFields, "RATE3")) {
$arFields["RATE3"] = str_replace(",", ".", $arFields["RATE3"]);
$arFields["RATE3"] = DoubleVal($arFields["RATE3"]);
}
if (is_set($arFields, "RATE4")) {
$arFields["RATE4"] = str_replace(",", ".", $arFields["RATE4"]);
$arFields["RATE4"] = DoubleVal($arFields["RATE4"]);
}
if (is_set($arFields, "RATE5")) {
$arFields["RATE5"] = str_replace(",", ".", $arFields["RATE5"]);
$arFields["RATE5"] = DoubleVal($arFields["RATE5"]);
}
return True;
}
示例2: CheckFields
function CheckFields($ACTION, &$arFields, $ID = 0)
{
global $APPLICATION;
if ((is_set($arFields, "PRODUCT_ID") || $ACTION == "ADD") && intval($arFields["PRODUCT_ID"]) <= 0) {
$APPLICATION->ThrowException(Loc::getMessage("KGP_EMPTY_PRODUCT"), "EMPTY_PRODUCT_ID");
return false;
}
if ((is_set($arFields, "CATALOG_GROUP_ID") || $ACTION == "ADD") && intval($arFields["CATALOG_GROUP_ID"]) <= 0) {
$APPLICATION->ThrowException(Loc::getMessage("KGP_EMPTY_CATALOG_GROUP"), "EMPTY_CATALOG_GROUP_ID");
return false;
}
if ((is_set($arFields, "CURRENCY") || $ACTION == "ADD") && strlen($arFields["CURRENCY"]) <= 0) {
$APPLICATION->ThrowException(Loc::getMessage("KGP_EMPTY_CURRENCY"), "EMPTY_CURRENCY");
return false;
}
if (isset($arFields['CURRENCY'])) {
if (!($arCurrency = CCurrency::GetByID($arFields["CURRENCY"]))) {
$APPLICATION->ThrowException(Loc::getMessage("KGP_NO_CURRENCY", array('#ID#' => $arFields["CURRENCY"])), "CURRENCY");
return false;
}
}
if (is_set($arFields, "PRICE") || $ACTION == "ADD") {
$arFields["PRICE"] = str_replace(",", ".", $arFields["PRICE"]);
$arFields["PRICE"] = DoubleVal($arFields["PRICE"]);
}
if ((is_set($arFields, "QUANTITY_FROM") || $ACTION == "ADD") && intval($arFields["QUANTITY_FROM"]) <= 0) {
$arFields["QUANTITY_FROM"] = false;
}
if ((is_set($arFields, "QUANTITY_TO") || $ACTION == "ADD") && intval($arFields["QUANTITY_TO"]) <= 0) {
$arFields["QUANTITY_TO"] = false;
}
return true;
}
示例3: CheckFields
public static function CheckFields(&$arFields, $ID = false)
{
$arErrMsg = Array();
if($ID>0)
unset($arFields["ID"]);
global $DB;
if(($ID===false || is_set($arFields, "NAME")) && strlen($arFields["NAME"])<=0)
$arMsg[] = array("id"=>"NAME", "text"=> GetMessage("CTRLR_GRP_ERR_NAME"));
if(isset($arFields["UPDATE_PERIOD"]) && ($arFields["UPDATE_PERIOD"]<0 || trim($arFields["UPDATE_PERIOD"])==''))
$arFields["UPDATE_PERIOD"] = -1;
if(count($arMsg)>0)
{
$e = new CAdminException($arMsg);
$GLOBALS["APPLICATION"]->ThrowException($e);
return false;
}
global $USER;
if(!is_set($arFields, "MODIFIED_BY") && is_object($USER))
$arFields["MODIFIED_BY"] = $USER->GetID();
if($ID===false && !is_set($arFields, "CREATED_BY") && is_object($USER))
$arFields["CREATED_BY"] = $USER->GetID();
if($ID===false && !is_set($arFields, "DATE_CREATE"))
$arFields["~DATE_CREATE"] = $DB->CurrentTimeFunction();
return true;
}
示例4: CheckFields
function CheckFields($ACTION, &$arFields)
{
if ((is_set($arFields, "SMILE_TYPE") || $ACTION == "ADD") && $arFields["SMILE_TYPE"] != "I" && $arFields["SMILE_TYPE"] != "S") {
return False;
}
if ((is_set($arFields, "IMAGE") || $ACTION == "ADD") && strlen($arFields["IMAGE"]) <= 0) {
return False;
}
if ((is_set($arFields, "SORT") || $ACTION == "ADD") && IntVal($arFields["SORT"]) <= 0) {
$arFields["SORT"] = 150;
}
if (is_set($arFields, "LANG") || $ACTION == "ADD") {
for ($i = 0; $i < count($arFields["LANG"]); $i++) {
if (!is_set($arFields["LANG"][$i], "LID") || strlen($arFields["LANG"][$i]["LID"]) <= 0) {
return false;
}
if (!is_set($arFields["LANG"][$i], "NAME") || strlen($arFields["LANG"][$i]["NAME"]) <= 0) {
return false;
}
}
$db_lang = CLangAdmin::GetList($b = "sort", $o = "asc", array("ACTIVE" => "Y"));
while ($arLang = $db_lang->Fetch()) {
$bFound = False;
for ($i = 0; $i < count($arFields["LANG"]); $i++) {
if ($arFields["LANG"][$i]["LID"] == $arLang["LID"]) {
$bFound = True;
}
}
if (!$bFound) {
return false;
}
}
}
return True;
}
示例5: CheckFields
function CheckFields(&$arFields, $ID = false)
{
global $DB, $APPLICATION;
if ($ID === false && !is_set($arFields, "STUDENT_ID")) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_USER_ID"), "EMPTY_STUDENT_ID");
return false;
} elseif (is_set($arFields, "STUDENT_ID")) {
$dbResult = CUser::GetByID($arFields["STUDENT_ID"]);
if (!$dbResult->Fetch()) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_USER_ID_EX"), "ERROR_NO_STUDENT_ID");
return false;
}
}
if ($ID === false && !is_set($arFields, "TEST_ID")) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_TEST_ID"), "EMPTY_TEST_ID");
return false;
} elseif (is_set($arFields, "TEST_ID")) {
$r = CTest::GetByID($arFields["TEST_ID"]);
if (!$r->Fetch()) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_TEST_ID_EX"), "ERROR_NO_TEST_ID");
return false;
}
}
if (is_set($arFields, "STUDENT_ID") && is_set($arFields, "TEST_ID")) {
$res = CGradeBook::GetList(array(), array("STUDENT_ID" => $arFields["STUDENT_ID"], "TEST_ID" => $arFields["TEST_ID"]));
if ($res->Fetch()) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_GRADEBOOK_DUPLICATE"), "ERROR_GRADEBOOK_DUPLICATE");
return false;
}
}
if (is_set($arFields, "COMPLETED") && $arFields["COMPLETED"] != "Y") {
$arFields["COMPLETED"] = "N";
}
return true;
}
示例6: Update
public static function Update($ID, $arFields)
{
global $DB, $CACHE_MANAGER;
$ID = IntVal($ID);
if ($ID <= 0) {
return False;
}
if (!CBlogSmile::CheckFields("UPDATE", $arFields)) {
return false;
}
$strUpdate = $DB->PrepareUpdate("b_blog_smile", $arFields);
$strSql = "UPDATE b_blog_smile SET " . $strUpdate . " WHERE ID = " . $ID;
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if (is_set($arFields, "LANG")) {
$DB->Query("DELETE FROM b_blog_smile_lang WHERE SMILE_ID = " . $ID . "");
for ($i = 0; $i < count($arFields["LANG"]); $i++) {
$arInsert = $DB->PrepareInsert("b_blog_smile_lang", $arFields["LANG"][$i]);
$strSql = "INSERT INTO b_blog_smile_lang(SMILE_ID, " . $arInsert[0] . ") " . "VALUES(" . $ID . ", " . $arInsert[1] . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
}
$CACHE_MANAGER->Clean("b_blog_smile");
BXClearCache(true, "/blog/smiles/");
return $ID;
}
示例7: CheckFields
function CheckFields(&$arFields, $ID = false)
{
global $DB;
$arMsg = array();
if ((is_set($arFields, "MARK") || $ID === false) && strlen($arFields["MARK"]) <= 0) {
$arMsg[] = array("id" => "MARK", "text" => GetMessage("LEARNING_BAD_MARK"));
}
if ($ID === false && !is_set($arFields, "TEST_ID") || is_set($arFields, "TEST_ID") && intval($arFields["TEST_ID"]) < 1) {
$arMsg[] = array("id" => "TEST_ID", "text" => GetMessage("LEARNING_BAD_TEST_ID"));
} elseif (is_set($arFields, "TEST_ID")) {
$res = CTest::GetByID($arFields["TEST_ID"]);
if (!($arRes = $res->Fetch())) {
$arMsg[] = array("id" => "TEST_ID", "text" => GetMessage("LEARNING_BAD_TEST_ID"));
}
}
if (!is_set($arFields, "SCORE") || intval($arFields["SCORE"]) > 100 || intval($arFields["SCORE"]) < 1) {
$arMsg[] = array("id" => "SCORE", "text" => GetMessage("LEARNING_BAD_MARK_SCORE"));
}
if (!empty($arMsg)) {
$e = new CAdminException($arMsg);
$GLOBALS["APPLICATION"]->ThrowException($e);
return false;
}
return true;
}
示例8: CheckFields
public static function CheckFields(&$arFields, $ID = false)
{
global $DB, $APPLICATION;
$arMsg = array();
if ((is_set($arFields, "USER_ID") || $ID === false) && intval($arFields["USER_ID"]) <= 0) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_USER_ID"), "EMPTY_USER_ID");
return false;
} elseif (is_set($arFields, "USER_ID")) {
$dbResult = CUser::GetByID($arFields["USER_ID"]);
if (!$dbResult->Fetch()) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_USER_ID_EX"), "ERROR_NO_USER_ID");
return false;
}
$dbResult = CStudent::GetList(array(), array("USER_ID" => $arFields["USER_ID"]));
if ($dbResult->Fetch()) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_USER_ID_EXISTS"), "ERROR_USER_ID_EXISTS");
return false;
}
}
if ($ID === false && !is_set($arFields, "TRANSCRIPT")) {
$arFields["TRANSCRIPT"] = CStudent::GenerateTranscipt();
} elseif (is_set($arFields, "TRANSCRIPT") && !preg_match("~^[0-9]{6,}\$~", $arFields["TRANSCRIPT"])) {
$arFields["TRANSCRIPT"] = CStudent::GenerateTranscipt();
}
if (is_set($arFields, "PUBLIC_PROFILE") && $arFields["PUBLIC_PROFILE"] != "N") {
$arFields["ACTIVE"] = "Y";
}
return true;
}
示例9: CheckFields
public static function CheckFields($ACTION, &$arFields, $ID = 0)
{
if ((is_set($arFields, "USER_ID") || $ACTION == "ADD") && IntVal($arFields["USER_ID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGU_EMPTY_USER_ID"), "EMPTY_USER_ID");
return false;
}
if ((is_set($arFields, "CURRENCY") || $ACTION == "ADD") && strlen($arFields["CURRENCY"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGU_EMPTY_CURRENCY"), "EMPTY_CURRENCY");
return false;
}
if (is_set($arFields, "CURRENT_BUDGET") || $ACTION == "ADD") {
$arFields["CURRENT_BUDGET"] = str_replace(",", ".", $arFields["CURRENT_BUDGET"]);
$arFields["CURRENT_BUDGET"] = DoubleVal($arFields["CURRENT_BUDGET"]);
}
if ((is_set($arFields, "LOCKED") || $ACTION == "ADD") && $arFields["LOCKED"] != "Y") {
$arFields["LOCKED"] = "N";
}
if (is_set($arFields, "USER_ID")) {
$dbUser = CUser::GetByID($arFields["USER_ID"]);
if (!$dbUser->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["USER_ID"], GetMessage("SKGU_NO_USER")), "ERROR_NO_USER_ID");
return false;
}
}
return True;
}
示例10: CheckFields
protected function CheckFields($action, &$arFields)
{
if (is_set($arFields["ADDRESS"]) && strlen($arFields["ADDRESS"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("CS_EMPTY_ADDRESS"));
$arFields["ADDRESS"] = ' ';
}
if ($action == 'ADD' && (is_set($arFields, "IMAGE_ID") && strlen($arFields["IMAGE_ID"]) < 0)) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("CS_WRONG_IMG"));
return false;
}
if ($action == 'ADD' && (is_set($arFields, "LOCATION_ID") && intval($arFields["LOCATION_ID"]) <= 0)) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("CS_WRONG_LOC"));
return false;
}
if ($action == 'UPDATE' && is_set($arFields, "ID")) {
unset($arFields["ID"]);
}
if ($action == 'UPDATE' && strlen($arFields["IMAGE_ID"]) <= 0) {
unset($arFields["IMAGE_ID"]);
}
if (isset($arFields["ISSUING_CENTER"]) && $arFields["ISSUING_CENTER"] !== 'Y') {
$arFields["ISSUING_CENTER"] = 'N';
}
if (isset($arFields["SHIPPING_CENTER"]) && $arFields["SHIPPING_CENTER"] !== 'Y') {
$arFields["SHIPPING_CENTER"] = 'N';
}
if (isset($arFields["SITE_ID"]) && $arFields["SITE_ID"] === '0') {
$arFields["SITE_ID"] = '';
}
return true;
}
示例11: Update
public static function Update($id, $arFields)
{
global $DB;
$id = intval($id);
if ($id <= 0) {
throw new Exception("id");
}
self::ParseFields($arFields, $id);
$strUpdate = $DB->PrepareUpdate("b_bp_task", $arFields);
$strSql = "UPDATE b_bp_task SET " . "\t" . $strUpdate . ", " . "\tMODIFIED = " . $DB->CurrentTimeFunction() . " " . "WHERE ID = " . intval($id) . " ";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if (is_set($arFields, "USERS")) {
$DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = " . intval($id) . " ");
CUserCounter::ClearByTag($id, 'bp_tasks', '**');
$ar = array();
foreach ($arFields["USERS"] as $userId) {
$userId = intval($userId);
if (in_array($userId, $ar)) {
continue;
}
$DB->Query("INSERT INTO b_bp_task_user (USER_ID, TASK_ID) " . "VALUES (" . intval($userId) . ", " . intval($id) . ") ");
CUserCounter::Increment($userId, 'bp_tasks', '**');
$ar[] = $userId;
}
}
$events = GetModuleEvents("bizproc", "OnTaskUpdate");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($id, $arFields));
}
return $id;
}
示例12: CheckFields
public static function CheckFields($ACTION, &$arFields, $ID = 0)
{
global $APPLICATION;
if ((is_set($arFields, "PRODUCT_ID") || $ACTION=="ADD") && intval($arFields["PRODUCT_ID"]) <= 0)
{
$APPLICATION->ThrowException(GetMessage("KGP_EMPTY_PRODUCT"), "EMPTY_PRODUCT_ID");
return false;
}
if ((is_set($arFields, "CATALOG_GROUP_ID") || $ACTION=="ADD") && intval($arFields["CATALOG_GROUP_ID"]) <= 0)
{
$APPLICATION->ThrowException(GetMessage("KGP_EMPTY_CATALOG_GROUP"), "EMPTY_CATALOG_GROUP_ID");
return false;
}
if ((is_set($arFields, "CURRENCY") || $ACTION=="ADD") && strlen($arFields["CURRENCY"]) <= 0)
{
$APPLICATION->ThrowException(GetMessage("KGP_EMPTY_CURRENCY"), "EMPTY_CURRENCY");
return false;
}
if (is_set($arFields, "PRICE") || $ACTION=="ADD")
{
$arFields["PRICE"] = str_replace(",", ".", $arFields["PRICE"]);
$arFields["PRICE"] = DoubleVal($arFields["PRICE"]);
}
if ((is_set($arFields, "QUANTITY_FROM") || $ACTION=="ADD") && intval($arFields["QUANTITY_FROM"]) <= 0)
$arFields["QUANTITY_FROM"] = false;
if ((is_set($arFields, "QUANTITY_TO") || $ACTION=="ADD") && intval($arFields["QUANTITY_TO"]) <= 0)
$arFields["QUANTITY_TO"] = false;
return true;
}
示例13: CheckFields
public static function CheckFields($ACTION, &$arFields, $ID = 0)
{
global $DB, $USER;
if (is_set($arFields, "PERSON_TYPE_ID") && $ACTION!="ADD")
UnSet($arFields["PERSON_TYPE_ID"]);
if ((is_set($arFields, "PERSON_TYPE_ID") || $ACTION=="ADD") && IntVal($arFields["PERSON_TYPE_ID"]) <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOPG_EMPTY_PERS_TYPE"), "ERROR_NO_PERSON_TYPE");
return false;
}
if ((is_set($arFields, "NAME") || $ACTION=="ADD") && strlen($arFields["NAME"]) <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOPG_EMPTY_GROUP"), "ERROR_NO_NAME");
return false;
}
if (is_set($arFields, "PERSON_TYPE_ID"))
{
if (!($arPersonType = CSalePersonType::GetByID($arFields["PERSON_TYPE_ID"])))
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["PERSON_TYPE_ID"], GetMessage("SKGOPG_NO_PERS_TYPE")), "ERROR_NO_PERSON_TYPE");
return false;
}
}
return True;
}
示例14: CheckFields
function CheckFields($ACTION, &$arFields)
{
global $DB, $USER;
if ((is_set($arFields, "NAME") || $ACTION == "ADD") && strlen($arFields["NAME"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGPSA_NO_NAME"), "ERROR_NO_NAME");
return false;
}
if (is_set($arFields, "NEW_WINDOW") && $arFields["NEW_WINDOW"] != "Y") {
$arFields["NEW_WINDOW"] = "N";
}
if (is_set($arFields, "HAVE_PAYMENT") && $arFields["HAVE_PAYMENT"] != "Y") {
$arFields["HAVE_PAYMENT"] = "N";
}
if (is_set($arFields, "HAVE_ACTION") && $arFields["HAVE_ACTION"] != "Y") {
$arFields["HAVE_ACTION"] = "N";
}
if (is_set($arFields, "HAVE_RESULT") && $arFields["HAVE_RESULT"] != "Y") {
$arFields["HAVE_RESULT"] = "N";
}
if (is_set($arFields, "HAVE_PREPAY") && $arFields["HAVE_PREPAY"] != "Y") {
$arFields["HAVE_PREPAY"] = "N";
}
if (is_set($arFields, "HAVE_RESULT_RECEIVE") && $arFields["HAVE_RESULT_RECEIVE"] != "Y") {
$arFields["HAVE_RESULT_RECEIVE"] = "N";
}
if (is_set($arFields, "ENCODING") && strlen($arFields["ENCODING"]) <= 0) {
$arFields["ENCODING"] = false;
}
return True;
}
示例15: CheckFields
function CheckFields($ACTION, &$arFields)
{
global $DB, $USER;
if ((is_set($arFields, "NAME") || $ACTION == "ADD") && strlen($arFields["NAME"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGPS_EMPTY_NAME"), "ERROR_NO_NAME");
return false;
}
/*
if (is_set($arFields, "LID") && $ACTION!="ADD")
UnSet($arFields["LID"]);
if ((is_set($arFields, "CURRENCY") || $ACTION=="ADD") && strlen($arFields["CURRENCY"])<=0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGPS_EMPTY_CURRENCY"), "ERROR_NO_CURRENCY");
return false;
}
*/
if (is_set($arFields, "LID")) {
$dbSite = CSite::GetByID($arFields["LID"]);
if (!$dbSite->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["LID"], GetMessage("SKGPS_NO_SITE")), "ERROR_NO_SITE");
return false;
}
}
if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y") {
$arFields["ACTIVE"] = "N";
}
if (is_set($arFields, "SORT") && IntVal($arFields["SORT"]) <= 0) {
$arFields["SORT"] = 100;
}
return True;
}