Ejemplo n.º 1
0
 static function _n($singular, $plural, $count)
 {
     if (function_exists('_n')) {
         $domain = HC_App::app();
         return _n($singular, $plural, $count, $domain);
     } else {
         $gettext_obj = hc_get_gettext();
         if ($gettext_obj === NULL) {
             return $plural;
         } else {
             return $gettext_obj->ngettext($singular, $plural, $count);
         }
     }
 }
Ejemplo n.º 2
0
 function __construct()
 {
     parent::__construct();
     // if we need to simulate user - in WP shortcut page */
     $app = HC_App::app();
     if (isset($GLOBALS['NTS_CONFIG'][$app]['SIMULATE_USER_ID'])) {
         $acl = HC_App::acl();
         $simulate_id = $GLOBALS['NTS_CONFIG'][$app]['SIMULATE_USER_ID'];
         $auth_user = $this->auth->user();
         $acl_user = $this->auth->user($simulate_id);
         if ($auth_user->level >= $auth_user->_const('LEVEL_MANAGER')) {
             $acl->set_user($acl_user);
         }
     }
 }
Ejemplo n.º 3
0
 protected function _drop_tables()
 {
     $this->db->reset_data_cache();
     $app = HC_App::app();
     $my_table_prefix = isset($GLOBALS['NTS_CONFIG'][$app]['DB_TABLES_PREFIX']) ? $GLOBALS['NTS_CONFIG'][$app]['DB_TABLES_PREFIX'] : NTS_DB_TABLES_PREFIX;
     $dbprefix_version = $this->config->item('nts_dbprefix_version');
     if ($dbprefix_version) {
         $my_table_prefix = $my_table_prefix . $dbprefix_version . '_';
     }
     $tables = array();
     $sth = $this->db->query("SHOW TABLES LIKE '" . $my_table_prefix . "%'");
     foreach ($sth->result_array() as $r) {
         reset($r);
         foreach ($r as $k => $v) {
             $tables[] = $v;
         }
     }
     reset($tables);
     foreach ($tables as $t) {
         $this->db->query("DROP TABLE " . $t . "");
     }
 }
Ejemplo n.º 4
0
        $user_title .= $user->username;
    } else {
        $user_title .= $user->email;
    }
    $user_title .= ']';
    $link_profile = 'auth/profile';
    $nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link($link_profile))->add_child($user_title));
    $auth_user = $this->auth->user();
    $acl = HC_App::acl();
    $acl_user = $acl->user();
    $ri = HC_Lib::ri();
    if ($auth_user->id != $acl_user->id) {
        if ($ri == 'wordpress') {
            if ($auth_user->level >= $auth_user->_const('LEVEL_MANAGER')) {
                $nav->add_divider();
                $app = HC_App::app();
                $admin_url = get_admin_url() . 'admin.php?page=' . $app;
                $nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', $admin_url)->add_child(HC_Html::icon('cogs'))->add_child(HC_Html_Factory::element('span')->add_attr('class', 'hidden-xs')->add_child(HCM::__('Admin Area'))));
            }
        }
    }
    $nav->add_divider();
    $nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('auth/logout'))->add_child(HC_Html_Factory::element('span')->add_attr('class', 'hidden-xs')->add_child(HCM::__('Log Out')))->add_child(HC_Html::icon('sign-out')));
} else {
    if ($this_method != 'login') {
        $nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('auth/login'))->add_child(HC_Html::icon('sign-in'))->add_child(HC_Html_Factory::element('span')->add_attr('class', 'hidden-xs')->add_child(HCM::__('Log In'))));
    } else {
        $nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link())->add_child(HC_Html::icon('arrow-left'))->add_child(HCM::__('Back To Start Page')));
    }
}
$out->add_child($nav);