本文整理汇总了PHP中Utility::sanitizeIntArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Utility::sanitizeIntArray方法的具体用法?PHP Utility::sanitizeIntArray怎么用?PHP Utility::sanitizeIntArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utility
的用法示例。
在下文中一共展示了Utility::sanitizeIntArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DeleteByIDs
/**
* Delete a record by mail ids
* @access public
* @param $mids : mail IDs, for example: "1, 2, 3"
* @return true: if successful
* false: if unsuccessful
* @author Cindy Qi Li
*/
function DeleteByIDs($mids)
{
if (!is_array($mids)) {
return false;
}
$sanitized_mids = Utility::sanitizeIntArray($mids);
$sanitized_mids_str = implode(",", $sanitized_mids);
$sql = "DELETE FROM " . TABLE_PREFIX . "mail_queue WHERE mail_id IN (" . $sanitized_mids_str . ")";
return $this->execute($sql);
}
示例2: getOpenPreChecksByGuidelineIDs
/**
* Return prerequisite checks by given guideline ids
* @access public
* @param $gids : guideline IDs
* @return table rows
* @author Cindy Qi Li
*/
function getOpenPreChecksByGuidelineIDs($gids)
{
if (!is_array($gids)) {
return false;
}
$sanitized_gids = Utility::sanitizeIntArray($gids);
$sql = "select distinct c.check_id, cp.prerequisite_check_id\n\t\t\t\t\tfrom " . TABLE_PREFIX . "guidelines g, \n\t\t\t\t\t " . TABLE_PREFIX . "guideline_groups gg, \n\t\t\t\t\t " . TABLE_PREFIX . "guideline_subgroups gs, \n\t\t\t\t\t " . TABLE_PREFIX . "subgroup_checks gc,\n\t\t\t\t\t " . TABLE_PREFIX . "checks c,\n\t\t\t\t\t " . TABLE_PREFIX . "check_prerequisites cp\n\t\t\t\t\twhere g.guideline_id in (" . implode(",", $sanitized_gids) . ")\n\t\t\t\t\t and g.guideline_id = gg.guideline_id\n\t\t\t\t\t and gg.group_id = gs.group_id\n\t\t\t\t\t and gs.subgroup_id = gc.subgroup_id\n\t\t\t\t\t and gc.check_id = c.check_id\n\t\t\t\t\t and c.open_to_public = 1\n\t\t\t\t\t and c.check_id = cp.check_id\n\t\t\t\t\torder by c.check_id, cp.prerequisite_check_id";
return $this->execute($sql);
}
示例3: getGuidelineByUserIDs
/**
* Return guideline info by given user id
* @access public
* @param $userID : user id
* @return table rows
* @author Cindy Qi Li
*/
public function getGuidelineByUserIDs($userIDs)
{
include_once AC_INCLUDE_PATH . 'classes/Utility.class.php';
$userIDs = Utility::sanitizeIntArray($userIDs);
$sql = "select *\n\t\t\t\tfrom " . TABLE_PREFIX . "guidelines\n\t\t\t\twhere user_id in (" . implode(",", $userIDs) . ")\n\t\t\t\torder by title";
return $this->execute($sql);
}
示例4: Delete
/**
* Delete user
* @access public
* @param user_id
* @return true, if successful
* false and add error into global var $msg, if unsuccessful
* @author Cindy Qi Li
*/
public function Delete($userIDs)
{
// delete customized guidelines created by user but yet open to public
include_once AC_INCLUDE_PATH . 'classes/DAO/GuidelinesDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/ChecksDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/UserLinksDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/Utility.class.php';
$userIDs = Utility::sanitizeIntArray($userIDs);
$guidelinesDAO = new GuidelinesDAO();
$guidelines = $guidelinesDAO->getGuidelineByUserIDs($userIDs);
if (is_array($guidelines)) {
foreach ($guidelines as $guideline) {
if ($guideline['open_to_public'] == 0) {
$guidelinesDAO->Delete($guideline['guideline_id']);
}
}
}
// delete customized checks created by user but yet open to public
$checksDAO = new ChecksDAO();
$checks = $checksDAO->getCheckByUserIDs($userIDs);
if (is_array($checks)) {
foreach ($checks as $check) {
if ($check['open_to_public'] == 0) {
$checksDAO->Delete($check['check_id']);
}
}
}
// delete user links and decisions generated by this user
$userLinksDAO = new UserLinksDAO();
$userLinks = $userLinksDAO->DeleteByUserID($userIDs);
$sql = "DELETE FROM " . TABLE_PREFIX . "users\n\t\t WHERE user_id in (" . implode(",", $userIDs) . ")";
return $this->execute($sql);
}
示例5: getAllPrivsExceptListed
/**
* Return all privileges except the privilege ids in given string
* @access public
* @param $privilegeIDs : a string of check ids separated by comma. for example: 1, 2, 3
* @return table rows
* @author Cindy Qi Li
*/
function getAllPrivsExceptListed($privilegeIDs)
{
if (!is_array($privilegeIDs)) {
return false;
}
$sanitized_privs = Utility::sanitizeIntArray($privilegeIDs);
if (count($sanitized_privs) == 0) {
return $this->getAll();
} else {
$sanitized_privs_str = implode(",", $sanitized_privs);
$sql = "SELECT * FROM " . TABLE_PREFIX . "privileges \n\t\t\t WHERE privilege_id NOT IN (" . $sanitized_privs_str . ")";
return $this->execute($sql);
}
}
示例6: getUserLinkID
/**
* If row with given $user_id, $URI already exists, return existing user_link_id;
* otherwise, create a new row and return the new user_link_id
* @access public
* @param $user_id
* $URI
* $gids
* @return user row
* @author Cindy Qi Li
*/
public function getUserLinkID($user_id, $URI, $gids)
{
// sanitize array gids
if (!is_array($gids)) {
return false;
}
$sanitized_gids = Utility::sanitizeIntArray($gids);
$sanitized_gids_str = implode(",", $sanitized_gids);
$rows = $this->getByUserIDAndURI($user_id, $URI);
if (is_array($rows)) {
$user_link_id = $rows[0]['user_link_id'];
// if guidelines selected are changed, save into table
if ($rows[0]['last_guideline_ids'] != $sanitized_gids_str) {
$this->Update($user_link_id, $user_id, $sanitized_gids_str, $URI);
}
} else {
$user_link_id = $this->Create($user_id, $sanitized_gids_str, $URI);
}
return $user_link_id;
}