本文整理匯總了PHP中PHPWS_DB::allowed方法的典型用法代碼示例。如果您正苦於以下問題:PHP PHPWS_DB::allowed方法的具體用法?PHP PHPWS_DB::allowed怎麽用?PHP PHPWS_DB::allowed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHPWS_DB
的用法示例。
在下文中一共展示了PHPWS_DB::allowed方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: post_db
/**
* copies the db form settings into the object
*/
public function post_db()
{
$result = true;
$this->dbuser = $_POST['dbuser'];
$this->dbpass = $_POST['dbpass'];
$this->dbhost = $_POST['dbhost'];
$this->dbtype = $_POST['dbtype'];
$this->dbport = $_POST['dbport'];
$this->dbprefix = $_POST['dbprefix'];
$this->dbname = $_POST['dbname'];
if (!PHPWS_DB::allowed($this->dbname)) {
$this->message[] = dgettext('branch', 'This database name is not allowed.');
$result = false;
}
if (empty($this->dbname)) {
$this->message[] = dgettext('branch', 'You must type a database name.');
$result = false;
}
if (empty($this->dbuser)) {
$this->message[] = dgettext('branch', 'You must type a database user.');
$result = false;
}
if (preg_match('/\\W/', $this->dbprefix)) {
$content[] = dgettext('branch', 'Table prefix must be alphanumeric characters or underscores only');
$result = false;
}
return $result;
}
示例2: checkLabel
function checkLabel($label)
{
$restricted = array('id', 'user', 'updated', 'position');
if (is_numeric($label) || preg_match('/^\\d/', $label)) {
return false;
}
if (!PHPWS_DB::allowed($label) || in_array(strtolower($label), $restricted)) {
return false;
}
if (is_array($this->_elements)) {
foreach ($this->_elements as $value) {
$elementInfo = explode(':', $value);
$element = new $elementInfo[0]($elementInfo[1]);
if (strcasecmp($label, $element->getLabel()) == 0) {
unset($element);
return FALSE;
}
}
}
return TRUE;
}
示例3: sqlFriendlyName
/**
* Crutch function from old database
*/
public static function sqlFriendlyName($name)
{
if (!PHPWS_DB::allowed($name)) {
return false;
}
return preg_replace('/\\W/', '', $name);
}