本文整理汇总了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);
}