Example #1
0
function attributes($atts, $short, $id)
{
    $attributes = get_attributes($atts, $short, $id);
    $classes = explode(' ', $attributes['class']);
    $classes[] = 'wpcf7-form-control';
    switch ($short) {
        case 'formular-text':
            $classes[] = 'wpcf7-text';
            break;
        case 'formular-email':
            $classes[] = 'wpcf7-text';
            $classes[] = 'wpcf7-email';
            break;
        case 'formular-textarea':
            $classes[] = 'wpcf7-textarea';
            break;
        case 'formular-submit':
            $classes[] = 'wpcf7-submit';
            break;
    }
    $classes = array_unique($classes);
    $attributes['class'] = implode(' ', $classes);
    $attrs = array();
    foreach ($attributes as $name => $value) {
        if (!$value) {
            continue;
        }
        $attrs[] = $name . '="' . esc_attr($value) . '"';
    }
    return implode(' ', $attrs);
}
/**
 * Get Attributes
 * Get the ID of all objects in an array
 * @param $arr stdClass[]
 * @param $attrib String
 * @return mixed[] whatever the attribute read is
 **/
function get_attributes(array $arr, $attrib = 'id')
{
    $ids = array();
    foreach ($arr as $v) {
        if (is_array($v)) {
            $ids = array_merge($ids, get_attributes($v, $attrib));
        } else {
            $ids[] = $v->{$attrib};
        }
    }
    return $ids;
}
Example #3
0
function get_admin()
{
    if ($a = get_attributes()) {
        if ($admin = issetweb('ssp_uid_attribute')) {
            return $a['saml'][$admin][0];
        }
    }
    return false;
}
Example #4
0
            $zip->add_file(file_get_contents(ROOT_PATH . $row['goods_img']), $row['goods_img']);
        }
    }
    if (EC_CHARSET == 'utf-8') {
        $zip->add_file(ecs_iconv('UTF8', 'GB2312', $content), 'goods_list.csv');
    } else {
        $zip->add_file($content, 'goods_list.csv');
    }
    header("Content-Disposition: attachment; filename=goods_list.zip");
    header("Content-Type: application/unknown");
    die($zip->file());
} elseif ($_REQUEST['act'] == 'import_paipai') {
    $smarty->display('import_paipai.htm');
} elseif ($_REQUEST['act'] == 'get_goods_fields') {
    $cat_id = isset($_REQUEST['cat_id']) ? intval($_REQUEST['cat_id']) : 0;
    $goods_fields = my_array_merge($_LANG['custom'], get_attributes($cat_id));
    make_json_result($goods_fields);
} elseif ($_REQUEST['act'] == 'act_export_custom') {
    /* 检查输出列 */
    if (empty($_POST['custom_goods_export'])) {
        sys_msg($_LANG['custom_goods_field_not_null'], 1, array(), false);
    }
    /* 检查权限 */
    admin_priv('goods_export');
    include_once 'includes/cls_phpzip.php';
    $zip = new PHPZip();
    $where = get_export_where_sql($_POST);
    $sql = "SELECT g.*, b.brand_name as brandname " . " FROM " . $ecs->table('goods') . " AS g LEFT JOIN " . $ecs->table('brand') . " AS b " . "ON g.brand_id = b.brand_id" . $where;
    $res = $db->query($sql);
    $goods_fields = explode(',', $_POST['custom_goods_export']);
    $goods_field_name = set_goods_field_name($goods_fields, $_LANG['custom']);
Example #5
0
function device_attributes(&$array, $device = false)
{
    if (!$device) {
        $device = get_device();
    }
    obj_attributes($device, $array);
    get_attributes($device['id'], 'devices', $array);
}
$connection = connect($connection_string);
//var_dump($connection);
$result_tables = query_tables();
if ($result_tables) {
    $string = '';
    $directory = PATH_OUTPUT_DIRECTORY;
    # handle output directory
    handle_output_directory($directory);
    # handle form directory
    form_directory_handle();
    # TABLES file
    $path_tables_file = "{$directory}/tables.txt";
    $handle = fopen($path_tables_file, "w");
    $schema_row = '';
    $tables = normalize_result_tables($result_tables);
    get_attributes($tables);
    write_tables_file($tables);
    $database = normalize_as_namespaces_and_classes($tables);
    create_po_directories($database);
    create_dao_directories($database);
    create_class_files($database);
    create_dao_files($database);
    exit;
    fwrite($handle, print_r($tables, true));
    while ($data = pg_fetch_object($result_tables)) {
        $namespace_name = ucfirst($data->schemaname);
        schema_directory_handle($namespace_name);
        $class_name = to_class_name($data->tablename);
        $po_file = PATH_OUTPUT_DIRECTORY . "/Po/{$data->schemaname}/{$class_name}.php";
        $po_file_handle = fopen($po_file, "w");
        $po_file_string = "<?php" . PHP_EOL . PHP_EOL;
/**
 * Formata uma URL interna ou externa com uma tag de ancora.
 *
 * Esta função manipula corretamente atalhos de caminho, e adiciona uma atributo classe 'active'
 * para os links que apontarem para a atual pagina (para themas), então todas os links internos devem 
 * preferencialmente ser criados por esta função se possivel
 *
 * @param $text
 * O texto do link para a ancora.
 * @param $path
 * O caminho interno ou externo para onde esta apontando, como "node/34" ou
 * "http://example.com/foo". Antes da função url() ser chamada para construir a
 * URL de $path e $options, o resultado da URL é passado em
 * check_url() antes de ser inserida uma tag de ancora no html, para assegurar
 * um HTML bem formatado. veja url() para maiores informações.
 * @param $options
 * Um array associativo para opções adicionais, com os seguintes elementos
 * - 'attributes': Um array associativo para atributos HTML a serem aplicados 
 * na tag.
 * - 'html' (default FALSE): Quando $text é um HTML não só texto. Por exemplo
 * para fazer uma tag de link em uma imagem, este deve estar setado como TRUE, ou
 * será escapado da tag de imagem HTML.
 * - 'language': um objeto de lingua opcional. Se o caminho a ser ligado é interno 
 * para o site, $options['language'] é utilizado para procurar o alias para o URL,
 * e para determinar se o link está "ativo", ou apontando para a página atual 
 * (o idioma bem como o caminho deve corresponder). Este elemento então será usado por url().
 * - Adicionais elementos de $options a serem usados como opções para a função url().
 *
 * @return
 * Uma String HTML contendo o link.
 */
function _l($text, $path, $options = array())
{
    global $language;
    // une com o padrão
    $options += array('attributes' => array(), 'html' => FALSE);
    // Append active class.
    if (($path == $_GET['q'] || $path == '<front>' && is_frontPage()) && (empty($options['language']) || $options['language']->language == $language['language']->language)) {
        if (isset($options['attributes']['class'])) {
            $options['attributes']['class'] .= ' active';
        } else {
            $options['attributes']['class'] = 'active';
        }
    }
    // Remove all HTML and PHP tags from a tooltip. For best performance, we act only
    // if a quick strpos() pre-check gave a suspicion (because strip_tags() is expensive).
    if (isset($options['attributes']['title']) && strpos($options['attributes']['title'], '<') !== FALSE) {
        $options['attributes']['title'] = strip_tags($options['attributes']['title']);
    }
    return '<a href="' . check_url(url($path, $options)) . '"' . get_attributes($options['attributes']) . '>' . ($options['html'] ? $text : check_plain($text)) . '</a>';
}
Example #8
0
function get_layers($login)
{
    $dbconn =& new DBConn();
    $layers = array();
    $sql_str = "SELECT " . "DISTINCT " . "tng_spatial_layer.layer_id, " . "tng_spatial_layer.layer_name, " . "tng_spatial_data.geometry_type " . "FROM " . "tng_spatial_layer " . "INNER JOIN tng_submission_permission ON " . "tng_spatial_layer.form_submission_id = tng_submission_permission.sub_id " . "INNER JOIN tng_spatial_attribute_table ON " . "tng_spatial_layer.attr_table_id = tng_spatial_attribute_table.attr_table_id " . "INNER JOIN tng_spatial_data ON " . "tng_spatial_attribute_table.spatial_table_id = tng_spatial_data.spatial_table_id ";
    if (!$login->is_tng_user()) {
        $sql_str .= "WHERE " . "tng_submission_permission.uid = " . $login->uid;
    }
    $dbconn->connect();
    $result = pg_query($dbconn->conn, $sql_str);
    if (!$result) {
        echo "An error occurred while executing the query - " . $sql_str . " - " . pg_last_error($this->dbconn->conn);
        $dbconn->disconnect();
        return NULL;
    }
    $n_layers = pg_num_rows($result);
    for ($i = 0; $i < $n_layers; $i++) {
        $layers[$i] = array("id" => pg_fetch_result($result, $i, 'layer_id'), "lname" => pg_fetch_result($result, $i, 'layer_name'), "geom_type" => pg_fetch_result($result, $i, 'geometry_type'), "attrs" => get_attributes(pg_fetch_result($result, $i, 'layer_id')));
    }
    //$dbconn->disconnect();
    return $layers;
}
Example #9
0
File: steps.php Project: GEANT/CORE
<?php

//
require_once 'functions.php';
$steps = array(array('name' => 'Server requirements', 'fields' => array(array('type' => 'info', 'value' => 'Before proceeding with the full installation, we will carry out some tests on your server configuration to ensure that you are able to install and run our software. Please ensure you read through the results thoroughly and do not proceed until all the required tests are passed.'), array('type' => 'php-config', 'label' => 'Required PHP settings', 'items' => array('php_version' => array('>=5.3', 'PHP 5.3 or newer'), 'short_open_tag' => true, 'register_globals' => false, 'safe_mode' => false, 'upload_max_filesize' => '>=2mb')), array('type' => 'php-modules', 'label' => 'Required PHP modules', 'items' => array('pdo_pgsql' => array(true, 'PDO PostgreSQL functions (pdo_pgsql)'), 'apc' => array(true, 'Alternative PHP Cache (apc)'), 'fileinfo' => array(true, 'File Information (fileinfo)'), 'gd' => array(true, 'GD Graphics (gd)'))), array('type' => 'file-permissions', 'label' => 'Folders and files', 'items' => array(CORE_DIR . '/cache/' => 'write', CORE_DIR . '/uploads/' => 'write', CORE_DIR . '/logs/' => 'write', CORE_DIR . '/data/mails/' => 'write', CORE_DIR . '/public/.htaccess' => 'write', CORE_DIR . '/application/configs/application.ini' => 'write')))), array('name' => 'Zend Framework', 'fields' => array(array('type' => 'info', 'value' => 'Where is the Zend Framework library located?<br />
								This is directory that contains the "Zend" directory.'), array('label' => 'Location', 'type' => 'text', 'name' => 'zend_location', 'default' => ($z = file_path('Zend/Version.php')) ? $z : '', 'validate' => array(array('rule' => 'required')))), 'callbacks' => array(array('name' => 'zend_check', 'execute' => 'after', 'params' => array(array('version' => '1.11', 'location' => isset($_REQUEST['zend_location']) ? $_REQUEST['zend_location'] : null))))), array('name' => 'SimpleSAMLphp', 'fields' => array(array('type' => 'info', 'value' => 'Where is SimpleSAMLphp library located?'), array('label' => 'Location', 'type' => 'text', 'name' => 'ssp_location', 'default' => ($s = file_path('lib/SimpleSAML/Utilities.php')) ? $s : '', 'validate' => array(array('rule' => 'required')))), 'callbacks' => array(array('name' => 'simplesamlphp_check', 'execute' => 'after', 'params' => array('location' => isset($_REQUEST['ssp_location']) ? $_REQUEST['ssp_location'] : null)))), array('name' => 'Authenticate', 'fields' => array(array('type' => 'info', 'value' => '<p>Select the SimpleSAMLphp authentication source that will be used for CORE.</p><p>The next step will try to authenticate you. If this succeeds, the installer will make you the first administrative user.</p><p>Please make sure that the selected authsource actually <strong>WORKS</strong>, otherwise you will be <strong>lost</strong> after the redirect with no way back, and you have to restart your browser to try again...</p>'), array('label' => 'authsource', 'type' => 'select', 'name' => 'ssp_authsource', 'items' => get_authsources(), 'validate' => array(array('rule' => 'required'))))), array('name' => 'Attribute mappings', 'fields' => array(array('type' => 'info', 'value' => 'Choose which SAML atttributes should be used for:'), array('label' => 'Unique user ID', 'type' => 'select', 'name' => 'ssp_uid_attribute', 'items' => get_attributes()), array('label' => 'First name', 'type' => 'select', 'name' => 'ssp_fname_attribute', 'items' => get_attributes()), array('label' => 'Last name', 'type' => 'select', 'name' => 'ssp_lname_attribute', 'items' => get_attributes()), array('label' => 'E-mail', 'type' => 'select', 'name' => 'ssp_email_attribute', 'items' => get_attributes()), array('label' => 'Organisation', 'type' => 'select', 'name' => 'ssp_organisation_attribute', 'items' => get_attributes()), array('label' => 'Country', 'type' => 'select', 'name' => 'ssp_country_attribute', 'items' => get_attributes()))), array('name' => 'PostgreSQL', 'fields' => array(array('type' => 'info', 'value' => 'Please note that the database must be created prior to this step. If you have not created one yet, do so now.'), array('label' => 'hostname', 'name' => 'db_hostname', 'type' => 'text', 'default' => 'localhost', 'validate' => array(array('rule' => 'required'))), array('label' => 'database', 'name' => 'db_name', 'type' => 'text', 'default' => 'core_test_db', 'highlight_on_error' => false, 'validate' => array(array('rule' => 'required'), array('rule' => 'database', 'params' => array('db_host' => 'db_hostname', 'db_user' => 'db_username', 'db_pass' => 'db_password', 'db_name' => 'db_name')))), array('label' => 'username', 'name' => 'db_username', 'type' => 'text', 'default' => 'core_user', 'validate' => array(array('rule' => 'required'))), array('label' => 'password', 'name' => 'db_password', 'type' => 'text', 'default' => 'hackme', 'validate' => array(array('rule' => 'required'))))), array('name' => 'Mail options', 'fields' => array(array('type' => 'info', 'value' => 'CORE needs to send various e-mail messages'), array('label' => 'SMTP host', 'type' => 'text', 'name' => 'mail_transport_host', 'default' => 'localhost', 'validate' => array(array('rule' => 'required'))), array('label' => 'SMTP port', 'type' => 'text', 'name' => 'mail_transport_port', 'default' => '25', 'validate' => array(array('rule' => 'required'), array('rule' => 'numeric'))), array('label' => 'Default "From" mail address', 'type' => 'text', 'name' => 'default_from_email', 'default' => 'webmaster@' . mydomain(), 'validate' => array(array('rule' => 'required'))), array('label' => 'Default "From" name', 'type' => 'text', 'name' => 'default_from_name', 'default' => 'CORE', 'validate' => array(array('rule' => 'required'))), array('label' => 'Default "Reply-To" address', 'type' => 'text', 'name' => 'default_replyto_email', 'default' => 'webmaster+core@' . mydomain(), 'validate' => array(array('rule' => 'required'))), array('label' => 'Default "Reply-To" name', 'type' => 'text', 'name' => 'default_replyto_name', 'default' => 'CORE admins', 'validate' => array(array('rule' => 'required'))), array('label' => 'Send critical errors to', 'type' => 'text', 'name' => 'debug_mailto', 'default' => 'webmaster@' . mydomain(), 'validate' => array(array('rule' => 'required'))))), array('name' => 'Conference details', 'fields' => array(array('type' => 'info', 'value' => 'Here you can configure the initial conference. This will also be used to manage things'), array('label' => 'Conference name', 'type' => 'text', 'name' => 'conf_name', 'default' => ($bits = preg_split('/\\./', $_SERVER['HTTP_HOST'])) ? strtoupper($bits[0]) . ' Conference ' : '', 'validate' => array(array('rule' => 'required'))), array('label' => 'Conference abbreviation', 'type' => 'text', 'name' => 'conf_abbr', 'default' => ($bits = preg_split('/\\./', $_SERVER['HTTP_HOST'])) ? $bits[0] : 'niets', 'validate' => array(array('rule' => 'required'))), array('label' => 'hostname', 'type' => 'text', 'name' => 'conf_hostname', 'default' => $_SERVER['HTTP_HOST'], 'validate' => array(array('rule' => 'required'))))), array('name' => 'Save and install', 'fields' => array(array('type' => 'info', 'value' => '<p>All the information needed to bootstrap the installation is collected. We will now:
																									<ul>
																									<li>Install an empty database template</li>
																									<li>Give administrative permission to your account with:
																										<ul>
																											<li>SAML uid attribute: <strong>' . issetweb('ssp_uid_attribute') . '</strong></li>
																											<li>value: <strong>' . get_admin() . '</strong></li>
																										</ul>
																									</li>
																									</ul></p><p>This will take some seconds to complete. If everything goes well, you will be redirected to CORE</p>')), 'callbacks' => array(array('name' => 'install', 'params' => array(get_attributes())))));