本文整理汇总了PHP中Codendi_Request::valid方法的典型用法代码示例。如果您正苦于以下问题:PHP Codendi_Request::valid方法的具体用法?PHP Codendi_Request::valid怎么用?PHP Codendi_Request::valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Codendi_Request
的用法示例。
在下文中一共展示了Codendi_Request::valid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateProjectAdminValue
/** @return bool true if updated */
private function updateProjectAdminValue()
{
$validator = new Valid_WhiteList(self::PROJECT_ADMIN_KEY, array("0", "1"));
if (!$this->request->valid($validator)) {
return false;
}
$new_value = $this->request->get(self::PROJECT_ADMIN_KEY);
$old_value = ForgeConfig::get(ForgeAccess::PROJECT_ADMIN_CAN_CHOOSE_VISIBILITY);
if ($new_value == $old_value) {
return false;
}
return $this->manager->updateProjectAdminVisibility($new_value, $old_value);
}
示例2: updatePreferences
/**
* Update the preferences
* @param Codendi_Request $request
* @return boolean true if something has been updated
*/
function updatePreferences($request)
{
$done = false;
$vContentId = new Valid_UInt('content_id');
$vContentId->required();
if (($plugin_docman_widget_embedded = $request->get('plugin_docman_widget_embedded')) && $request->valid($vContentId)) {
$vItem_id = new Valid_String('item_id');
if ($request->validInArray('plugin_docman_widget_embedded', $vItem_id)) {
$item_id = " item_id = " . db_ei($plugin_docman_widget_embedded['item_id']) . " ";
} else {
$item_id = ' item_id = item_id ';
}
$vTitle = new Valid_String('title');
if ($request->validInArray('plugin_docman_widget_embedded', $vTitle)) {
$title = " title = '" . db_escape_string($plugin_docman_widget_embedded['title']) . "' ";
} else {
$title = ' title = title ';
}
$sql = "UPDATE plugin_docman_widget_embedded \n SET " . $title . ", " . $item_id . " \n WHERE owner_id = " . $this->owner_id . " \n AND owner_type = '" . $this->owner_type . "' \n AND id = " . (int) $request->get('content_id');
$res = db_query($sql);
$done = true;
}
return $done;
}