コード例 #1
0
ファイル: owner_features.php プロジェクト: indynagpal/MateCat
    return in_array($feature, $valid_codes);
}
$options = getopt('h', array('email:', 'feature:'));
if (array_key_exists('h', $options)) {
    usage();
}
if (empty($options)) {
    usage();
}
if (!array_key_exists('email', $options)) {
    usage();
}
if (!array_key_exists('feature', $options)) {
    usage();
}
if (!validateFeature($options['feature'])) {
    usage();
}
$dao = new Users_UserDao(Database::obtain());
$result = $dao->read(new Users_UserStruct(array('email' => $options['email'])));
$user = $result[0];
$dao = new OwnerFeatures_OwnerFeatureDao(Database::obtain());
$values = array('uid' => $user->uid, 'feature_code' => $options['feature'], 'options' => '{}', 'enabled' => true);
$insert = $dao->create(new OwnerFeatures_OwnerFeatureStruct($values));
echo <<<END

Record added for user {$user->email}:

FEATURE CODE:       {$insert->feature_code}
ENABLED:            {$insert->enabled}
コード例 #2
0
ファイル: LayerData.php プロジェクト: rahool/maplocator
function validate_feature($layer_tablename, $row_id) {
  $result=array();
  $result['validate']=validateFeature($layer_tablename, $row_id);
  print json_encode($result);
}