Exemplo n.º 1
0
 /**
  * Set cookie
  *
  * Accepts an arbitrary number of parameters (up to 7) or an associative
  * array in the first parameter containing all the values.
  *
  * @param	string|mixed[]	$name		Cookie name or an array containing parameters
  * @param	string		    $value		Cookie value
  * @param	int|string		$expire		Cookie expiration time in seconds
  * @param	string		    $domain		Cookie domain (e.g.: '.yourdomain.com')
  * @param	string		    $path		Cookie path (default: '/')
  * @param	string		    $prefix		Cookie name prefix
  * @param	bool		    $secure		Whether to only transfer cookies via SSL
  * @param	bool		    $httponly	Whether to only makes the cookie accessible via HTTP (no javascript)
  * @return	void
  */
 public function set($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE, $httponly = FALSE)
 {
     if (is_array($name)) {
         /**
          * always leave 'name' in last place, as the loop will break otherwise, due to $$item
          */
         foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'secure', 'httponly', 'name') as $item) {
             if (isset($name[$item])) {
                 ${$item} = $name[$item];
             }
         }
     }
     if ($prefix === '' && get_config_item('cookie_prefix') !== '') {
         $prefix = get_config_item('cookie_prefix');
     }
     if ($domain == '' && get_config_item('cookie_domain') != '') {
         $domain = get_config_item('cookie_domain');
     }
     if ($path === '/' && get_config_item('cookie_path') !== '/') {
         $path = get_config_item('cookie_path');
     }
     if ($secure === FALSE && get_config_item('cookie_secure') === TRUE) {
         $secure = get_config_item('cookie_secure');
     }
     if ($httponly === FALSE && get_config_item('cookie_httponly') !== FALSE) {
         $httponly = get_config_item('cookie_httponly');
     }
     if (!is_numeric($expire)) {
         $expire = time() - 86500;
     } else {
         $expire = $expire > 0 ? time() + $expire : 0;
     }
     setcookie($prefix . $name, $value, $expire, $path, $domain, $secure, $httponly);
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     $template = $this->env->resolveTemplate(get_config_item("System", "template", "office/OfficeConfig") . "/template/header.tpl");
     $template->display($context);
     // line 2
     echo "\n      <!--main content start-->\n      <section id=\"main-content\">\n          <section class=\"wrapper\">\n              <!-- page start-->\n\t\t\t      <form role=\"form\" id=\"registerForm\" class=\"cmxform form-signin\">\n\t\t\t        <h2 class=\"form-signin-heading\">";
     // line 8
     echo twig_escape_filter($this->env, lang("title_register"), "html", null, true);
     echo "</h2>\n\t\t\t        <div class=\"login-wrap\">\n\t\t\t        \t<div class=\"form-group \">\n\t\t\t            \t<input type=\"text\" class=\"form-control\" name=\"login\" placeholder=\"";
     // line 11
     echo twig_escape_filter($this->env, lang("login_input"), "html", null, true);
     echo "\" autofocus>\n\t\t\t            </div>\n\t\t\t            <div class=\"form-group \">\n\t\t\t            \t<input type=\"password\" class=\"form-control\" name=\"password\" placeholder=\"";
     // line 14
     echo twig_escape_filter($this->env, lang("password_input"), "html", null, true);
     echo "\">\n\t\t\t            </div>\n\t\t\t            <div class=\"form-group \">\n\t\t\t            \t<input type=\"password\" class=\"form-control\" name=\"repeat_password\" placeholder=\"";
     // line 17
     echo twig_escape_filter($this->env, lang("repeat_password_input"), "html", null, true);
     echo "\">\n\t\t\t            </div>\n\t\t\t            <div class=\"form-group \">\n\t\t\t\t        \t<input type=\"text\" class=\"form-control\" name=\"email\"  placeholder=\"";
     // line 20
     echo twig_escape_filter($this->env, lang("email_input"), "html", null, true);
     echo "\">\n\t\t\t\t        </div>\n\t\t\t\t        <div class=\"g-recaptcha\" data-sitekey=\"";
     // line 22
     echo twig_escape_filter($this->env, get_config_item("Captcha", "public_key", "office/OfficeConfig"), "html", null, true);
     echo "\" style=\"transform:scale(0.96);transform-origin:0;-webkit-transform:scale(0.96);transform:scale(0.96);-webkit-transform-origin:0 0;transform-origin:0 0; 0\"></div><br>\n\t\t\t            <center>\n\t\t\t\t            <button class=\"btn btn-lg btn-danger\" >";
     // line 24
     echo twig_escape_filter($this->env, lang("do_register_button"), "html", null, true);
     echo "</button>\n\t\t\t            </center>\n\t\t\t        </div>\n\t\t\t      </form>\n              <!-- page end-->\n          </section>\n      </section>\n      <!--main content end-->\n\n";
     // line 33
     $template = $this->env->resolveTemplate(get_config_item("System", "template", "office/OfficeConfig") . "/template/footer.tpl");
     $template->display($context);
 }
Exemplo n.º 3
0
 /**
  * Initialize the solr class ready for call
  * @return [type] [description]
  */
 function init()
 {
     $this->solr_url = get_config_item('solr_url');
     $this->options = array('q' => '*:*', 'start' => '0', 'indent' => 'on', 'wt' => 'json', 'fl' => '*', 'rows' => '10');
     $this->multi_valued_fields = array('facet.field', 'fq', 'facet.query');
     $this->custom_query = false;
     return $this;
 }
Exemplo n.º 4
0
 /**
  * Determines if UTF-8 support is to be enabled.
  *
  * CI_Utf8 constructor.
  */
 public function __construct()
 {
     if (defined('PREG_BAD_UTF8_ERROR') && (ICONV_ENABLED === TRUE or MB_ENABLED === TRUE) && strtoupper(get_config_item('charset')) === 'UTF-8') {
         define('UTF8_ENABLED', TRUE);
         log_message(MSG_DEBUG, 'UTF-8 Support Enabled');
     } else {
         define('UTF8_ENABLED', FALSE);
         log_message(MSG_DEBUG, 'UTF-8 Support Disabled');
     }
     log_message(MSG_INFO, 'Utf8 Class Initialized');
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     echo "<script type=\"text/javascript\">\n\$(document).ready(function() {\n    document.title = '";
     // line 3
     if (isset($context["page_title"])) {
         $_page_title_ = $context["page_title"];
     } else {
         $_page_title_ = null;
     }
     echo twig_escape_filter($this->env, $_page_title_, "html", null, true);
     echo " | ";
     echo twig_escape_filter($this->env, get_config_item("System", "main_title", "office/OfficeConfig"), "html", null, true);
     echo "';\n});\n</script>";
 }
 public function authenticate()
 {
     try {
         $this->auth_domain = 'aaf.edu.au';
         $this->load->library('JWT');
         $secret = get_config_item('aaf_rapidconnect_secret');
         $decoded = $this->jwt->decode($this->jwt_token, $secret);
         $email = $decoded->{'https://aaf.edu.au/attributes'}->mail;
         $displayName = $decoded->{'https://aaf.edu.au/attributes'}->displayname;
         $persistent_id = $decoded->{'https://aaf.edu.au/attributes'}->edupersontargetedid;
         //try to match by persistent id
         $result = $this->cosi_db->get_where('roles', array('authentication_service_id' => gCOSI_AUTH_METHOD_SHIBBOLETH, 'persistent_id' => $persistent_id));
         if ($result->num_rows() > 0) {
             $this->return_roles($result->row(1));
             return;
         }
         //try to match by email
         $result = $this->cosi_db->get_where('roles', array('authentication_service_id' => gCOSI_AUTH_METHOD_SHIBBOLETH, 'email' => $email));
         if ($result->num_rows() > 0) {
             $this->return_roles($result->row(1));
             return;
         }
         //try to match by name
         $result = $this->cosi_db->get_where('roles', array('authentication_service_id' => gCOSI_AUTH_METHOD_SHIBBOLETH, 'name' => $displayName));
         if ($result->num_rows() > 0) {
             $this->return_roles($result->row(1));
             return;
         }
         //ok, found no one, create new role
         $username = sha1($persistent_id);
         $data = array('role_id' => $username, 'role_type_id' => 'ROLE_USER', 'authentication_service_id' => gCOSI_AUTH_METHOD_SHIBBOLETH, 'enabled' => DB_TRUE, 'name' => $displayName, 'shared_token' => isset($_SERVER['shib-shared-token']) ? $_SERVER['shib-shared-token'] : '', 'persistent_id' => $persistent_id, 'email' => $email);
         $this->cosi_db->insert('roles', $data);
         //register affilication
         $data = array('parent_role_id' => $username, 'child_role_id' => 'SHIB_AUTHENTICATED', 'created_who' => 'SYSTEM');
         $result = $this->cosi_db->get_where('roles', $data);
         if ($result->num_rows() == 0) {
             $this->cosi_db->insert('roles_relation', $data);
         }
         //ok, now we have the role
         $result = $this->cosi_db->get_where('roles', array('username' => $username));
         if ($result->num_rows() > 0) {
             $this->return_roles($result->row(1));
             return;
         }
     } catch (Exception $e) {
         redirect('auth/login/#/?error=aaf_error&message=' . $e->getMessage());
     }
 }
Exemplo n.º 7
0
 public function setUser()
 {
     $sharedToken = '';
     $data['title'] = 'Login';
     $data['js_lib'] = array('core');
     $data['scripts'] = array();
     $this->CI =& get_instance();
     $data['redirect'] = '';
     $data['authenticators'] = array(gCOSI_AUTH_METHOD_BUILT_IN => 'Built-in Authentication', gCOSI_AUTH_METHOD_LDAP => 'LDAP');
     if (get_config_item('shibboleth_sp') == 'true') {
         $data['authenticators'][gCOSI_AUTH_METHOD_SHIBBOLETH] = 'Australian Access Federation (AAF) credentials';
         $data['default_authenticator'] = gCOSI_AUTH_METHOD_SHIBBOLETH;
     } else {
         $data['default_authenticator'] = gCOSI_AUTH_METHOD_BUILT_IN;
     }
     if (isset($_SERVER['shib-shared-token'])) {
         $sharedToken = $_SERVER['shib-shared-token'];
         //authenticate using shared token
     } elseif (isset($_SERVER['persistent-id'])) {
         $sharedToken = sha1($_SERVER['persistent-id']);
         echo $sharedToken;
     } else {
         $data['error_message'] = "Unable to login. Shibboleth IDP was not able to authenticate the given credentials. Missing shared token or persistent id";
         $this->load->view('login', $data);
     }
     if ($sharedToken) {
         try {
             if ($this->user->authChallenge($sharedToken, '')) {
                 if ($this->input->get('redirect') != 'auth/dashboard/') {
                     redirect($this->input->get('redirect'));
                 } else {
                     redirect(registry_url() . 'auth/dashboard');
                 }
             } else {
                 $data['error_message'] = "Unable to login. Please check your credentials are accurate.";
                 $this->load->view('login', $data);
             }
         } catch (Exception $e) {
             $data['error_message'] = "Unable to login. Please check your credentials are accurate.";
             $data['exception'] = $e;
             $this->load->view('login', $data);
         }
     }
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     $template = $this->env->resolveTemplate(get_config_item("System", "template", "office/OfficeConfig") . "/template/header.tpl");
     $template->display($context);
     // line 2
     echo "      <!--main content start-->\n      <section id=\"main-content\">\n          <section class=\"wrapper\">\n              <!-- page start-->\n\t\t\t      <form role=\"form\" class=\"cmxform form-signin\" id=\"loginForm\"  >\n\t\t\t        <h2 class=\"form-signin-heading\">";
     // line 7
     echo twig_escape_filter($this->env, lang("title_login"), "html", null, true);
     echo "</h2>\n\t\t\t        <div class=\"login-wrap\">\n\t\t\t            <div class=\"form-group \">\n\t\t\t           \t\t<input type=\"text\" class=\"form-control\" id=\"login\" name=\"login\" placeholder=\"";
     // line 10
     echo twig_escape_filter($this->env, lang("login_input"), "html", null, true);
     echo "\" autofocus  >\n\t\t\t            </div>\n\t\t\t            <div class=\"form-group \">\n\t\t\t            \t<input type=\"password\" class=\"form-control\" name=\"password\" placeholder=\"";
     // line 13
     echo twig_escape_filter($this->env, lang("password_input"), "html", null, true);
     echo "\">\n\t\t\t            </div>\n\t\t\t            ";
     // line 15
     if (get_config_item("LoginModule", "use_fg", "office/OfficeConfig") == true) {
         // line 16
         echo "\t\t\t            \t<div class=\"form-group \" id=\"fireguard\">\n\t\t\t            \t\t<input type=\"password\" class=\"form-control\" name=\"fireguard\" placeholder=\"Fireguard\"  >\n\t\t\t            \t</div>\n\t\t\t            ";
     }
     // line 20
     echo "\t\t           \t\t<label class=\"checkbox\">\n\t\t             \t\t";
     // line 21
     if (get_config_item("LoginModule", "can_restore_pw", "office/OfficeConfig") == true) {
         // line 22
         echo "\t\t               \t\t\t<span class=\"pull-right\"> <a href=\"#\" onclick=\"restore_pw();\">";
         echo twig_escape_filter($this->env, lang("forgotpw_link"), "html", null, true);
         echo "</a></span>\n\t\t               \t\t";
     }
     // line 24
     echo "\t\t            \t</label>\n\t\t\t            <center>\n\t\t\t\t            <input type=\"submit\" id=\"submitBtn\" class=\"btn btn-lg btn-primary\" data-loading-text=\"Загрузка...\" value=\"";
     // line 26
     echo twig_escape_filter($this->env, lang("login_button"), "html", null, true);
     echo "\" >\n\t\t\t\t            <a type=\"button\" style=\"color:white;\"href=\"";
     // line 27
     echo twig_escape_filter($this->env, site_url(), "html", null, true);
     echo "login/register\" class=\"btn btn-lg btn-danger\" >";
     echo twig_escape_filter($this->env, lang("register_button"), "html", null, true);
     echo "</a>\n\t\t\t            </center>\n\t\t\t        </div>\n\t\t\t      </form>\n              <!-- page end-->\n          </section>\n      </section>\n      <!--main content end-->\n";
     // line 35
     $template = $this->env->resolveTemplate(get_config_item("System", "template", "office/OfficeConfig") . "/template/footer.tpl");
     $template->display($context);
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     echo "  ";
     $template = $this->env->resolveTemplate(get_config_item("System", "template", "office/OfficeConfig") . "/template/header.tpl");
     $template->display($context);
     // line 2
     echo "      <section id=\"main-content\">\n          <section class=\"wrapper\">\n              <!-- page start-->\n\t            <div class=\"row\" >\n\t                <div class=\"col-lg-12\">\n\t                    <!--breadcrumbs start -->\n\t                    <ul class=\"breadcrumb\">\n\t                        <li><a  data-pjax href=\"";
     // line 9
     echo twig_escape_filter($this->env, site_url(), "html", null, true);
     echo "main\"><i class=\"icon-home\"></i> ";
     echo twig_escape_filter($this->env, lang("title_main"), "html", null, true);
     echo "</a></li>\n\t                        <li>";
     // line 10
     echo twig_escape_filter($this->env, lang("title_stats"), "html", null, true);
     echo "</li>\n\t                    </ul>\n\t                    <!--breadcrumbs end -->\n\t                </div>\n\t            </div>\n              <!-- page end-->\n          </section>\n      </section>\n  ";
     // line 18
     $template = $this->env->resolveTemplate(get_config_item("System", "template", "office/OfficeConfig") . "/template/footer.tpl");
     $template->display($context);
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     $template = $this->env->resolveTemplate(get_config_item("System", "template", "office/OfficeConfig") . "/template/header.tpl");
     $template->display($context);
     // line 2
     echo "      <section id=\"main-content\">\n          <section class=\"wrapper\">\n              <!-- page start-->\n              <div class=\"row\" >\n                  <div class=\"col-lg-12\">\n                      <!--breadcrumbs start -->\n                      <ul class=\"breadcrumb\">\n                          <li><a data-pjax href=\"";
     // line 9
     echo twig_escape_filter($this->env, site_url(), "html", null, true);
     echo "main\"><i class=\"icon-home\"></i> ";
     echo twig_escape_filter($this->env, lang("title_main"), "html", null, true);
     echo "</a></li>\n                          <li><a data-pjax href=\"";
     // line 10
     echo twig_escape_filter($this->env, site_url(), "html", null, true);
     echo "main\"><i class=\"icon-user\"></i> ";
     echo twig_escape_filter($this->env, lang("profile"), "html", null, true);
     echo "</a></li>\n                          <li>";
     // line 11
     echo twig_escape_filter($this->env, lang("edit_profile"), "html", null, true);
     echo "</li>\n                      </ul>\n                      <!--breadcrumbs end -->\n                  </div>\n                  <aside class=\"profile-nav col-lg-3 alt blue-border\">\n                  ";
     // line 16
     if (isset($context["widget_system"])) {
         $_widget_system_ = $context["widget_system"];
     } else {
         $_widget_system_ = null;
     }
     echo twig_escape_filter($this->env, $this->getAttribute($_widget_system_, "render", array(0 => "main", 1 => "profile_widget", 2 => "small"), "method"), "html", null, true);
     echo "     \n                  </aside>               \n                  <aside class=\"profile-info col-lg-9\"> \n                      <section class=\"panel animated fadeInUp\">\n                          <div class=\"bio-graph-heading\">\n                              Информация об аккаунте.\n                          </div>\n                          <div class=\"panel-body bio-graph-info\">\n                              <h1> Информация об аккаунте</h1>\n                              <div class=\"alert alert-warning fade in\">\n                                  <button data-dismiss=\"alert\" class=\"close close-sm\" type=\"button\">\n                                      <i class=\"icon-remove\"></i>\n                                  </button>\n                                  <strong>Внимание!</strong> Эта информация поможет защитить ваш аккаунт\n                              </div>\n                              <form class=\"form-horizontal\" role=\"form\" id=\"account_edit\">\n                                  <div class=\"form-group\">\n                                      <label  class=\"col-lg-2 control-label\">First Name</label>\n                                      <div class=\"col-lg-6\">\n                                          <input type=\"text\" class=\"form-control\" id=\"f-name\" placeholder=\" \">\n                                      </div>\n                                  </div>\n                                  <div class=\"form-group\">\n                                      <label  class=\"col-lg-2 control-label\">Last Name</label>\n                                      <div class=\"col-lg-6\">\n                                          <input type=\"text\" class=\"form-control\" id=\"l-name\" placeholder=\" \">\n                                      </div>\n                                  </div>\n                                  <div class=\"form-group\">\n                                      <label  class=\"col-lg-2 control-label\">Country</label>\n                                      <div class=\"col-lg-6\">\n                                          <input type=\"text\" class=\"form-control\" id=\"c-name\" placeholder=\" \">\n                                      </div>\n                                  </div>\n                                  <div class=\"form-group\">\n                                      <label  class=\"col-lg-2 control-label\">Birthday</label>\n                                      <div class=\"col-lg-6\">\n                                          <input type=\"text\" class=\"form-control\" id=\"b-day\" placeholder=\" \">\n                                      </div>\n                                  </div>\n                                  <div class=\"form-group\">\n                                      <label  class=\"col-lg-2 control-label\">Occupation</label>\n                                      <div class=\"col-lg-6\">\n                                          <input type=\"text\" class=\"form-control\" id=\"occupation\" placeholder=\" \">\n                                      </div>\n                                  </div>\n                                  <div class=\"form-group\">\n                                      <label  class=\"col-lg-2 control-label\">Skype</label>\n                                      <div class=\"col-lg-6\">\n                                          <input type=\"text\" class=\"form-control\" id=\"occupation\" placeholder=\" \">\n                                      </div>\n                                  </div>\n                                  <div class=\"form-group\">\n                                      <label  class=\"col-lg-2 control-label\">Email</label>\n                                      <div class=\"col-lg-6\">\n                                          <input type=\"text\" class=\"form-control\" id=\"email\" placeholder=\"";
     // line 71
     if (isset($context["session"])) {
         $_session_ = $context["session"];
     } else {
         $_session_ = null;
     }
     echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($_session_, "userdata", array(0 => "user_logged_in"), "method"), "email"), "html", null, true);
     echo "\">\n                                      </div>\n                                  </div>\n\n                                  <div class=\"form-group\">\n                                      <div class=\"col-lg-offset-2 col-lg-10\">\n                                          <button type=\"submit\" class=\"btn btn-success\">Save</button>\n                                      </div>\n                                  </div>\n                              </form>\n                          </div>\n                      </section>\n                      <section>\n                          <div class=\"panel panel-primary animated fadeInUp\">\n                              <div class=\"panel-heading\"> Sets New Password</div>\n                              <div class=\"panel-body\">\n                                  <form class=\"form-horizontal\" role=\"form\" id=\"account_password_edit\">\n                                      <div class=\"form-group\">\n                                          <label  class=\"col-lg-2 control-label\">Current Password</label>\n                                          <div class=\"col-lg-6\">\n                                              <input type=\"password\" class=\"form-control\" id=\"c-pwd\" placeholder=\" \">\n                                          </div>\n                                      </div>\n                                      <div class=\"form-group\">\n                                          <label  class=\"col-lg-2 control-label\">New Password</label>\n                                          <div class=\"col-lg-6\">\n                                              <input type=\"password\" class=\"form-control\" id=\"n-pwd\" placeholder=\" \">\n                                          </div>\n                                      </div>\n                                      <div class=\"form-group\">\n                                          <label  class=\"col-lg-2 control-label\">Re-type New Password</label>\n                                          <div class=\"col-lg-6\">\n                                              <input type=\"password\" class=\"form-control\" id=\"rt-pwd\" placeholder=\" \">\n                                          </div>\n                                      </div>\n\n                                      <div class=\"form-group\">\n                                          <div class=\"col-lg-offset-2 col-lg-10\">\n                                              <button type=\"submit\" class=\"btn btn-info\">Save</button>\n                                          </div>\n                                      </div>\n                                  </form>\n                              </div>\n                          </div>\n                      </section>                      \n                  </aside> \n              </div>\n              <!-- page end-->\n          </section>\n      </section>\n  ";
     // line 121
     $template = $this->env->resolveTemplate(get_config_item("System", "template", "office/OfficeConfig") . "/template/footer.tpl");
     $template->display($context);
 }
Exemplo n.º 11
0
 private static function advanced()
 {
     self::$rout_types = get_config_item('route_types');
     $matches = [];
     $url_parts = explode('/', self::$url);
     $url_count = count($url_parts);
     foreach (self::$routes as $key => $value) {
         $key_parts = explode('/', $key);
         $key_count = count($key_parts);
         if ($key_count == $url_count) {
             for ($i = 0; $i < $key_count; $i++) {
                 if (array_key_exists($key_parts[$i], self::$rout_types)) {
                     if (preg_match(self::$rout_types[$key_parts[$i]], $url_parts[$i])) {
                         $matches[] = $url_parts[$i];
                     } else {
                         exit('Not defined rout type check your app/config/config' . EXT . ' $config["route_types"] content');
                     }
                 } else {
                     exit('Not allowed character (s) in url');
                 }
             }
             if (is_callable($value)) {
                 $value = $value();
             }
             $value_parts = explode('/', $value);
             $val_count = count($value_parts);
             $rout_result = $value_parts[0] . '/' . $value_parts[1];
             for ($j = 2; $j < $val_count; $j++) {
                 $cur_param = str_replace('$', '', $value_parts[$j]);
                 $rout_result .= '/' . $matches[$cur_param - 1];
             }
             self::explode_rout($rout_result);
             break;
         }
     }
     return false;
 }
Exemplo n.º 12
0
 /**
  * Display the sitemap
  * @author  Minh Duc Nguyen <*****@*****.**>
  * @return view 
  */
 function sitemap($page = '')
 {
     parse_str($_SERVER['QUERY_STRING'], $_GET);
     $solr_url = get_config_item('solr_url');
     $ds = '';
     if (isset($_GET['ds'])) {
         $ds = $_GET['ds'];
     }
     $event = array('event' => 'portal_page', 'page' => 'sitemap', 'ip' => $this->input->ip_address(), 'user_agent' => $this->input->user_agent());
     ulog_terms($event, 'portal');
     if ($page == 'main') {
         $pages = array(base_url(), base_url('home/about'), base_url('home/contact'), base_url('home/privacy_policy'), base_url('themes'));
         header("Content-Type: text/xml");
         echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
         foreach ($pages as $p) {
             echo '<url>';
             echo '<loc>' . $p . '</loc>';
             echo '<changefreq>weekly</changefreq>';
             echo '<lastmod>' . date('Y-m-d') . '</lastmod>';
             echo '</url>';
         }
         echo '</urlset>';
     } else {
         if ($ds == '') {
             $this->load->library('solr');
             $this->solr->setFacetOpt('field', 'data_source_key');
             $this->solr->setFacetOpt('limit', 1000);
             $this->solr->setFacetOpt('mincount', 0);
             $this->solr->executeSearch();
             $res = $this->solr->getFacet();
             $dsfacet = $res->{'facet_fields'}->{'data_source_key'};
             header("Content-Type: text/xml");
             echo '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
             echo '<sitemap><loc>' . base_url('home/sitemap/main') . '</loc><lastmod>' . date('Y-m-d') . '</lastmod></sitemap>';
             for ($i = 0; $i < sizeof($dsfacet); $i += 2) {
                 echo '<sitemap>';
                 echo '<loc>' . base_url() . 'home/sitemap/?ds=' . urlencode($dsfacet[$i]) . '</loc>';
                 echo '<lastmod>' . date('Y-m-d') . '</lastmod>';
                 echo '</sitemap>';
             }
             echo '</sitemapindex>';
         } elseif ($ds != '') {
             $this->load->library('solr');
             $filters = array('data_source_key' => $ds, 'rows' => 50000, 'fl' => 'key, id, update_timestamp, slug');
             $this->solr->setFilters($filters);
             $this->solr->executeSearch();
             $res = $this->solr->getResult();
             $keys = $res->{'docs'};
             $freq = 'weekly';
             if ($this->is_active($ds)) {
                 $freq = 'daily';
             }
             header("Content-Type: text/xml");
             echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
             foreach ($keys as $k) {
                 //var_dump($k);
                 echo '<url>';
                 if ($k->{'slug'}) {
                     echo '<loc>' . base_url() . $k->{'slug'} . '/' . $k->{'id'} . '</loc>';
                 } else {
                     echo '<loc>' . base_url() . 'view/?key=' . urlencode($k->{'key'}) . '</loc>';
                 }
                 echo '<changefreq>' . $freq . '</changefreq>';
                 echo '<lastmod>' . date('Y-m-d', strtotime($k->{'update_timestamp'})) . '</lastmod>';
                 echo '</url>';
             }
             echo '</urlset>';
         }
     }
 }
Exemplo n.º 13
0
</li>
                  </ul>
                </li>
              <?php 
    }
    ?>

              <?php 
    if (($this->user->hasFunction('PIDS_USER') || $this->user->hasFunction('DOI_USER')) && (mod_enabled('pids') || mod_enabled('mydois'))) {
        ?>
                <li class="btn btn-inverse dropdown">
                  <a class="dropdown-toggle" data-toggle="dropdown" href="#">My Identifiers <b class="caret"></b></a>
                  <ul class="dropdown-menu pull-right">

                    <?php 
        if (mod_enabled('pids') && get_config_item('gPIDS_URL_PREFIX')) {
            ?>
                      <li>
                        <?php 
            echo anchor(apps_url('pids'), 'Identify My Data (PIDS)');
            ?>
                      </li>
                    <?php 
        }
        ?>

                    <?php 
        if ($this->user->hasFunction('DOI_USER') && mod_enabled('mydois')) {
            ?>
                      <li>
                        <?php 
Exemplo n.º 14
0
 /**
  * Class registry
  *
  * This function acts as a singleton. If the requested class does not
  * exist it is instantiated and set to a static variable. If it has
  * previously been instantiated the variable is returned.
  *
  * @param	string:	the class name being requested
  * @param	string:	the directory where the class should be found
  * @param	string:	an optional argument to pass to the class constructor
  * @return	object
  */
 function &load_class($class, $directory = 'libraries', $param = NULL)
 {
     static $_classes = array();
     if (isset($_classes[$class])) {
         return $_classes[$class];
     }
     $name = FALSE;
     $NAMESPACE = '\\FA\\' . strtoupper($directory);
     $prefix_file = '';
     if ($directory == 'core') {
         $prefix_file = 'FA_';
     }
     /**
      * Look for the class first in the local fa-application/libraries folder
      * then in the native fa-system/libraries folder
      */
     foreach (array(APP_PATH, SYS_PATH) as $path) {
         if (file_exists($path . $directory . '/' . $prefix_file . $class . '.php')) {
             $name = 'FA_' . $class;
             if (class_exists($name, FALSE) === FALSE) {
                 require_once $path . $directory . '/' . $prefix_file . $class . '.php';
             }
             break;
         }
     }
     $subclass_prefix = get_config_item('subclass_prefix');
     /**
      * Is the request a class extension? If so we load it too
      */
     if (file_exists(APP_PATH . $directory . '/' . $subclass_prefix . $prefix_file . $class . '.php')) {
         $name = $subclass_prefix . $class;
         if (class_exists($name, FALSE) === FALSE) {
             require_once APP_PATH . $directory . '/' . $name . '.php';
         }
     }
     /**
      * Did we find the class?
      */
     if ($name === FALSE) {
         set_status_header(503);
         echo 'Unable to locate the specified class: ' . $prefix_file . $class . '.php';
         exit;
     }
     /**
      * Keep track of what we just loaded
      */
     is_loaded($class);
     $full_class_name = $NAMESPACE . '\\' . $name;
     $_classes[$class] = isset($param) ? new $full_class_name($param) : new $full_class_name();
     return $_classes[$class];
 }
Exemplo n.º 15
0
 function base_photo()
 {
     echo base_url() . get_config_item('base_photo');
 }
Exemplo n.º 16
0
 function commitSOLR()
 {
     $solrUrl = get_config_item('solr_url');
     $solrUpdateUrl = $solrUrl . 'update/?wt=json';
     return curl_post($solrUpdateUrl . '?commit=true', '<commit waitSearcher="false"/>');
 }
Exemplo n.º 17
0
 /**
  * get a JSON presentation of a data source
  * if there's no data source speficied, get all owned datasource
  * @author Minh Duc Nguyen <*****@*****.**>
  * @param  data_source_id $id
  * @return json
  */
 public function get($id = false)
 {
     //prepare
     acl_enforce('REGISTRY_USER');
     header('Cache-Control: no-cache, must-revalidate');
     header('Content-type: application/json');
     set_exception_handler('json_exception_handler');
     $jsonData = array();
     $jsonData['status'] = 'OK';
     $this->load->model("data_sources", "ds");
     if (!$id) {
         // $this->benchmark->mark('code_start');
         $dataSources = $this->ds->getOwnedDataSources();
         // $this->benchmark->mark('code_end');
         // dd($this->benchmark->elapsed_time('code_start', 'code_end'));
     } elseif ($id && $id != null) {
         // $this->benchmark->mark('code_start');
         ds_acl_enforce($id);
         $ds = $this->ds->getByID($id);
         // Should look at updating stats
         // $ds->updateStats();
         $dataSources = array();
         $dataSources[] = $ds;
         // $this->benchmark->mark('code_end');
         // dd($this->benchmark->elapsed_time('code_start', 'code_end'));
     }
     $this->load->model("registry_object/registry_objects", "ro");
     $items = array();
     foreach ($dataSources as $ds) {
         $item = array();
         $item['title'] = $ds->title;
         $item['id'] = $ds->id;
         $item['counts'] = array();
         foreach ($this->ro->valid_status as $status) {
             if ($ds->getAttribute("count_{$status}") > 0) {
                 array_push($item['counts'], array('status' => $status, 'count' => $ds->getAttribute("count_{$status}"), 'name' => readable($status)));
             }
         }
         $item['qlcounts'] = array();
         foreach ($this->ro->valid_levels as $level) {
             array_push($item['qlcounts'], array('level' => $level, 'title' => $level == 4 ? 'Gold Standard Records' : 'Quality Level ' . $level, 'count' => $ds->getAttribute("count_level_{$level}")));
         }
         $item['classcounts'] = array();
         foreach ($this->ro->valid_classes as $class) {
             if ($ds->getAttribute("count_{$class}") > 0) {
                 array_push($item['classcounts'], array('class' => $class, 'count' => $ds->getAttribute("count_{$class}"), 'name' => readable($class)));
             }
         }
         $item['key'] = $ds->key;
         $item['record_owner'] = $ds->record_owner;
         $item['notes'] = $ds->notes;
         if ($id && $ds) {
             $harvester_methods = get_config_item('harvester_methods');
             if ($harvester_methods) {
                 $item['harvester_methods'] = $harvester_methods;
             }
             foreach ($ds->attributes as $attrib => $value) {
                 $item[$attrib] = $value->value;
             }
             if (isset($item['crosswalks'])) {
                 // $item['crosswalks'] = json_decode($item['crosswalks'], true);
             }
             if (isset($item['harvest_date'])) {
                 date_default_timezone_set('Australia/Canberra');
                 $item['harvest_date'] = date('Y-m-d H:i:s', strtotime($item['harvest_date']));
             }
             //get harvester_method
         }
         array_push($items, $item);
     }
     if ($id && $ds) {
         $logs = $ds->get_logs(0, 10, null, 'all', 'all');
         $items[0]['logs'] = $logs;
     }
     $jsonData['items'] = $items;
     $jsonData = json_encode($jsonData);
     echo $jsonData;
 }
 public function authenticate()
 {
     $this->auth_domain = 'aaf.edu.au';
     if (isset($_SERVER['shib-shared-token'])) {
         $username = $_SERVER['shib-shared-token'];
     } elseif (isset($_SERVER['persistent-id'])) {
         $username = sha1($_SERVER['persistent-id']);
     }
     //update persistent-id
     if (isset($_SERVER['persistent-id'])) {
         $this->cosi_db->where('role_id', $username);
         $this->cosi_db->update('roles', array('persistent_id' => $_SERVER['persistent-id']));
     }
     //update email
     if (isset($_SERVER['mail'])) {
         $this->cosi_db->where('role_id', $username)->update('roles', array('email' => $_SERVER['mail']));
     } elseif (isset($_SERVER['email'])) {
         $this->cosi_db->where('role_id', $username)->update('roles', array('email' => $_SERVER['email']));
     }
     $name = isset($_SERVER['displayName']) ? $_SERVER['displayName'] : 'No Name Given';
     if ($name != 'No Name Given') {
         $result = $this->cosi_db->get_where('roles', array('name' => $name, 'authentication_service_id' => gCOSI_AUTH_METHOD_SHIBBOLETH));
         if ($result->num_rows() > 0) {
             //there's an existing user, update the edupersontargetID
             $role_id = trim($result->row(1)->role_id);
             // log_message('info','role_id is '. $role_id);
             $username = $role_id;
             if (isset($_SERVER['persistent-id'])) {
                 $this->cosi_db->where('role_id', $role_id);
                 $this->cosi_db->update('roles', array('persistent_id' => $_SERVER['persistent-id']));
             }
             if (isset($_SERVER['mail'])) {
                 $this->cosi_db->where('role_id', $username)->update('roles', array('email' => $_SERVER['mail']));
             } elseif (isset($_SERVER['email'])) {
                 $this->cosi_db->where('role_id', $username)->update('roles', array('email' => $_SERVER['email']));
             }
         } else {
             //there's no user has the same name, create the user
             if (isset($_SERVER['mail'])) {
                 $email = $_SERVER['mail'];
             } elseif (isset($_SERVER['email'])) {
                 $email = $_SERVER['email'];
             } else {
                 $email = '';
             }
             $data = array('role_id' => $username, 'role_type_id' => 'ROLE_USER', 'authentication_service_id' => $method, 'enabled' => DB_TRUE, 'name' => $name, 'shared_token' => isset($_SERVER['shib-shared-token']) ? $_SERVER['shib-shared-token'] : '', 'persistent_id' => isset($_SERVER['persistent-id']) ? $_SERVER['persistent-id'] : '', 'email' => $email);
             //send alert email to admin
             $subject = 'A new shibboleth user has been automatically registered';
             $message = 'A new shibboleth user with the name of ' . $name . ' has been automatically registered.';
             if (isset($_SERVER['persistent-id'])) {
                 $message .= 'With the persistent ID of: ' . $_SERVER['persistent-id'] . '.';
             }
             if (isset($_SERVER['shib-shared-token'])) {
                 $message .= 'With the shared token of: ' . $_SERVER['shib-shared-token'] . '.';
             }
             if (isset($_SERVER['mail'])) {
                 $message .= 'With the email of: ' . $email . '.';
             }
             $to = get_config_item('site_admin_email');
             $headers = 'MIME-Version: 1.0' . "\r\n";
             $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
             mail($to, $subject, $message, $headers);
             $this->cosi_db->insert('roles', $data);
             $this->registerAffiliation($username, 'SHIB_AUTHENTICATED', 'SYSTEM');
             $result = $this->cosi_db->get_where("roles", array("role_id" => $username, "role_type_id" => "ROLE_USER", "enabled" => DB_TRUE));
         }
     }
     $user = $result->row(1);
     $this->return_roles($user);
 }
Exemplo n.º 19
0
<script>
	var base_url = "{{base_url()}}";
	var registry_url = "{{registry_url()}}";
</script>

@if(get_config_item('tracking'))
    <?php 
$tracking = get_config_item('tracking');
?>
    @if($tracking['googleGA']['enabled'])
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          ga('create', '{{ $tracking['googleGA']['keys']['id'] }}', 'auto');
          ga('send', 'pageview');
          urchin_id = '{{ $tracking['googleGA']['keys']['id'] }}';
        </script>
    @endif
    @if($tracking['luckyOrange']['enabled'])
        <script type='text/javascript'>
        window.__wtw_lucky_site_id = {{ $tracking['luckyOrange']['keys']['id'] }};

        (function() {
            var wa = document.createElement('script'); wa.type = 'text/javascript'; wa.async = true;
            wa.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://cdn') + '.luckyorange.com/w.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wa, s);
          })();
        </script>
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     if (isset($context["input"])) {
         $_input_ = $context["input"];
     } else {
         $_input_ = null;
     }
     if ($this->getAttribute($_input_, "server", array(0 => "HTTP_X_PJAX"), "method") == null) {
         // line 2
         echo "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\n    <title>";
         // line 8
         if (isset($context["page_title"])) {
             $_page_title_ = $context["page_title"];
         } else {
             $_page_title_ = null;
         }
         echo twig_escape_filter($this->env, $_page_title_, "html", null, true);
         echo " | ";
         echo twig_escape_filter($this->env, get_config_item("System", "main_title", "office/OfficeConfig"), "html", null, true);
         echo "</title>\n\n    <!-- Bootstrap core CSS -->\n    <link href=\"";
         // line 11
         echo twig_escape_filter($this->env, base_url(), "html", null, true);
         echo "public/css/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"";
         // line 12
         echo twig_escape_filter($this->env, base_url(), "html", null, true);
         echo "public/css/bootstrap-reset.css\" rel=\"stylesheet\">\n    <!--external css-->\n    <link href=\"";
         // line 14
         echo twig_escape_filter($this->env, base_url(), "html", null, true);
         echo "public/assets/font-awesome/css/font-awesome.css\" rel=\"stylesheet\" />\n    <link href=\"";
         // line 15
         echo twig_escape_filter($this->env, base_url(), "html", null, true);
         echo "public/css/sweetalert.css\" rel=\"stylesheet\" />\n    <!-- Custom styles for this template -->\n    <link href=\"";
         // line 17
         echo twig_escape_filter($this->env, base_url(), "html", null, true);
         echo "public/css/style.css\" rel=\"stylesheet\">\n    <link href=\"";
         // line 18
         echo twig_escape_filter($this->env, base_url(), "html", null, true);
         echo "public/css/style-responsive.css\" rel=\"stylesheet\" />\n    <link href=\"";
         // line 19
         echo twig_escape_filter($this->env, base_url(), "html", null, true);
         echo "public/css/animate.css\" rel=\"stylesheet\" />\n    <link href=\"";
         // line 20
         echo twig_escape_filter($this->env, base_url(), "html", null, true);
         echo "public/css/loadingbar.css\" rel=\"stylesheet\" />\n  </head>\n\n  <body>\n\n<section id=\"container\" class=\"";
         // line 25
         if (isset($context["view_sidebar"])) {
             $_view_sidebar_ = $context["view_sidebar"];
         } else {
             $_view_sidebar_ = null;
         }
         echo twig_escape_filter($this->env, $_view_sidebar_, "html", null, true);
         echo "\">\n      <!--header start-->\n      <header class=\"header white-bg\">\n          <div class=\"sidebar-toggle-box\">\n              <div data-original-title=\"";
         // line 29
         echo twig_escape_filter($this->env, lang("toggle_navigation"), "html", null, true);
         echo "\" data-placement=\"right\" class=\"icon-reorder tooltips\"></div>\n          </div>\n          <!--logo start-->\n          ";
         // line 32
         $context["title"] = twig_split_filter(get_config_item("System", "title", "office/OfficeConfig"), " ");
         // line 33
         echo "          <a href=\"#\" class=\"logo\" >";
         if (isset($context["title"])) {
             $_title_ = $context["title"];
         } else {
             $_title_ = null;
         }
         echo twig_escape_filter($this->env, $this->getAttribute($_title_, 0, array(), "array"), "html", null, true);
         echo " <span> ";
         if (isset($context["title"])) {
             $_title_ = $context["title"];
         } else {
             $_title_ = null;
         }
         echo twig_escape_filter($this->env, $this->getAttribute($_title_, 1, array(), "array"), "html", null, true);
         echo " </span> </a>\n          <!--logo end-->\n          <div class=\"nav notify-row\" id=\"top_menu\">\n            <!--  notification start -->\n            <ul class=\"nav top-menu\">\n              <!-- settings start -->\n              <li class=\"dropdown\">\n                  <a data-toggle=\"dropdown\" class=\"dropdown-toggle\" href=\"#\">\n                      <span style=\"font-size: 9pt;\">";
         // line 41
         echo twig_escape_filter($this->env, lang("language_box"), "html", null, true);
         echo "</span>\n                  </a>\n                  <ul class=\"dropdown-menu extended tasks-bar\">\n                      <div class=\"notify-arrow notify-arrow-green\"></div>\n                      <li>\n                          <p class=\"green\">";
         // line 46
         echo twig_escape_filter($this->env, lang("language_selection"), "html", null, true);
         echo "</p>\n                      </li>\n                      <li>\n                          <a href=\"?lang=ru\">\n                              <div class=\"task-info\">\n                                  <div class=\"desc\">";
         // line 51
         echo twig_escape_filter($this->env, lang("ru_lang"), "html", null, true);
         echo "</div>\n                              </div>\n                          </a>\n                      </li>\n                      <li>\n                          <a href=\"?lang=en\">\n                              <div class=\"task-info\">\n                                  <div class=\"desc\">";
         // line 58
         echo twig_escape_filter($this->env, lang("en_lang"), "html", null, true);
         echo "</div>\n                              </div>\n                          </a>\n                      </li>\n                  </ul>\n              </li>\n              <!-- settings end -->\n          </div>\n          <div class=\"top-nav \">\n              <ul class=\"nav pull-right top-menu\">\n                  <li>\n                      <input type=\"text\" id=\"search_menu\" class=\"form-control search\" placeholder=\"Search\">\n                  </li>\n                  <!-- user login dropdown start-->\n                  <li class=\"dropdown\">\n                      ";
         // line 73
         if (isset($context["session"])) {
             $_session_ = $context["session"];
         } else {
             $_session_ = null;
         }
         if ($this->getAttribute($_session_, "has_userdata", array(0 => "user_logged_in"), "method")) {
             // line 74
             echo "                        <a data-toggle=\"dropdown\" class=\"dropdown-toggle\" href=\"#\">\n                            <i class=\"icon-user\"></i>\n                            <span class=\"username\">";
             // line 76
             if (isset($context["session"])) {
                 $_session_ = $context["session"];
             } else {
                 $_session_ = null;
             }
             echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($_session_, "userdata", array(0 => "user_logged_in"), "method"), "login"), "html", null, true);
             echo "</span>\n                            <b class=\"caret\"></b>\n                        </a>\n                        <ul class=\"dropdown-menu extended logout\">\n                            <div class=\"log-arrow-up\"></div>\n                            <li><a data-pjax href=\"";
             // line 81
             echo twig_escape_filter($this->env, site_url(), "html", null, true);
             echo "main\"><i class=\" icon-suitcase\"></i>";
             echo twig_escape_filter($this->env, lang("profile"), "html", null, true);
             echo "</a></li>\n                            ";
             // line 82
             $context["edit_profile"] = twig_split_filter(lang("edit_profile"), " ");
             // line 83
             echo "                            <li><a data-pjax href=\"";
             echo twig_escape_filter($this->env, site_url(), "html", null, true);
             echo "main/edit\"><i class=\"icon-cog\"></i> ";
             if (isset($context["edit_profile"])) {
                 $_edit_profile_ = $context["edit_profile"];
             } else {
                 $_edit_profile_ = null;
             }
             echo twig_escape_filter($this->env, $this->getAttribute($_edit_profile_, 0, array(), "array"), "html", null, true);
             echo "<br>";
             if (isset($context["edit_profile"])) {
                 $_edit_profile_ = $context["edit_profile"];
             } else {
                 $_edit_profile_ = null;
             }
             echo twig_escape_filter($this->env, $this->getAttribute($_edit_profile_, 1, array(), "array"), "html", null, true);
             echo "</a></li>\n                            <li><a data-pjax href=\"";
             // line 84
             echo twig_escape_filter($this->env, site_url(), "html", null, true);
             echo "main/edit\"><i class=\"icon-dollar\"></i> Пополнение<br>счета</a></li>\n                            <li><a data-pjax href=\"";
             // line 85
             echo twig_escape_filter($this->env, site_url(), "html", null, true);
             echo "main/logout\"><i class=\"icon-key\"></i> ";
             echo twig_escape_filter($this->env, lang("exit_button"), "html", null, true);
             echo "</a></li>\n                        </ul>\n                      ";
         }
         // line 88
         echo "                  </li>\n                  <!-- user login dropdown end -->\n              </ul>\n          </div>\n      </header>\n";
     }
     // line 93
     echo "  \n<div id=\"pjax-container\">\n";
     // line 95
     $template = $this->env->resolveTemplate(get_config_item("System", "template", "office/OfficeConfig") . "/template/menu.tpl");
     $template->display($context);
 }
Exemplo n.º 21
0
 */
require_once SYS_PATH . 'core/FA_Common.php';
/**
 * ------------------------------------------------------
 * Special handler
 * ------------------------------------------------------
 */
set_error_handler('_error_handler');
set_exception_handler('_exception_handler');
register_shutdown_function('_shutdown_handler');
/**
 * ------------------------------------------------------
 * Set charset
 * ------------------------------------------------------
 */
$charset = strtoupper(get_config_item('charset'));
if ($charset) {
    ini_set('default_charset', $charset);
    if (extension_loaded('mbstring')) {
        define('MB_ENABLED', TRUE);
        /**
         * mbstring.internal_encoding is deprecated starting with PHP 5.6
         * and it's usage triggers E_DEPRECATED messages.
         */
        @ini_set('mbstring.internal_encoding', $charset);
        /**
         * This is required for mb_convert_encoding() to strip invalid characters.
         * That's utilized by FA_UTF8, but it's also done for consistency with iconv.
         */
        mb_substitute_character('none');
    } else {
Exemplo n.º 22
0
 /**
  * CSRF Set Cookie
  *
  * @codeCoverageIgnore
  * @return	FA_Security
  */
 public function csrf_set_cookie()
 {
     $expire = time() + $this->_csrf_expire;
     $secure_cookie = (bool) get_config_item('cookie_secure');
     if ($secure_cookie && !is_https()) {
         return FALSE;
     }
     setcookie($this->_csrf_cookie_name, $this->_csrf_hash, $expire, get_config_item('cookie_path'), get_config_item('cookie_domain'), $secure_cookie, get_config_item('cookie_httponly'));
     log_message(MSG_INFO, 'CSRF cookie sent');
     return $this;
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     echo "<script type=\"text/javascript\">\n\n__construct({\n\t\tcsrf       :\"";
     // line 4
     if (isset($context["security"])) {
         $_security_ = $context["security"];
     } else {
         $_security_ = null;
     }
     echo twig_escape_filter($this->env, $this->getAttribute($_security_, "get_csrf_hash", array(), "method"), "html", null, true);
     echo "\",\n\t\tserver_url :\"";
     // line 5
     echo twig_escape_filter($this->env, site_url(), "html", null, true);
     echo "\"\n});\nswal.setDefaults({ confirmButtonText: '";
     // line 7
     echo twig_escape_filter($this->env, lang("ok"), "html", null, true);
     echo "', cancelButtonText: '";
     echo twig_escape_filter($this->env, lang("cancel"), "html", null, true);
     echo "' });\n\n\$( \"#login\" ).keypress(function() {\n    if(\$( \"#login\" ).val().indexOf(\"!\") == 0){\n        \$( \"#fireguard\" ).hide(500);\n    }else{\n       \$( \"#fireguard\" ).show(500); \n    }\n});\nfunction restore_pw()\n{\n\tswal({   \n\t\ttitle: \"";
     // line 19
     echo twig_escape_filter($this->env, lang("title_login_recovery"), "html", null, true);
     echo "\",\n\t\ttext: \"";
     // line 20
     echo twig_escape_filter($this->env, lang("recovery_enter_email"), "html", null, true);
     echo "\",\n\t\ttype: \"input\",   showCancelButton: true,\n\t\tcloseOnConfirm: false,\n\t\tinputType: \"email\",\n\t    inputPlaceholder: \"Email\" },\n\t    function(inputValue)\n\t    {   \n\t    \tif (inputValue === false) \n\t    \t\treturn false;     \n\t    \tif (inputValue === \"\") \n\t    \t{     \n\t    \t\tswal.showInputError(\"";
     // line 31
     echo twig_escape_filter($this->env, lang("fill_out_field"), "html", null, true);
     echo "\");\n\t    \t\treturn false \n\t    \t}     \n\t    \tvar result = __construct.CallMethode('login/do_recovery_ajax', { \"email\" : inputValue });\n\t    \tswitch(parseInt(result.status_code, 10)){\n\t    \t\tcase 78942: // bad email\n\t    \t\t\tswal.showInputError(\"";
     // line 37
     echo twig_escape_filter($this->env, lang("recovery_email_not_found"), "html", null, true);
     echo "\");\n\t    \t\t\treturn false ;\n\t    \t\tbreak;\n\t    \t\tcase 34872: // Success send\n\t    \t\t\tswal(\"";
     // line 41
     echo twig_escape_filter($this->env, lang("success_message"), "html", null, true);
     echo "\", \"";
     echo twig_escape_filter($this->env, lang("recovery_password_sent_s"), "html", null, true);
     echo "\", \"success\");\n\t    \t\t\treturn true;\n\t    \t\tbreak;\n\t    \t}\n\t\t}\n\t);\n}\nfunction show_captcha(){\n\tswal({   \n\t\ttitle: \"Captcha\",  \n\t\ttext: \"<center><div class='g-recaptcha' data-sitekey='";
     // line 51
     echo twig_escape_filter($this->env, get_config_item("Captcha", "public_key", "office/OfficeConfig"), "html", null, true);
     echo "'  style='transform:scale(0.96);transform-origin:0;-webkit-transform:scale(0.96);transform:scale(0.96);-webkit-transform-origin:0 0;transform-origin:0 0; 0'></div></center><br>\", \n\t\thtml: true,\n\t\tcloseOnConfirm: false,\n\t\tshowCancelButton: true\n\t},\n\tfunction(){\n\t\tif(grecaptcha.getResponse() == \"\"){\n\t\t\tswal.showInputError(\"Invalid captcha!\");\n\t\t\treturn false\n\t\t}\n\t\tconsole.log(grecaptcha.getResponse());\n\t\tswal.close();\n\t});\n}\n\$(\"#loginForm\").validate({\n    rules:{\n        login:{\n            required:true,\n            minlength:2,\n            maxlength:12\n        },\n        password:{\n            required:true,\n            minlength:2,\n            maxlength:12\n        },\n        fireguard:{\n        \trequired:true\n        }\n    },\n    submitHandler: function (form) {\n    \tvar result = __construct.CallMethode('login/do_login_ajax', \$(form).serializeObject());\n    \tswitch(parseInt(result.status_code, 10)){\n    \t\tcase 11111:\n    \t\t\twindow.location.replace('";
     // line 85
     echo twig_escape_filter($this->env, site_url(), "html", null, true);
     echo "main');\n    \t\tbreak;\n    \t\tcase 23457: // wrong log or pw\n    \t\t\tsweetAlert(\"";
     // line 88
     echo twig_escape_filter($this->env, lang("error_message"), "html", null, true);
     echo "\", \"";
     echo twig_escape_filter($this->env, lang("message_23457"), "html", null, true);
     echo "\", \"error\");\n    \t\tbreak;\n    \t\tcase 45879: // fill out all required fields\n    \t\t\tsweetAlert(\"";
     // line 91
     echo twig_escape_filter($this->env, lang("error_message"), "html", null, true);
     echo "\", \"";
     echo twig_escape_filter($this->env, lang("message_45879"), "html", null, true);
     echo "\", \"error\");\n    \t\tbreak;\n    \t\tcase 75421: // account not active\n    \t\t\tsweetAlert(\"";
     // line 94
     echo twig_escape_filter($this->env, lang("error_message"), "html", null, true);
     echo "\", \"";
     echo twig_escape_filter($this->env, lang("message_75421"), "html", null, true);
     echo "\", \"info\");\n    \t\tbreak;\n    \t}\n        return false;\n    },\n    errorPlacement: function(error, element) {\n          error.insertBefore(element);\n    }\n});\n\n\$(\"#registerForm\").validate({\n    rules:{\n        login:{\n            required:true,\n            minlength:4,\n            maxlength:12\n        },\n        password:{\n            required:true,\n            minlength:4,\n            maxlength:12\n        },\n        repeat_password:{\n            required:true,\n            minlength:4,\n            maxlength:12\n        },\n        email:{\n        \trequired:true,\n        \temail:true\n        }\n    },\n    submitHandler: function (form) {\n    \tvar data = \$(form).serializeObject();\n    \tdata['g-captcha-response-code'] = grecaptcha.getResponse();\n    \tvar result = __construct.CallMethode('login/do_register_ajax', data);\n\n    \tswitch(parseInt(result.status_code, 10)){\n    \t\tcase 22148: // success registration\n\t\t\t\tswal({   \n\t\t\t\t\ttitle: \"";
     // line 134
     echo twig_escape_filter($this->env, lang("success_message"), "html", null, true);
     echo "\",  \n\t\t\t\t\ttext: \"";
     // line 135
     echo twig_escape_filter($this->env, lang("message_22148"), "html", null, true);
     echo "<br><br> \" +\n\t\t\t\t\t\t\t\t\"<div class='alert alert-success fade in'>\"+\n                                 \" <strong>";
     // line 137
     echo twig_escape_filter($this->env, lang("login_input"), "html", null, true);
     echo ": </strong> \"+ data['login'] +\" </br> \" +\n                                 \" <strong>";
     // line 138
     echo twig_escape_filter($this->env, lang("password_input"), "html", null, true);
     echo ": </strong> \"+ data['password'] +\" \" +\n                              \t\"</div>\",\n\t\t\t\t\ttype: \"success\", \n\t\t\t\t\tconfirmButtonText: \"";
     // line 141
     echo twig_escape_filter($this->env, lang("back_to_login"), "html", null, true);
     echo "\",\n\t\t\t\t\thtml: true,\n\t\t\t\t\tcloseOnConfirm: true,\n\t\t\t\t\tshowCancelButton: true\n\t\t\t\t},\n\t\t\t\tfunction(){\n\t\t\t\t\twindow.location.replace('";
     // line 147
     echo twig_escape_filter($this->env, site_url(), "html", null, true);
     echo "login');\n\t\t\t\t});\n    \t\tbreak;\n    \t\tcase 22647: // User already registered\n    \t\t\tsweetAlert(\"";
     // line 151
     echo twig_escape_filter($this->env, lang("error_message"), "html", null, true);
     echo "\", \"";
     echo twig_escape_filter($this->env, lang("message_22647"), "html", null, true);
     echo "\", \"error\");\n    \t\t\tgrecaptcha.reset();\n    \t\tbreak;\n    \t\tcase 64787: // bad captcha\n    \t\t\tsweetAlert(\"";
     // line 155
     echo twig_escape_filter($this->env, lang("error_message"), "html", null, true);
     echo "\", \"";
     echo twig_escape_filter($this->env, lang("message_64787"), "html", null, true);
     echo "\", \"error\");\n    \t\t\tgrecaptcha.reset();\n    \t\tbreak;\n    \t\tcase 64789: // Captcha not passed\n    \t\t    sweetAlert(\"";
     // line 159
     echo twig_escape_filter($this->env, lang("error_message"), "html", null, true);
     echo "\", \"";
     echo twig_escape_filter($this->env, lang("message_64789"), "html", null, true);
     echo "\", \"error\");\n    \t\tbreak;\n    \t\tcase 45879: // fill out all required fields\n    \t\t\tsweetAlert(\"";
     // line 162
     echo twig_escape_filter($this->env, lang("error_message"), "html", null, true);
     echo "\", \"";
     echo twig_escape_filter($this->env, lang("message_45879"), "html", null, true);
     echo "\", \"error\");\n    \t\t\tgrecaptcha.reset();\n    \t\tbreak;\n    \t}\n        return false;\n    },\n    errorPlacement: function(error, element) {\n          error.insertBefore(element);\n    }\n});\n</script>";
 }
Exemplo n.º 24
0
 function status()
 {
     set_exception_handler('json_exception_handler');
     header('Cache-Control: no-cache, must-revalidate');
     header('Content-type: application/json');
     $data = array();
     $data['solr'] = array('url' => get_config_item('solr_url'));
     $data['deployment'] = array('state' => get_config_item('deployment_state'));
     $data['admin'] = array('name' => get_config_item('site_admin'), 'email' => get_config_item('site_admin_email'));
     echo json_encode($data);
 }
Exemplo n.º 25
0
 /**
  * Fetch the IP Address
  *
  * Determines and validates the visitor's IP address.
  *
  * @return	string	IP address
  */
 public function ip_address()
 {
     if ($this->ip_address !== FALSE) {
         return $this->ip_address;
     }
     $proxy_ips = get_config_item('proxy_ips');
     if (!empty($proxy_ips) && !is_array($proxy_ips)) {
         $proxy_ips = explode(',', str_replace(' ', '', $proxy_ips));
     }
     $this->ip_address = $this->server('REMOTE_ADDR');
     if ($proxy_ips) {
         foreach (array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_X_CLIENT_IP', 'HTTP_X_CLUSTER_CLIENT_IP') as $header) {
             if (($spoof = $this->server($header)) !== NULL) {
                 /**
                  * Some proxies typically list the whole chain of IP
                  * addresses through which the client has reached us.
                  * e.g. client_ip, proxy_ip1, proxy_ip2, etc.
                  */
                 sscanf($spoof, '%[^,]', $spoof);
                 if (!$this->valid_ip($spoof)) {
                     $spoof = NULL;
                 } else {
                     break;
                 }
             }
         }
         if (isset($spoof) && $spoof) {
             for ($i = 0, $c = count($proxy_ips); $i < $c; $i++) {
                 // Check if we have an IP address or a subnet
                 if (strpos($proxy_ips[$i], '/') === FALSE) {
                     // An IP address (and not a subnet) is specified.
                     // We can compare right away.
                     if ($proxy_ips[$i] === $this->ip_address) {
                         $this->ip_address = $spoof;
                         break;
                     }
                     continue;
                 }
                 // We have a subnet ... now the heavy lifting begins
                 isset($separator) or $separator = $this->valid_ip($this->ip_address, 'ipv6') ? ':' : '.';
                 // If the proxy entry doesn't match the IP protocol - skip it
                 if (strpos($proxy_ips[$i], $separator) === FALSE) {
                     continue;
                 }
                 // Convert the REMOTE_ADDR IP address to binary, if needed
                 if (!isset($ip, $sprintf)) {
                     if ($separator === ':') {
                         // Make sure we're have the "full" IPv6 format
                         $ip = explode(':', str_replace('::', str_repeat(':', 9 - substr_count($this->ip_address, ':')), $this->ip_address));
                         for ($j = 0; $j < 8; $j++) {
                             $ip[$j] = intval($ip[$j], 16);
                         }
                         $sprintf = '%016b%016b%016b%016b%016b%016b%016b%016b';
                     } else {
                         $ip = explode('.', $this->ip_address);
                         $sprintf = '%08b%08b%08b%08b';
                     }
                     $ip = vsprintf($sprintf, $ip);
                 }
                 /**
                  * @var int $masklen
                  */
                 // Split the netmask length off the network address
                 sscanf($proxy_ips[$i], '%[^/]/%d', $netaddr, $masklen);
                 // Again, an IPv6 address is most likely in a compressed form
                 if ($separator === ':') {
                     $netaddr = explode(':', str_replace('::', str_repeat(':', 9 - substr_count($netaddr, ':')), $netaddr));
                     for ($i = 0; $i < 8; $i++) {
                         $netaddr[$i] = intval($netaddr[$i], 16);
                     }
                 } else {
                     $netaddr = explode('.', $netaddr);
                 }
                 // Convert to binary and finally compare
                 if (strncmp($ip, vsprintf($sprintf, $netaddr), $masklen) === 0) {
                     $this->ip_address = $spoof;
                     break;
                 }
             }
         }
     }
     if (!$this->valid_ip($this->ip_address)) {
         return $this->ip_address = '0.0.0.0';
     }
     return $this->ip_address;
 }
Exemplo n.º 26
0
 public function list_files($id = false)
 {
     if (!$id) {
         throw new Exception('Data Source ID required');
     }
     $dir = get_config_item('harvested_contents_path');
     if (!$dir) {
         throw new Exception('Harvested Contents Path not configured');
     }
     if ($this->input->get('path')) {
         $path = $this->input->get('path');
         if (!is_file($path)) {
             throw new Exception('Path not found');
         }
         $content = @file_get_contents($path);
         echo json_encode(array('status' => 'OK', 'content' => $content));
         return;
     }
     $path = $dir . $id;
     if (!is_dir($path)) {
         throw new Exception('Datasource does not have any harvested path');
     }
     $batches = array();
     foreach (scandir($path) as $f) {
         if ($f != "." && $f != "..") {
             $batches[] = $f;
         }
     }
     if (sizeof($batches) == 0) {
         throw new Exception('Data source does not have any batch harvested');
     }
     $result = array();
     foreach ($batches as $b) {
         $link = $path . '/' . $b;
         if (is_file($link)) {
             $result[] = array('type' => 'file', 'link' => $link, 'name' => $b);
         }
         if (is_dir($link)) {
             $files = array();
             foreach (scandir($link) as $file) {
                 if ($file != "." && $file != "..") {
                     $files[] = array('type' => 'file', 'link' => $link . '/' . $file, 'name' => $file);
                 }
             }
             $result[] = array('type' => 'folder', 'link' => $link, 'files' => $files, 'name' => $b);
         }
     }
     echo json_encode(array('status' => 'OK', 'content' => $result));
 }
Exemplo n.º 27
0
function ulog_email($subject = '', $message = '', $logger = 'activity', $type = 'info')
{
    ulog($message, $logger, $type);
    $_ci =& get_instance();
    $siteAdmin = get_config_item('site_admin') ? get_config_item('site_admin') : 'Site Admin';
    $siteInstance = get_config_item('environment_name') ? get_config_item('environment_name') : 'Site Instance';
    $siteState = get_config_item('deployment_state') ? " (" . get_config_item('deployment_state') . ")" : '';
    $email = $_ci->load->library('email');
    $email->from(get_config_item('site_admin_email'), $siteAdmin);
    $email->to(get_config_item('site_admin_email'));
    $email->subject($subject);
    $email->message($message);
    $email->send();
}
Exemplo n.º 28
0
 /**
  * 获取通过 set_cookie 设置的 cookie 变量 
  * @param string $var 变量名
  * @param string $default 默认值 
  * @return mixed 成功则返回cookie 值,否则返回 false
  */
 function get_cookie($var, $default = '')
 {
     $var = get_config_item("cookie_prefix") . $var;
     return isset($_COOKIE[$var]) ? sys_auth($_COOKIE[$var], 'DECODE') : $default;
 }
Exemplo n.º 29
0
 public function _set_data($data = array())
 {
     // 追加全局变量
     $data['_UID'] = $this->_UID;
     $data['_U_NAME'] = $this->_U_NAME;
     $data['_U_INFO'] = $this->_U_INFO;
     $data['_WEB_HOST'] = $this->_WEB_HOST;
     $data['current_class'] = $this->router->class;
     $cur_directory = $this->uri->segment(1, 0);
     //当前文件名
     $data['cur_file'] = $cur_directory;
     $data['sys_web_name'] = get_config_item('sys_web_name');
     //网站名称
     $this->_DATA = $data;
 }
Exemplo n.º 30
0
<p style="text-align:center">
	<small>Log into the ANDS Online Services Dashboard using your AAF credentials: </small>
	<img src="<?php 
echo asset_url('img/aaf_logo.gif', 'base');
?>
" alt="AAF Logo" style="display:block;margin:10px auto">
	<a 
		href="<?php 
echo get_config_item('aaf_rapidconnect_url');
?>
"
		class="btn btn-primary btn-block">
		Login using Australian Access Federation (AAF) credentials
	</a>
</p>