Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mah0001 committed Jul 23, 2019
2 parents af2942b + 307127e commit 9c29f8e
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 58 deletions.
33 changes: 2 additions & 31 deletions application/config/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ function pre_system_url_check()
$proxy_ssl_header=$config["proxy_ssl_header"];
$proxy_ssl_header_value=$config["proxy_ssl_header_value"];

/*
$test_port='80, 80';
if($_SERVER['HTTPS']=="on")
{
$test_port=$proxy_ssl_header_value;
}
$_SERVER[$proxy_ssl_header]=$test_port;//$proxy_ssl_header_value;
*/

if (!$enable_ssl && !$proxy_ssl)
{
return FALSE;
Expand Down Expand Up @@ -152,30 +143,10 @@ function pre_system_url_check()
if($is_https===FALSE)
{
//if url first segment has AUTH redirect to HTTPS
if (current($segments)=='auth')
{
//if (current($segments)=='auth'){
//redirect to SSL page
header("Location:$redirect");
}
}
//if non-ssl pages are viewed using HTTPS, force them to use http instead
else if($is_https===TRUE)
{
if (current($segments)!='auth')
{
if ($http_port!=80)
{
$http_port=':'.$http_port;
}
else if($http_port==80)
{
$http_port='';
}

//redirect to NON-SSL page
$redirect= "http://".$_SERVER['HTTP_HOST'].$http_port._request_uri();
header("Location:$redirect");
}
//}
}
}

Expand Down
31 changes: 30 additions & 1 deletion application/controllers/admin/Catalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ function replace_ddi($sid=NULL)
try
{
//upload the ddi
$upload_result=$this->__upload_file($key='userfile',$destination=$tmp_path);
$upload_result=$this->upload_ddi_file($key='userfile',$destination=$tmp_path);

if(!$upload_result){
$error = $this->upload->display_errors();
Expand Down Expand Up @@ -1967,6 +1967,35 @@ function attach_data_file_resources_post($sid,$file_id)
}


/**
*
* Upload ddi file for ddi replace
*
* @return array
*/
private function upload_ddi_file($key,$destination)
{
if ($_FILES[$key]['size']==0)
{
return false;
}
$config['encrypt_name'] = TRUE;
$config['upload_path'] = $destination;
$config['allowed_types'] = 'xml';
$config['overwrite'] = true;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload($key))
{
throw new Exception( $this->upload->display_errors() );
}
else
{
$data = $this->upload->data();
return $data;
}
}


}
/* End of file catalog.php */
/* Location: ./controllers/admin/catalog.php */
33 changes: 30 additions & 3 deletions application/controllers/api/Datasets.php
Original file line number Diff line number Diff line change
Expand Up @@ -1136,10 +1136,37 @@ function reload_ddi_put($id=NULL,$partial=false)
throw new Exception("ID_MISSING");
}

$this->load->model("Data_file_model");
$this->load->library('DDI2_import');

$this->load->library('DDI_Utils');
$user_id=$this->get_api_user_id();
$result=$this->ddi_utils->reload_ddi($id, $user_id, $partial);
//get survey ddi file path by id
$ddi_file=$this->Catalog_model->get_survey_ddi_path($id);

if ($ddi_file===FALSE){
throw new Exception("DDI_FILE_NOT_FOUND");
}

$dataset=$this->dataset_manager->get_row($id);

$params=array(
'file_type'=>'survey',
'file_path'=>$ddi_file,
'user_id'=>$this->get_api_user_id(),
'repositoryid'=>$dataset['repositoryid'],
'overwrite'=>'yes',
'partial'=>$partial
);

$result=$this->ddi2_import->import($params,$id);

//reset changed and created dates
$update_options=array(
'changed'=>$dataset['changed'],
'created'=>$dataset['created'],
'repositoryid'=>$dataset['repositoryid']
);

$this->dataset_manager->update_options($id,$update_options);

$output=array(
'status'=>'success',
Expand Down
27 changes: 22 additions & 5 deletions application/libraries/Citation_search_sqlsrv.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,28 @@ function build_search_options($limit = NULL, $offset = NULL,$filter=NULL,$sort_b
break;

case 'url_status':
if ($keywords!="")
{
$this->ci->db->where_in ('citations.url_status',$keywords);
}
break;
if ($keywords!="")
{
$this->ci->db->where_in ('citations.url_status',$keywords);
}
break;

case 'ctype':
if (is_array($keywords)){
$this->ci->db->where_in ('citations.ctype',$keywords);
}
break;

case 'from':
if (strlen($keywords)==4 && is_numeric($keywords)){
$this->ci->db->where ('citations.pub_year >=',intval($keywords),false);
}
break;
case 'to':
if (strlen($keywords)==4 && is_numeric($keywords)){
$this->ci->db->where ('citations.pub_year <=',intval($keywords),false);
}
break;
}
}
}
Expand Down
28 changes: 13 additions & 15 deletions application/models/Catalog_admin_search_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,30 +185,28 @@ function _build_search_query()
$tags=$this->get_param('tag');

$tags_sql=NULL;

if (is_array($tags))
{
$tags_sub_query=NULL;

if (is_array($tags)){
foreach($tags as $key=>$value)
{
if (trim($value)!='')
{
if (trim($value)!=''){
$tags_sql[$key]=sprintf('tag=%s',$this->db->escape($value));
}
}

if ( is_array($tags_sql) && count($tags_sql)>0)
{
if ( is_array($tags_sql) && count($tags_sql)>0){
$tags_sub_query='select sid from survey_tags where '.implode(' OR ',$tags_sql);
}

if ( trim($where_clause)!='')
{
$where_clause.= sprintf(' AND surveys.id in (%s)',$tags_sub_query);
}
else
{
$where_clause.= sprintf(' surveys.id in (%s)',$tags_sub_query);
}
if ( !empty($tags_sub_query)){
if ( trim($where_clause)!=''){
$where_clause.= sprintf(' AND surveys.id in (%s)',$tags_sub_query);
}
else{
$where_clause.= sprintf(' surveys.id in (%s)',$tags_sub_query);
}
}
}

$active_repo_filter='';
Expand Down
2 changes: 1 addition & 1 deletion application/views/vocabularies/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
width:500px;
}
</style>
<div class='container-fluid vocabularies-edit-page'>
<div class='container vocabularies-edit-page'>
<div class="text-right page-links">
<a href="<?php echo site_url(); ?>/admin/vocabularies" class="btn btn-default"> <span class="glyphicon glyphicon-home ico-add-color right-margin-5" aria-hidden="true"></span> <?php echo t('home');?></a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion application/views/vocabularies/index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="content-container">
<div class="content-container container">

<div class="text-right page-links">
<a href="<?php echo site_url(); ?>/admin/vocabularies/add" class="btn btn-default">
Expand Down
4 changes: 3 additions & 1 deletion themes/nada/head.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
<!-- Placed at the end of the document so the pages load faster -->
<!--<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script>-->

<script src="//code.jquery.com/jquery-3.2.1.min.js"></script>

<!-- <script src="//code.jquery.com/jquery-migrate-3.0.1.min.js"></script>-->

<?php if($use_cdn):?>
<script src="//code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<?php else:?>
<script src="<?php echo base_url(); ?>/javascript/jquery/jquery.js"></script>
<script src="<?php echo base_url().$bootstrap_theme ?>/js/popper.min.js"></script>
<script src="<?php echo base_url().$bootstrap_theme ?>/js/bootstrap.min.js"></script>
<?php endif;?>
Expand Down

0 comments on commit 9c29f8e

Please sign in to comment.