Exemple #1
0
    /**
     * Sets the user groups membership
     * @author:     Albert Pérez Monfort (aperezm@xtec.cat)
     * @author: 	Josep Ferràndiz (jferran6@xtec.cat)
     * @param:	Array with the id's of the groups where the user will be enroled
     * @return:	True if success and false in other case
     */
    public function addUserToGroup($args) {
        $roles = FormUtil::getPassedValue('roles', isset($args['roles']) ? $args['roles'] : null, 'POST');
        $defaultRoles = FormUtil::getPassedValue('defaultRoles', isset($args['defaultRoles']) ? $args['defaultRoles'] : null, 'POST');
        // Security check
        if (!SecurityUtil::checkPermission('IWmyrole::', "::", ACCESS_ADMIN) && $defaultRoles != 1) {
            throw new Zikula_Exception_Forbidden();
        }
        if ($defaultRoles == 1) {
            $roles = array();
            //get user default roles
            $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
            $defaultRoles = ModUtil::func('IWmain', 'user', 'userGetVar',
                                           array('uid' => $uid,
                                                 'name' => 'defaultRoles',
                                                 'module' => 'IWmyrole',
                                                 'sv' => $sv));

            //set default roles
            $userGroups = explode('$$', $defaultRoles);
            $i = 0;
            foreach ($userGroups as $group) {
                if ($group != '') {
                    $roles[$i] = $group;
                    $i++;
                }
            }
        }
        $uid = UserUtil::getVar('uid');
        $count = count($roles);
        for ($i = 0; $i < $count; $i++) {
            //Check if user belongs to change group. If not the block is not showed
            $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
            $isMember = ModUtil::func('IWmain', 'user', 'isMember',
                                       array('sv' => $sv,
                                             'gid' => $roles[$i],
                                             'uid' => $uid));
            if (!$isMember) {
                $obj[] = array('uid' => $uid,
                               'gid' => $roles[$i]);
            }
        }

        if ($count > 0) {
            if (!DBUtil::insertObjectArray($obj, 'group_membership')) {
                return LogUtil::registerError($this->__('Error! Creation attempt failed.'));
            }
        }
        return true;
    }
Exemple #2
0
 /**
  * Changeblockorder.
  *
  * @param blockorder array of sorted blocks (value = block id)
  * @param position int zone id
  *
  * @return mixed true or Ajax error
  */
 public function changeblockorder()
 {
     $this->checkAjaxToken();
     $this->throwForbiddenUnless(SecurityUtil::checkPermission('Blocks::', '::', ACCESS_ADMIN));
     $blockorder = $this->request->getPost()->get('blockorder');
     $position = $this->request->getPost()->get('position');
     // empty block positions for this block zone
     $res = DBUtil::deleteObjectByID('block_placements', $position, 'pid');
     if (!$res) {
         throw new Zikula_Exception_Fatal($this->__('Error! Could not save your changes.'));
     }
     // add new block positions
     $blockplacements = array();
     foreach ((array) $blockorder as $order => $bid) {
         $blockplacements[] = array('bid' => $bid, 'pid' => $position, 'order' => $order);
     }
     if (!empty($blockplacements)) {
         $res = DBUtil::insertObjectArray($blockplacements, 'block_placements');
         if (!$res) {
             throw new Zikula_Exception_Fatal($this->__('Error! Could not save your changes.'));
         }
     }
     return new Zikula_Response_Ajax(array('result' => true));
 }
Exemple #3
0
    /**
     * create the default data for the groups module
     *
     * This function is only ever called once during the lifetime of a particular
     * module instance
     *
     * @return bool false
     */
    public function defaultdata()
    {
        $records = array(
            array(  'name'        => $this->__('Users'),
                    'description' => $this->__('By default, all users are made members of this group.'),
                    'prefix'      => $this->__('usr')),
            array(  'name'        => $this->__('Administrators'),
                    'description' => $this->__('Group of administrators of this site.'),
                    'prefix'      => $this->__('adm'))
        );

        DBUtil::insertObjectArray($records, 'groups', 'gid');

        // Insert Anonymous and Admin users
        $records = array(
            // Anonymous user, member of Users group (This is required. Handling of 'unregistered' state for
            // permissions is handled separately.)
            array('gid' => '1',
                  'uid' => '1'),
            // Admin user, member of Users group (Not strictly necessary, but for completeness.)
            array('gid' => '1',
                  'uid' => '2'),
            // Admin user, member of Administrators group
            array('gid' => '2',
                  'uid' => '2')
        );

        DBUtil::insertObjectArray($records, 'group_membership', 'gid', true);
    }
Exemple #4
0
 public function resetPermissions()
 {
     // Delete all current permission entries.
     if (!DBUtil::truncateTable('group_perms')) {
         $this->setError(__('Error! Permission not deleted'));
         return false;
     }
     // Array of permission objects to insert.
     $perms = array();
     $perms[] = array('pid' => 1, 'gid' => 2, 'sequence' => 1, 'realm' => 0, 'component' => '.*', 'instance' => '.*', 'level' => 800, 'bond' => 0);
     $perms[] = array('pid' => 2, 'gid' => -1, 'sequence' => 2, 'realm' => 0, 'component' => 'ExtendedMenublock::', 'instance' => '1:2:', 'level' => 0, 'bond' => 0);
     $perms[] = array('pid' => 3, 'gid' => 1, 'sequence' => 3, 'realm' => 0, 'component' => '.*', 'instance' => '.*', 'level' => 300, 'bond' => 0);
     $perms[] = array('pid' => 4, 'gid' => 0, 'sequence' => 4, 'realm' => 0, 'component' => 'ExtendedMenublock::', 'instance' => '1:(1|3):', 'level' => 0, 'bond' => 0);
     $perms[] = array('pid' => 5, 'gid' => 0, 'sequence' => 5, 'realm' => 0, 'component' => '.*', 'instance' => '.*', 'level' => 200, 'bond' => 0);
     // Insert default permissions or fail.
     if (!DBUtil::insertObjectArray($perms, 'group_perms', 'pid')) {
         $this->setError(__('Error inserting permission'));
         return false;
     }
     // Success.
     return true;
 }
Exemple #5
0
 /**
  * Create a new block.
  *
  * @param string $block ['title'] the title of the block.
  * @param string $block ['description'] the description of the block.
  * @param int $block ['mid'] the module ID of the block.
  * @param string $block ['language'] the language of the block.
  * @param int $block ['bkey'] the key of the block.
  *
  * @return mixed block Id on success, false on failure.
  */
 public function create($args)
 {
     // Argument check
     if (!isset($args['title']) || !isset($args['description']) || !isset($args['mid']) || !isset($args['language']) || !isset($args['collapsable']) || !isset($args['defaultstate']) || !isset($args['bkey'])) {
         return LogUtil::registerArgsError();
     }
     // Security check
     if (!System::isInstalling() && !SecurityUtil::checkPermission('Blocks::', "{$args['bkey']}:{$args['title']}:", ACCESS_ADD)) {
         return LogUtil::registerPermissionError();
     }
     // optional arguments
     if (!isset($args['content']) || !is_string($args['content'])) {
         $args['content'] = '';
     }
     $block = array('title' => $args['title'], 'description' => $args['description'], 'language' => $args['language'], 'collapsable' => $args['collapsable'], 'mid' => $args['mid'], 'defaultstate' => $args['defaultstate'], 'bkey' => $args['bkey'], 'content' => $args['content']);
     $block['url'] = '';
     $block['filter'] = '';
     $block['active'] = 1;
     $block['refresh'] = 3600;
     $block['last_update'] = DateUtil::getDatetime();
     $block['active'] = 1;
     $res = DBUtil::insertObject($block, 'blocks', 'bid');
     if (!$res) {
         return LogUtil::registerError($this->__('Error! Could not create the new item.'));
     }
     // empty block positions for this block
     if (isset($args['positions'])) {
         // add new block positions
         $blockplacments = array();
         foreach ($args['positions'] as $position) {
             $blockplacments[] = array('bid' => $block['bid'], 'pid' => $position);
         }
         $res = DBUtil::insertObjectArray($blockplacments, 'block_placements');
         if (!$res) {
             return LogUtil::registerError($this->__('Error! Could not create the new item.'));
         }
     }
     return $block['bid'];
 }
Exemple #6
0
 /**
  * create the default data for the modules module
  *
  * This function is only ever called once during the lifetime of a particular
  * module instance
  *
  * @return       bool       false
  */
 public function defaultdata()
 {
     $record = array(array('catname' => $this->__('System'), 'description' => $this->__('Core modules at the heart of operation of the site.')), array('catname' => $this->__('Layout'), 'description' => $this->__("Layout modules for controlling the site's look and feel.")), array('catname' => $this->__('Users'), 'description' => $this->__('Modules for controlling user membership, access rights and profiles.')), array('catname' => $this->__('Content'), 'description' => $this->__('Modules for providing content to your users.')), array('catname' => $this->__('Uncategorised'), 'description' => $this->__('Newly-installed or uncategorized modules.')), array('catname' => $this->__('Security'), 'description' => $this->__('Modules for managing the site\'s security.')));
     DBUtil::insertObjectArray($record, 'admin_category', 'cid');
 }
Exemple #7
0
 /**
  *  Crea les activitats seleccionades per a la importació
  * 
  * @param array $acts Array amb els paràmetres de la funció
  *
  * ### Paràmetres de l'array $acts:
  * integer **priId** Id de la prioritat
  * integer **sprId** Id de la subprioritat
  * integer **uniId** Id de la unitat
  * string **titol** Títol de l'activitat
  * string **tGTAF** Tipus GTAF de l'activitat
  * string **destinataris** Serialització de codis de destinataris segons la taula cataleg_auxiliar del tipus "dest"
  * string **observacions** Observacions relatives als destinataris de l'activitat
  * integer **curs** Codi coresponent a una tipologia de formació. Els diferents codis vàlids es troben a la taula cataleg_auxiliar amb tipus "curs"
  * integer **presencialitat** Codi coresponent a la presencialitat de l'activitat. Els diferents codis vàlids es troben a la taula cataleg_auxiliar amb tipus "pres"
  * integer **abast** Codi coresponent a l'abast de l'activitat (un o diversos centres). Els diferents codis vàlids es troben a la taula cataleg_auxiliar amb tipus "abast"
  * integer **hores** Durada en hores de l'activitat
  * string **objectius** Camp serialitzat amb els objectius de l'activitat
  * string **continguts** Camp serialitzat amb els continguts de l'activitat
  * string **gestio** Serialització codificada dels elements a gestionar (txt) de l'activitat i de l'entitat/servei que els gestiona (srv). Els primers es troben a la taula cataleg_gestioActivitatDefaults i els segons a cataleg_auxiliar amb el tipus "gest"
  * string **info** Informació general de l'activitat
  *                               
  * @return boolean true si la inserció ha tingut èxit, false en cas contrari
  */
 public function importActs(array $acts){
     return DBUtil::insertObjectArray($acts, 'cataleg_activitats');
 }
Exemple #8
0
 /**
  * Init the module
  * @return true if init successful, false otherwise
  */
 public function install()
 {
     // create labels table
     if (!DBUtil::createTable('addressbook_labels')) {
         return false;
     }
     // insert default values
     $objArray = array();
     $objArray[] = array('id' => 1, 'name' => DataUtil::formatForStore($this->__('Work')));
     $objArray[] = array('id' => 2, 'name' => DataUtil::formatForStore($this->__('Fax')));
     $objArray[] = array('id' => 3, 'name' => DataUtil::formatForStore($this->__('Mobile')));
     $objArray[] = array('id' => 4, 'name' => DataUtil::formatForStore($this->__('Home')));
     $objArray[] = array('id' => 5, 'name' => DataUtil::formatForStore($this->__('Email')));
     $objArray[] = array('id' => 6, 'name' => DataUtil::formatForStore($this->__('URL')));
     $objArray[] = array('id' => 7, 'name' => DataUtil::formatForStore($this->__('Other')));
     DBUtil::insertObjectArray($objArray, 'addressbook_labels', 'id', true);
     // create custom field table
     if (!DBUtil::createTable('addressbook_customfields')) {
         return false;
     }
     // insert default values
     $objArray = array();
     $objArray[] = array('id' => 1, 'name' => DataUtil::formatForStore($this->__('Custom Label 1')), 'type' => 'varchar(60) default NULL', 'position' => 1);
     $objArray[] = array('id' => 2, 'name' => DataUtil::formatForStore($this->__('Custom Label 2')), 'type' => 'varchar(60) default NULL', 'position' => 2);
     $objArray[] = array('id' => 3, 'name' => DataUtil::formatForStore($this->__('Custom Label 3')), 'type' => 'varchar(60) default NULL', 'position' => 3);
     $objArray[] = array('id' => 4, 'name' => DataUtil::formatForStore($this->__('Custom Label 4')), 'type' => 'varchar(60) default NULL', 'position' => 4);
     DBUtil::insertObjectArray($objArray, 'addressbook_customfields', 'id', true);
     // create favourites table
     if (!DBUtil::createTable('addressbook_favourites')) {
         return false;
     }
     // finally create the address table
     if (!DBUtil::createTable('addressbook_address')) {
         return false;
     }
     // create our default categories
     if (!$this->_addressbook_createdefaultcategory()) {
         return LogUtil::registerError($this->__('Error! Creation attempt failed.'));
     }
     // Set up an initial value for a module variable.
     $this->setVar('abtitle', 'Address Book');
     $this->setVar('abmetatitle', 'Address Book');
     $this->setVar('abmetadescription', 'Address book');
     $this->setVar('abmetakeyword', 'catalog, addressbook');
     $this->setVar('itemsperpage', 30);
     $this->setVar('globalprotect', 0);
     $this->setVar('allowprivate', 0);
     $this->setVar('custom_tab', '');
     $this->setVar('use_prefix', 0);
     $this->setVar('use_img', 0);
     $this->setVar('images_dir', 'userdata/Addressbook');
     $this->setVar('images_manager', 'kcfinder');
     $this->setVar('google_api_key', '');
     $this->setVar('google_zoom', 15);
     $this->setVar('enablecategorization', true);
     $this->setVar('addressbooktype', 1);
     // 1-people, 2-companies
     $this->setVar('showabcfilter', 1);
     // Register hooks
     HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
     // Register event handlers
     EventUtil::registerPersistentModuleHandler('AddressBook', 'module.content.gettypes', array('AddressBook_EventHandler_Listeners', 'getContentTypes'));
     // Initialisation successful
     return true;
 }
Exemple #9
0
 protected function defaultdata()
 {
     // Set editor defaults
     $this->setVar('editors_path', 'modules/Scribite/includes');
     // xinha
     $this->setVar('xinha_language', 'en');
     $this->setVar('xinha_skin', 'blue-look');
     $this->setVar('xinha_barmode', 'reduced');
     $this->setVar('xinha_width', 'auto');
     $this->setVar('xinha_height', 'auto');
     $this->setVar('xinha_style', 'modules/Scribite/style/xinha/editor.css');
     $this->setVar('xinha_statusbar', 1);
     $this->setVar('xinha_converturls', 1);
     $this->setVar('xinha_showloading', 1);
     $this->setVar('xinha_activeplugins', 'a:2:{i:0;s:7:"GetHtml";i:1;s:12:"SmartReplace";}');
     // openwysiwyg
     // openwysiwyg deprecated @4.3.0
     //        $this->setVar('openwysiwyg_barmode', 'full');
     //        $this->setVar('openwysiwyg_width', '400');
     //        $this->setVar('openwysiwyg_height', '300');
     //        $this->setVar('nicedit_fullpanel', 0);
     // nicedit
     $this->setVar('nicedit_xhtml', 0);
     // yui
     $this->setVar('yui_type', 'Simple');
     $this->setVar('yui_width', 'auto');
     $this->setVar('yui_height', '300');
     $this->setVar('yui_dombar', true);
     $this->setVar('yui_animate', true);
     $this->setVar('yui_collapse', true);
     // markitup
     $this->setVar('markitup_width', '650px');
     $this->setVar('markitup_height', '400px');
     // TinyMCE
     $this->setVar('tinymce_language', 'en');
     $this->setVar('tinymce_style', 'modules/Scribite/style/tinymce/style.css');
     $this->setVar('tinymce_theme', 'advanced');
     $this->setVar('tinymce_width', '75%');
     $this->setVar('tinymce_height', '400');
     $this->setVar('tinymce_dateformat', '%Y-%m-%d');
     $this->setVar('tinymce_timeformat', '%H:%M:%S');
     $this->setVar('tinymce_activeplugins', '');
     // ckeditor
     $this->setVar('ckeditor_language', 'en');
     $this->setVar('ckeditor_barmode', 'Full');
     $this->setVar('ckeditor_width', '"70%"');
     $this->setVar('ckeditor_height', '300');
     // set database module defaults
     $record = $this->getDefaultModuleConfig();
     DBUtil::insertObjectArray($record, 'scribite', 'mid');
 }
Exemple #10
0
    /**
     * Migrate from version 1.13 to 2.2.0
     *
     * @param string $oldversion The old version from which this upgrade is being processed.
     *
     * @return bool True on success; otherwise false.
     */
    public function upgrade113XTablesTo220Tables($oldversion)
    {
        if (!DBUtil::changeTable('users_temp')) {
            return false;
        }

        // Get the dbinfo for the new version
        ModUtil::dbInfoLoad('Users', 'Users');

        $nowUTC = new DateTime(null, new DateTimeZone('UTC'));
        $nowUTCStr = $nowUTC->format(Users_Constant::DATETIME_FORMAT);

        $serviceManager = ServiceUtil::getManager();
        $dbinfoSystem = $serviceManager['dbtables'];
        $dbinfo113X = Users_tables('1.13');
        $dbinfo220 = Users_tables('2.2.0');
        $usersOldFields = array(
            'user_theme',
            'user_viewemail',
            'storynum',
            'counter',
            'hash_method',
            'validfrom',
            'validuntil',
        );
        $usersOldFieldsDB = array(
            $dbinfo113X['users_column']['user_theme'],
            $dbinfo113X['users_column']['user_viewemail'],
            $dbinfo113X['users_column']['storynum'],
            $dbinfo113X['users_column']['counter'],
            $dbinfo113X['users_column']['hash_method'],
            $dbinfo113X['users_column']['validfrom'],
            $dbinfo113X['users_column']['validuntil']
        );

        // Upgrade the tables

        // Update the users table with new and altered fields. No fields are removed at this point, and no fields
        // are getting a new data type that is incompatible, so no need to save anything off first.
        // Also, create the users_verifychg tables at this point.
        // Merge the global dbtables with the new field information.
        $tables['users_column'] = $dbinfo220['users_column'];
        $tables['users_column_def'] = $dbinfo220['users_column_def'];
        $tables['users_verifychg'] = $dbinfo220['users_verifychg'];
        $tables['users_verifychg_column'] = $dbinfo220['users_verifychg_column'];
        $tables['users_verifychg_column_def'] = $dbinfo220['users_verifychg_column_def'];
        $serviceManager['dbtables'] = array_merge($dbinfoSystem, $tables);

        // Now change the tables
        if (!DBUtil::changeTable('users')) {
            return false;
        }
        if (!DBUtil::createTable('users_verifychg')) {
            return false;
        }

        // First users_temp pending email verification records to users_verifychg.
        $tempColumn = $dbinfo113X['users_temp_column'];
        $verifyColumn = $dbinfo220['users_verifychg_column'];
        $usersColumn = $dbinfo220['users_column'];

        $legalModInfo = ModUtil::getInfoFromName('Legal');
        if (($legalModInfo['state'] == ModUtil::STATE_ACTIVE) || ($legalModInfo['state'] == ModUtil::STATE_UPGRADED)) {
            $legalModuleActive = true;
            $termsOfUseActive = ModUtil::getVar('Legal', 'termsofuse', false);
            $privacyPolicyActive = ModUtil::getVar('Legal', 'privacypolicy', false);
            $agePolicyActive = ($this->getVar('minage', 0) > 0);
        } else {
            $legalModuleActive = false;
        }

        // Next, users table conversion
        // We need to convert some information over from the old users table fields, so merge the old field list into
        // the new one. The order of array_merge parameters is important here!
        $tables = array('users_column' => array_merge($dbinfo113X['users_column'], $dbinfo220['users_column']));
        $serviceManager['dbtables'] = array_merge($dbinfoSystem, $tables);
        // Do the conversion in PHP we use mb_strtolower, and even if MySQL had an equivalent, there is
        // no guarantee that another supported DB platform would.
        $limitNumRows = 100;
        $limitOffset = 0;
        $updated = true;
        $userCount = DBUtil::selectObjectCount('users');
        while ($limitOffset < $userCount) {
            $userArray = DBUtil::selectObjectArray('users', "{$usersColumn['uid']} != 1", '', $limitOffset, $limitNumRows,
                '', null, null, array('uid', 'uname', 'email', 'pass', 'hash_method', 'user_regdate', 'lastlogin', 'approved_by', 'approved_date'));
            if (!empty($userArray) && is_array($userArray)) {
                foreach ($userArray as $key => $userObj) {
                    // force user names and emails to lower case
                    $userArray[$key]['uname'] = mb_strtolower($userArray[$key]['uname']);
                    $userArray[$key]['email'] = mb_strtolower($userArray[$key]['email']);

                    if ($userArray[$key]['user_regdate'] == '1970-01-01 00:00:00') {
                        $userArray[$key]['user_regdate'] = $nowUTCStr;
                        $userArray[$key]['approved_date'] = $nowUTCStr;
                    } else {
                        $userArray[$key]['approved_date'] = $userArray[$key]['user_regdate'];
                    }
                    $userArray[$key]['approved_by'] = 2;

                    // merge hash method for salted passwords, leave salt blank
                    if (!empty($userArray[$key]['pass']) && (strpos($userArray[$key]['pass'], '$$') === false)) {
                        $userArray[$key]['pass'] =
                            (isset($userArray[$key]['hash_method'])
                                ? $userArray[$key]['hash_method']
                                : '1')
                            . '$$' . $userArray[$key]['pass'];
                    }

                    // Save some disappearing fields as attributes, just in case someone actually used them for
                    // something. But don't overwrite if there already
                    if (!isset($userArray[$key]['__ATTRIBUTES__']) || !is_array($userArray[$key]['__ATTRIBUTES__'])) {
                        $userArray[$key]['__ATTRIBUTES__'] = array();
                    }
                    foreach ($usersOldFields as $fieldName) {
                        if (($fieldName != 'hash_method') && isset($userArray[$key][$fieldName])
                                && !empty($userArray[$key][$fieldName]) && !isset($userArray[$key]['__ATTRIBUTES__'][$fieldName])) {
                            $userArray[$key]['__ATTRIBUTES__'][$fieldName] = $userArray[$key][$fieldName];
                        }
                    }

                    if ($legalModuleActive && ($userArray[$key]['uid'] > 2)) {
                        $userRegDateTime = new DateTime($userArray[$key]['user_regdate'], new DateTimeZone('UTC'));
                        $policyDateTimeStr = $userRegDateTime->format(DATE_ISO8601);

                        if ($termsOfUseActive) {
                            $userArray[$key]['__ATTRIBUTES__']['_Legal_termsOfUseAccepted'] = $policyDateTimeStr;
                        }
                        if ($privacyPolicyActive) {
                            $userArray[$key]['__ATTRIBUTES__']['_Legal_privacyPolicyAccepted'] = $policyDateTimeStr;
                        }
                        if ($agePolicyActive) {
                            $userArray[$key]['__ATTRIBUTES__']['_Legal_agePolicyConfirmed'] = $policyDateTimeStr;
                        }
                    }
                }
            }
            if (!DBUtil::updateObjectArray($userArray, 'users', 'uid', false)) {
                $updated = false;
                break;
            }
            $limitOffset += $limitNumRows;
        }
        if (!$updated) {
            return false;
        }

        $obaColumn = $dbinfoSystem['objectdata_attributes_column'];

        $limitNumRows = 100;
        $limitOffset = 0;
        $updated = true;
        $userCount = DBUtil::selectObjectCount('users_temp');
        // Pass through the users_temp table in chunks of 100
        //  * ensure unames and email addresses are lower case,
        while ($limitOffset < $userCount) {
            $userTempArray = DBUtil::selectObjectArray('users_temp', '', '', $limitOffset, $limitNumRows, '', null, null,
                array('tid', 'type', 'uname', 'email', 'pass', 'hash_method', 'dynamics', 'comment'));
            $userArray = array();
            if (!empty($userTempArray) && is_array($userTempArray)) {
                foreach ($userTempArray as $key => $userTempOpj) {
                    // type == 1: User registration pending approval (moderation)
                    if ($userTempArray[$key]['type'] == 1) {
                        $userObj = array();

                        // Ensure uname and email are lower case
                        $userObj['uname'] = mb_strtolower($userTempArray[$key]['uname']);
                        $userObj['email'] = mb_strtolower($userTempArray[$key]['email']);

                        // Convert pass to salted pass with embedded hash method, leave salt blank
                        $userObj['pass'] = $userTempArray[$key]['hash_method'] . '$$' . $userTempArray[$key]['pass'];

                        $userObj['approved_by'] = 0;
                        $userObj['activated'] = Users_Constant::ACTIVATED_PENDING_REG;

                        if (!empty($userTempArray[$key]['dynamics'])) {
                            $userObj['__ATTRIBUTES__'] = unserialize($userTempArray[$key]['dynamics']);
                        } else {
                            $userObj['__ATTRIBUTES__'] = array();
                        }

                        if (isset($userObj['dynamics']) && !empty($userObj['dynamics'])) {
                            if (DataUtil::is_serialized($userObj['dynamics'])) {
                                $dynamics = @unserialize($userObj['dynamics']);
                                if (!empty($dynamics) && is_array($dynamics)) {
                                    foreach ($dynamics as $key => $value) {
                                        $userObj['__ATTRIBUTES__'][$key] = $value;
                                    }
                                }
                            }
                        }

                        $userObj['__ATTRIBUTES__']['_Users_isVerified'] = 0;

                        if ($legalModuleActive) {
                            $userRegDateTime = new DateTime($userArray[$key]['user_regdate'], new DateTimeZone('UTC'));
                            $policyDateTimeStr = $userRegDateTime->format(DATE_ISO8601);

                            if ($termsOfUseActive) {
                                $userObj['__ATTRIBUTES__']['_Legal_termsOfUseAccepted'] = $policyDateTimeStr;
                            }
                            if ($privacyPolicyActive) {
                                $userObj['__ATTRIBUTES__']['_Legal_privacyPolicyAccepted'] = $policyDateTimeStr;
                            }
                            if ($agePolicyActive) {
                                $userObj['__ATTRIBUTES__']['_Legal_agePolicyConfirmed'] = $policyDateTimeStr;
                            }
                        }

                        $userArray[] = $userObj;
                    } else {
                        throw new Zikula_Exception_Fatal($this->__f('Unknown users_temp record type: %1$s', array($userTempArray[$key]['type'])));
                    }
                }
            }
            if (!DBUtil::insertObjectArray($userArray, 'users', 'uid', false)) {
                $updated = false;
                break;
            }
            $limitOffset += $limitNumRows;
        }
        if (!$updated) {
            return false;
        }

        // Done upgrading. Let's lose some old fields and tables we no longer need.
        DBUtil::dropColumn('users', $usersOldFieldsDB);
        DBUtil::dropTable('users_temp');

        // Reset the system tables to the new table definitons, so the rest of the
        // system upgrade goes smoothly.
        $dbinfoSystem = $serviceManager['dbtables'];
        foreach ($dbinfo113X as $key => $value) {
            unset($dbinfoSystem[$key]);
        }
        foreach ($dbinfo220 as $key => $value) {
            $dbinfoSystem[$key] = $value;
        }
        $serviceManager['dbtables'] = $dbinfoSystem;

        // Update users table for data type change of activated field.
        if (!DBUtil::changeTable('users')) {
            return false;
        }

        return true;
    }
Exemple #11
0
 /**
  * Enable hooks between a caller module and a hook module.
  *
  * @copyright (C) 2003 by the Xaraya Development Team.
  * @license GPL {@link http://www.gnu.org/licenses/gpl.html}
  *
  * @param array $args All parameters passed to this function.
  *                      string $args['callermodname'] The name of the caller module.
  *                      string $args['hookmodname']   The name of the hook module.
  *
  * @deprecated since 1.3.0
  *
  * @return bool True if successful; otherwise false.
  */
 public function enablehooks($args)
 {
     // Argument check
     if (empty($args['callermodname']) || empty($args['hookmodname'])) {
         return LogUtil::registerArgsError();
     }
     $dbtable = DBUtil::getTables();
     $hookscolumn = $dbtable['hooks_column'];
     // Rename operation
     // Delete hooks regardless
     $where = "WHERE {$hookscolumn['smodule']} = '" . DataUtil::formatForStore($args['callermodname']) . "'\n                    AND {$hookscolumn['tmodule']} = '" . DataUtil::formatForStore($args['hookmodname']) . "'";
     if (!DBUtil::deleteWhere('hooks', $where)) {
         return false;
     }
     $where = "WHERE {$hookscolumn['smodule']} = ''\n                    AND {$hookscolumn['tmodule']} = '" . DataUtil::formatForStore($args['hookmodname']) . "'";
     $objArray = DBUtil::selectObjectArray('hooks', $where, '', -1, -1, 'id');
     if (!$objArray) {
         return false;
     }
     $newHooks = array();
     foreach ($objArray as $hook) {
         unset($hook['id']);
         $hook['smodule'] = $args['callermodname'];
         $newHooks[] = $hook;
     }
     $result = DBUtil::insertObjectArray($newHooks, 'hooks');
     if (!$result) {
         return false;
     }
     return true;
 }
Exemple #12
0
        /**
     * Importa les taules de entitats-gtaf i grups d'entitats a partir d'un csv a la base de dades de Sirius
     * 
     * Esborra el contingut previ de les taules i importa el contingut del fitxer
     * 
     * @return void Retorna a la funció *gtafEntitiesGest* amb els missatges d'execució
     */
    public function importGtafEntities() {
        if (!SecurityUtil::checkPermission('Cataleg::', '::', ACCESS_ADMIN)) {
            return LogUtil::registerPermissionError();
        }
        // get input values. Check for direct function call first because calling function might be either get or post
        if (isset($args) && is_array($args) && !empty($args)) {
            $confirmed = isset($args['confirmed']) ? $args['confirmed'] : false;
            $case = isset($args['case']) ? $args['case'] : false;
        } elseif (isset($args) && !is_array($args)) {
            throw new Zikula_Exception_Fatal(LogUtil::getErrorMsgArgs());
        } elseif ($this->request->isGet()) {
            $confirmed = 1;
        } elseif ($this->request->isPost()) {
            $this->checkCsrfToken();
            $confirmed = $this->request->request->get('confirmed', false);
            $case = $this->request->request->get('case',false);
        }
        if ($confirmed == 2) {
            if ($case == 'entities') {
                $caps = array(
                    'gtafEntityId'   => 'gtafEntityId',
                    'nom'            => 'nom',
                    'tipus'          => 'tipus',
                    'gtafGroupId'    => 'gtafGroupId'
                );
                $caps_man = $caps;
                $taula = 'cataleg_gtafEntities';
                $mes = "Importació d'entitats-gtaf";
                $field_id = 'gtafEntityId';
            } else {
                $caps = array(
                    'gtafGroupId'   => 'gtafGroupId',
                    'nom'           => 'nom',
                    'resp_uid'      => 'resp_uid'
                );
                $caps_man = array(
                    'gtafGroupId'   => 'gtafGroupId',
                    'nom'           => 'nom'
                );
                $taula = 'cataleg_gtafGroups';
                $mes = "Importació de grups d'entitats-gtaf";
                $field_id = 'gtafGroupId';
            }
            // get other import values
            $importFile = $this->request->files->get('importFile', isset($args['importFile']) ? $args['importFile'] : null);

            $fileName = $importFile['name'];
            $importResults = '';
            if ($fileName == '') {
                $importResults = $this->__("No heu triat cap fitxer.");
            } elseif (FileUtil::getExtension($fileName) != 'csv') {
                $importResults = $this->__("L'extensió del fitxer ha de ser csv.");
            } elseif (!$file_handle = fopen($importFile['tmp_name'], 'r')) {
                $importResults = $this->__("No s'ha pogut llegir el fitxer csv.");
            } else {
                while (!feof($file_handle)) {
                    $line = fgetcsv($file_handle, 1024, ';', '"');
                    if ($line != '') {
                        $lines[] = $line;
                    }
                }
                fclose($file_handle);
                //
                foreach ($lines as $line_num => $line) {
                    if ($line_num != 0) {
                        if (count($lines[0]) != count($line)) {
                            $importResults .= $this->__("<div>Hi ha registres amb un número de camps incorrecte.</div>");
                        } else {
                                $import[] = array_combine($lines[0], $line);
                                $import_id[] = $line[0];
                        }
                    } else {
                        $difs = array_diff($line, $caps);
                        $difs2 = array_diff($caps_man,$line);
                        if (count($line) != count(array_unique($line))) {
                            $importResults .= $this->__("<div>La capçalera del csv té columnes repetides.</div>");
                        } elseif (!in_array($field_id, $line)) {
                            $importResults .= $this->__("<div>Falta el camp obligatori de la clau primària (id).</div>");
                        } elseif ($line[0] != $field_id) {
                            $importResults .= $this->__("<div>El camp obligatori de la clau primària (id) ha d'ocupar el primer lloc.</div>");
                        } elseif (!empty($difs2)) {
                            $importResults .= $this->__("<div>Falten camps obligatoris.</div>");
                        } elseif (!empty($difs)) {
                            $importResults .= $this->__("div>El csv té camps incorrectes.</div>");
                        }
                    }
                }
                if (count($import_id) != count(array_unique($import_id))) $importResults .= $this->__("<div>El fitxer té alguna id repetida.</div>"); 
            }
            
            if ($importResults == '') {
                $old_reg = DBUtil::selectObjectCount($taula);
                DBUtil::deleteWhere($taula);
                $inserts = count($import);
                DBUtil::insertObjectArray($import, $taula);
                $this->registerStatus($mes);
                $this->registerStatus($this->__('La importació s\'ha realitzat correctament'));
                $this->registerStatus($this->__('Registres antics: ' . $old_reg . ' - Registres actuals: ' . $inserts));
                return system::redirect(ModUtil::url('Cataleg', 'admin', 'gtafEntitiesGest'));
            } else {
                $this->view->assign('case',$case);
                $post_max_size = ini_get('post_max_size');
                return $this->view->assign('importResults', isset($importResults) ? $importResults : '')
                            ->assign('post_max_size', $post_max_size)
                            ->fetch('admin/Cataleg_admin_importGtafEntities.tpl');
            }
        } elseif ($confirmed == 1){
            // shows the form
            $case = $this->request->query->get('case',false);
            $this->view->assign('case',$case);
            $post_max_size = ini_get('post_max_size');
            return $this->view->assign('importResults', isset($importResults) ? $importResults : '')
                        ->assign('post_max_size', $post_max_size)
                        ->fetch('admin/Cataleg_admin_importGtafEntities.tpl');
        } else {
            LogUtil::registerError($this->__('La petició no és vàlida'));
            return system::redirect(ModUtil::url('Cataleg', 'admin', 'gtafEntitiesGest'));
        }
    }
Exemple #13
0
    public function copyContentOfPageToPage($args)
    {
        $fromPage = (int) $args['fromPageId'];
        $toPage = (int) $args['toPageId'];
        if ($fromPage <= 0 || $toPage <= 0) {
            return false;
        }
        $cloneTranslation = isset($args['cloneTranslation']) ? $args['cloneTranslation'] : true;

        $tables = DBUtil::getTables();
        $translatedColumn = $tables['content_translatedcontent_column'];

        $content = $this->GetSimplePageContent(array('pageId' => $fromPage));
        for ($i = 0; $i < count($content); $i++) {
            $contentData = $content[$i];
            $contentData['id'] = null;
            $contentData['pageId'] = $toPage;
            DBUtil::insertObject($contentData, 'content_content', 'id');
            $id = $contentData['id']; // ID of object we just inserted

            if ($cloneTranslation) {
                $translations = DBUtil::selectObjectArray('content_translatedcontent', "$translatedColumn[contentId] = $id");
                if (!($translations === false) && count($translations) > 0) {
                    foreach ($translations as &$t) {
                        $t['contentId'] = $id;
                    }
                    DBUtil::insertObjectArray($translations, 'content_translatedcontent', 'contentId', true);
                }
            }
            $searchData = DBUtil::selectObjectByID('content_searchable', $id, 'contentId');
            if ($searchData) {
                $searchData['contentId'] = $id;
                DBUtil::insertObject($searchData, 'content_searchable');
            }
        }
        Content_Util::clearCache();
        return true;
    }
Exemple #14
0
    /**
     * Add new user accounts from the import process.
     *
     * Parameters passed in the $args array:
     * -------------------------------------
     * array $args['importvalues'] An array of information used to create new user records. Each element of the
     *                                  array should represent the minimum information to create a user record, including
     *                                  'uname', 'email', 'pass', etc.
     *
     * @param array $args All parameters passed to this function.
     *
     * @return bool True on success; false otherwise.
     */
    public function createImport($args)
    {
        // Need add access to call this function
        if (!SecurityUtil::checkPermission("{$this->name}::", '::', ACCESS_ADD)) {
            return false;
        }

        $importValues = $args['importvalues'];

        if (empty($importValues)) {
            return false;
        }

        // Prepare arrays.
        $usersArray = array();
        foreach ($importValues as $key => $value) {
            $usersArray[] = $value['uname'];
            if (!$value['activated']) {
                $importValues[$key]['activated'] = Users_Constant::ACTIVATED_PENDING_REG;
            }
        }

        $importValuesDB = $importValues;
        foreach ($importValuesDB as $key => $value) {
            $importValuesDB[$key]['pass'] = UserUtil::getHashedPassword($importValuesDB[$key]['pass']);
        }

        // execute sql to create users
        $result = DBUtil::insertObjectArray($importValuesDB, 'users', 'uid');
        if (!$result) {
            return false;
        }

        // get users. We need the users identities set them into their groups
        $usersInDB = ModUtil::apiFunc($this->name, 'admin', 'checkMultipleExistence',
                                      array('valuesarray' => $usersArray,
                                            'key' => 'uname'));
        if (!$usersInDB) {
            $this->registerError($this->__(
                'Error! The users have been created but something has failed trying to get them from the database. '
                . 'Now all these users do not have group.'));

            return false;
        }

        // get available groups
        $allGroups = ModUtil::apiFunc('Groups', 'user', 'getAll');

        // create an array with the groups identities where the user can add other users
        $allGroupsArray = array();
        foreach ($allGroups as $group) {
            if (SecurityUtil::checkPermission('Groups::', $group['name'] . '::' . $group['gid'], ACCESS_EDIT)) {
                $allGroupsArray[] = $group['gid'];
            }
        }

        $groups = array();
        // construct a sql statement with all the inserts to reduce SQL queries
        foreach ($importValues as $value) {
            $groupsArray = explode('|', $value['groups']);
            foreach ($groupsArray as $group) {
                $groups[] = array('uid' => $usersInDB[$value['uname']]['uid'], 'gid' => $group);
            }
        }

        // execute sql to create users
        $result = DBUtil::insertObjectArray($groups, 'group_membership', 'gid', true);
        if (!$result) {
            $this->registerError($this->__('Error! The users have been created but something has failed while trying to add the users to their groups. These users are not assigned to a group.'));

            return false;
        }

        // check if module Mailer is active
        $modinfo = ModUtil::getInfoFromName('Mailer');
        if ($modinfo['state'] == ModUtil::TYPE_SYSTEM) {
            $sitename  = System::getVar('sitename');
            $siteurl   = System::getBaseUrl();

            $view = Zikula_View::getInstance($this->name, false);
            $view->assign('sitename', $sitename);
            $view->assign('siteurl', $siteurl);

            foreach ($importValues as $value) {
                if ($value['activated'] != Users_Constant::ACTIVATED_PENDING_REG) {
                    $createEvent = new Zikula_Event('user.account.create', $value);
                    $this->eventManager->notify($createEvent);
                } else {
                    $createEvent = new Zikula_Event('user.registration.create', $value);
                    $this->eventManager->notify($createEvent);
                }
                if ($value['activated'] && $value['sendmail']) {
                    $view->assign('email', $value['email']);
                    $view->assign('uname', $value['uname']);
                    $view->assign('pass', $value['pass']);
                    $message = $view->fetch('users_email_importnotify_html.tpl');
                    $subject = $this->__f('Password for %1$s from %2$s', array($value['uname'], $sitename));
                    $sendMessageArgs = array(
                        'toaddress' => $value['email'],
                        'subject'   => $subject,
                        'body'      => $message,
                        'html'      => true,
                    );
                    if (!ModUtil::apiFunc('Mailer', 'user', 'sendMessage', $sendMessageArgs)) {
                        $this->registerError($this->__f('Error! A problem has occurred while sending e-mail messages. The error happened trying to send a message to the user %s. After this error, no more messages were sent.', $value['uname']));
                        break;
                    }
                }
            }
        }

        return true;
    }
Exemple #15
0
    /**
     * Importa, a la taula seleccionada, les dades d'un csv
     * 
     * Els registres existents s'actualitzen i els nous s'inserten
     * 
     * @return void (carrega la plantilla per importar/exportar taules)
     */
    public function importaTaula() {

        // Security check 
        $this->checkCsrfToken();
        $this->throwForbiddenUnless(SecurityUtil::checkPermission('Llicencies::', '::', ACCESS_ADMIN));
        if ($this->request->isPost()) {
            $taula = $this->request->request->get('taula_imp', false);
            $importFile = $this->request->files->get('importFile', null);
        }

        if (is_null($importFile)) {
            LogUtil::registerError(__('No s\'ha pogut processar l\'arxiu. Probablement supera la mida màxima.'));
        } else {
            $import = new CsvImporter($importFile['tmp_name'], true, null,';');

            $header = $import->getHeader();

            $check = ModUtil::apiFunc($this->name, 'admin', 'checkCSV', array('dbTable' => $taula, 'csvHeader' => $header));

            // Comprovar capçaleres del csv
            if (!$check['correcte']) {
                // Errades a l'arxiu CSV
                LogUtil::registerError($check['msg']);
            } else {
                // Obtenció del contingut del fitxer csv
                $data = $import->get();
                // Obtenció de les dades de la taula
                $tContent = DBUtil::selectFieldArray($taula, $check['clau']);
                // echo '<pre> tContent: ';print_r($tContent); echo '</pre>';

                LogUtil::registerStatus($check['msg']);
                //LogUtil::registerStatus(print_r($data,true));
                $update = array();
                $insert = array();
                foreach ($data as $row => $record) {
                    if (in_array($record[$check['clau']], $tContent)) {
                        $update[] = $record;
                    } else {
                        $insert[] = $record;
                    }
                }

                $inserts = count($insert);
                $updates = count($update);
                $ins = true;
                $upd = true;
                if ($inserts) {
                    $ins = (DBUtil::insertObjectArray($insert, $taula) && ($inserts));
                    $mi = __('S\'han afegit ' . $inserts . ' registres.');
                }
                if ($updates) {
                    $upd = (DBUtil::updateObjectArray($update, $taula, $check['clau'])) && ($updates);
                    $mu = __('S\'han actualitzat ' . $updates . ' registres.');
                }
                if (($ins) && ($upd))
                    LogUtil::registerStatus(__('La importació de dades cap a la taula:' . $taula . ' s\'ha realitzat correctament.') . " " . $mi . " " . $mu);
                else
                    LogUtil::registerError(__('No s\'han pogut modificar totes les dades de la taula: ' . $taula));
            }
        }
        $this->redirect(ModUtil::url('llicencies', 'admin', 'ieTables'));
    }
Exemple #16
0
 private function cloneContentAdditions($oldContentId, $newContentId, $cloneTranslation)
 {
     $currentLanguage = ZLanguage::getLanguageCode();
     $dbtables = DBUtil::getTables();
     $contentSearchColumn = $dbtables['content_searchable_column'];
     $where = $contentSearchColumn['contentId'] . ' = ' . $oldContentId . ' AND ' . $contentSearchColumn['language'] . ' IN (\'' . DataUtil::formatForStore($currentLanguage) . '\', \'\')';
     $searchableData = DBUtil::selectObjectArray('content_searchable', $where);
     if (count($searchableData) > 0) {
         foreach ($searchableData as &$s) {
             $s['contentId'] = $newContentId;
         }
         DBUtil::insertObjectArray($searchableData, 'content_searchable', 'searchableId');
     }
     if (!$cloneTranslation) {
         return;
     }
     $translatedColumn = $dbtables['content_translatedcontent_column'];
     $translations = DBUtil::selectObjectArray('content_translatedcontent', "{$translatedColumn['contentId']} = {$oldContentId}");
     if (count($translations) < 1) {
         return;
     }
     foreach ($translations as &$t) {
         $t['contentId'] = $newContentId;
     }
     DBUtil::insertObjectArray($translations, 'content_translatedcontent', 'contentId', true);
     $where = $contentSearchColumn['contentId'] . ' = ' . $oldContentId . ' AND ' . $contentSearchColumn['language'] . ' NOT IN (\'' . DataUtil::formatForStore($currentLanguage) . '\', \'\')';
     $searchableData = DBUtil::selectObjectArray('content_searchable', $where);
     if (count($searchableData) > 0) {
         foreach ($searchableData as &$s) {
             $s['contentId'] = $newContentId;
         }
         DBUtil::insertObjectArray($searchableData, 'content_searchable', 'searchableId', true);
     }
 }
Exemple #17
0
 /**
  * insert data
  */
 public function insertData_10()
 {
     $objArray = array();
     $objArray[] = array('id' => 1, 'parent_id' => 0, 'is_locked' => 1, 'is_leaf' => 0, 'value' => '', 'sort_value' => 1, 'name' => '__SYSTEM__', 'display_name' => 'b:0;', 'display_desc' => 'b:0;', 'path' => '/__SYSTEM__', 'ipath' => '/1', 'status' => 'A');
     $objArray[] = array('id' => 2, 'parent_id' => 1, 'is_locked' => 0, 'is_leaf' => 0, 'value' => '', 'sort_value' => 2, 'name' => 'Modules', 'display_name' => $this->makeDisplayName($this->__('Modules')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/Modules', 'ipath' => '/1/2', 'status' => 'A');
     $objArray[] = array('id' => 3, 'parent_id' => 1, 'is_locked' => 0, 'is_leaf' => 0, 'value' => '', 'sort_value' => 3, 'name' => 'General', 'display_name' => $this->makeDisplayName($this->__('General')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General', 'ipath' => '/1/3', 'status' => 'A');
     $objArray[] = array('id' => 4, 'parent_id' => 3, 'is_locked' => 0, 'is_leaf' => 0, 'value' => '', 'sort_value' => 4, 'name' => 'YesNo', 'display_name' => $this->makeDisplayName($this->__('Yes/No')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/YesNo', 'ipath' => '/1/3/4', 'status' => 'A');
     $objArray[] = array('id' => 5, 'parent_id' => 4, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'Y', 'sort_value' => 5, 'name' => '1 - Yes', 'display_name' => 'b:0;', 'display_desc' => 'b:0;', 'path' => '/__SYSTEM__/General/YesNo/1 - Yes', 'ipath' => '/1/3/4/5', 'status' => 'A', '__ATTRIBUTES__' => array('code' => 'Y'));
     $objArray[] = array('id' => 6, 'parent_id' => 4, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'N', 'sort_value' => 6, 'name' => '2 - No', 'display_name' => 'b:0;', 'display_desc' => 'b:0;', 'path' => '/__SYSTEM__/General/YesNo/2 - No', 'ipath' => '/1/3/4/6', 'status' => 'A', '__ATTRIBUTES__' => array('code' => 'N'));
     $objArray[] = array('id' => 10, 'parent_id' => 3, 'is_locked' => 0, 'is_leaf' => 0, 'value' => '', 'sort_value' => 10, 'name' => 'Publication Status (extended)', 'display_name' => $this->makeDisplayName($this->__('Publication status (extended)')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Publication Status Extended', 'ipath' => '/1/3/10', 'status' => 'A');
     $objArray[] = array('id' => 11, 'parent_id' => 10, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'P', 'sort_value' => 11, 'name' => 'Pending', 'display_name' => $this->makeDisplayName($this->__('Pending')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Publication Status Extended/Pending', 'ipath' => '/1/3/10/11', 'status' => 'A', '__ATTRIBUTES__' => array('code' => 'P'));
     $objArray[] = array('id' => 12, 'parent_id' => 10, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'C', 'sort_value' => 12, 'name' => 'Checked', 'display_name' => $this->makeDisplayName($this->__('Checked')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Publication Status Extended/Checked', 'ipath' => '/1/3/10/12', 'status' => 'A', '__ATTRIBUTES__' => array('code' => 'C'));
     $objArray[] = array('id' => 13, 'parent_id' => 10, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'A', 'sort_value' => 13, 'name' => 'Approved', 'display_name' => $this->makeDisplayName($this->__('Approved')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Publication Status Extended/Approved', 'ipath' => '/1/3/10/13', 'status' => 'A', '__ATTRIBUTES__' => array('code' => 'A'));
     $objArray[] = array('id' => 14, 'parent_id' => 10, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'O', 'sort_value' => 14, 'name' => 'On-line', 'display_name' => $this->makeDisplayName($this->__('On-line')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Publication Status Extended/Online', 'ipath' => '/1/3/10/14', 'status' => 'A', '__ATTRIBUTES__' => array('code' => 'O'));
     $objArray[] = array('id' => 15, 'parent_id' => 10, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'R', 'sort_value' => 15, 'name' => 'Rejected', 'display_name' => $this->makeDisplayName($this->__('Rejected')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Publication Status Extended/Rejected', 'ipath' => '/1/3/10/15', 'status' => 'A', '__ATTRIBUTES__' => array('code' => 'R'));
     $objArray[] = array('id' => 16, 'parent_id' => 3, 'is_locked' => 0, 'is_leaf' => 0, 'value' => '', 'sort_value' => 16, 'name' => 'Gender', 'display_name' => $this->makeDisplayName($this->__('Gender')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Gender', 'ipath' => '/1/3/16', 'status' => 'A');
     $objArray[] = array('id' => 17, 'parent_id' => 16, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'M', 'sort_value' => 17, 'name' => 'Male', 'display_name' => $this->makeDisplayName($this->__('Male')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Gender/Male', 'ipath' => '/1/3/16/17', 'status' => 'A', '__ATTRIBUTES__' => array('code' => 'M'));
     $objArray[] = array('id' => 18, 'parent_id' => 16, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'F', 'sort_value' => 18, 'name' => 'Female', 'display_name' => $this->makeDisplayName($this->__('Female')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Gender/Female', 'ipath' => '/1/3/16/18', 'status' => 'A', '__ATTRIBUTES__' => array('code' => 'F'));
     $objArray[] = array('id' => 19, 'parent_id' => 3, 'is_locked' => 0, 'is_leaf' => 0, 'sort_value' => 19, 'value' => '', 'name' => 'Title', 'display_name' => $this->makeDisplayName($this->__('Title')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Title', 'ipath' => '/1/3/19', 'status' => 'A');
     $objArray[] = array('id' => 20, 'parent_id' => 19, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'Mr', 'sort_value' => 20, 'name' => 'Mr', 'display_name' => $this->makeDisplayName($this->__('Mr.')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Title/Mr', 'ipath' => '/1/3/19/20', 'status' => 'A');
     $objArray[] = array('id' => 21, 'parent_id' => 19, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'Mrs', 'sort_value' => 21, 'name' => 'Mrs', 'display_name' => $this->makeDisplayName($this->__('Mrs.')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Title/Mrs', 'ipath' => '/1/3/19/21', 'status' => 'A');
     $objArray[] = array('id' => 22, 'parent_id' => 19, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'Ms', 'sort_value' => 22, 'name' => 'Ms', 'display_name' => $this->makeDisplayName($this->__('Ms.')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Title/Ms', 'ipath' => '/1/3/19/22', 'status' => 'A');
     $objArray[] = array('id' => 23, 'parent_id' => 19, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'Miss', 'sort_value' => 23, 'name' => 'Miss', 'display_name' => $this->makeDisplayName($this->__('Miss')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Title/Miss', 'ipath' => '/1/3/19/23', 'status' => 'A');
     $objArray[] = array('id' => 24, 'parent_id' => 19, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'Dr', 'sort_value' => 24, 'name' => 'Dr', 'display_name' => $this->makeDisplayName($this->__('Dr.')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Title/Dr', 'ipath' => '/1/3/19/24', 'status' => 'A');
     $objArray[] = array('id' => 25, 'parent_id' => 3, 'is_locked' => 0, 'is_leaf' => 0, 'value' => '', 'sort_value' => 25, 'name' => 'ActiveStatus', 'display_name' => $this->makeDisplayName($this->__('Activity status')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/ActiveStatus', 'ipath' => '/1/3/25', 'status' => 'A');
     $objArray[] = array('id' => 26, 'parent_id' => 25, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'A', 'sort_value' => 26, 'name' => 'Active', 'display_name' => $this->makeDisplayName($this->__('Active')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/ActiveStatus/Active', 'ipath' => '/1/3/25/26', 'status' => 'A', '__ATTRIBUTES__' => array('code' => 'A'));
     $objArray[] = array('id' => 27, 'parent_id' => 25, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'I', 'sort_value' => 27, 'name' => 'Inactive', 'display_name' => $this->makeDisplayName($this->__('Inactive')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/ActiveStatus/Inactive', 'ipath' => '/1/3/25/27', 'status' => 'A', '__ATTRIBUTES__' => array('code' => 'I'));
     $objArray[] = array('id' => 28, 'parent_id' => 3, 'is_locked' => 0, 'is_leaf' => 0, 'value' => '', 'sort_value' => 28, 'name' => 'Publication status (basic)', 'display_name' => $this->makeDisplayName($this->__('Publication status (basic)')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Publication Status Basic', 'ipath' => '/1/3/28', 'status' => 'A');
     $objArray[] = array('id' => 29, 'parent_id' => 28, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'P', 'sort_value' => 29, 'name' => 'Pending', 'display_name' => $this->makeDisplayName($this->__('Pending')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Publication Status Basic/Pending', 'ipath' => '/1/3/28/29', 'status' => 'A', '__ATTRIBUTES__' => array('code' => 'P'));
     $objArray[] = array('id' => 30, 'parent_id' => 28, 'is_locked' => 0, 'is_leaf' => 1, 'value' => 'A', 'sort_value' => 30, 'name' => 'Approved', 'display_name' => $this->makeDisplayName($this->__('Approved')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/General/Publication Status Basic/Approved', 'ipath' => '/1/3/28/30', 'status' => 'A', '__ATTRIBUTES__' => array('code' => 'A'));
     $objArray[] = array('id' => 31, 'parent_id' => 1, 'is_locked' => 0, 'is_leaf' => 0, 'value' => '', 'sort_value' => 31, 'name' => 'Users', 'display_name' => $this->makeDisplayName($this->__('Users')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/Users', 'ipath' => '/1/31', 'status' => 'A');
     $objArray[] = array('id' => 32, 'parent_id' => 2, 'is_locked' => 0, 'is_leaf' => 0, 'value' => '', 'sort_value' => 32, 'name' => 'Global', 'display_name' => $this->makeDisplayName($this->__('Global')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/Modules/Global', 'ipath' => '/1/2/32', 'status' => 'A');
     $objArray[] = array('id' => 33, 'parent_id' => 32, 'is_locked' => 0, 'is_leaf' => 1, 'value' => '', 'sort_value' => 33, 'name' => 'Blogging', 'display_name' => $this->makeDisplayName($this->__('Blogging')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/Modules/Global/Blogging', 'ipath' => '/1/2/32/33', 'status' => 'A');
     $objArray[] = array('id' => 34, 'parent_id' => 32, 'is_locked' => 0, 'is_leaf' => 1, 'value' => '', 'sort_value' => 34, 'name' => 'Music and audio', 'display_name' => $this->makeDisplayName($this->__('Music and audio')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/Modules/Global/MusicAndAudio', 'ipath' => '/1/2/32/34', 'status' => 'A');
     $objArray[] = array('id' => 35, 'parent_id' => 32, 'is_locked' => 0, 'is_leaf' => 1, 'value' => '', 'sort_value' => 35, 'name' => 'Art and photography', 'display_name' => $this->makeDisplayName($this->__('Art and photography')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/Modules/Global/ArtAndPhotography', 'ipath' => '/1/2/32/35', 'status' => 'A');
     $objArray[] = array('id' => 36, 'parent_id' => 32, 'is_locked' => 0, 'is_leaf' => 1, 'value' => '', 'sort_value' => 36, 'name' => 'Writing and thinking', 'display_name' => $this->makeDisplayName($this->__('Writing and thinking')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/Modules/Global/WritingAndThinking', 'ipath' => '/1/2/32/36', 'status' => 'A');
     $objArray[] = array('id' => 37, 'parent_id' => 32, 'is_locked' => 0, 'is_leaf' => 1, 'value' => '', 'sort_value' => 37, 'name' => 'Communications and media', 'display_name' => $this->makeDisplayName($this->__('Communications and media')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/Modules/Global/CommunicationsAndMedia', 'ipath' => '/1/2/32/37', 'status' => 'A');
     $objArray[] = array('id' => 38, 'parent_id' => 32, 'is_locked' => 0, 'is_leaf' => 1, 'value' => '', 'sort_value' => 38, 'name' => 'Travel and culture', 'display_name' => $this->makeDisplayName($this->__('Travel and culture')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/Modules/Global/TravelAndCulture', 'ipath' => '/1/2/32/38', 'status' => 'A');
     $objArray[] = array('id' => 39, 'parent_id' => 32, 'is_locked' => 0, 'is_leaf' => 1, 'value' => '', 'sort_value' => 39, 'name' => 'Science and technology', 'display_name' => $this->makeDisplayName($this->__('Science and technology')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/Modules/Global/ScienceAndTechnology', 'ipath' => '/1/2/32/39', 'status' => 'A');
     $objArray[] = array('id' => 40, 'parent_id' => 32, 'is_locked' => 0, 'is_leaf' => 1, 'value' => '', 'sort_value' => 40, 'name' => 'Sport and activities', 'display_name' => $this->makeDisplayName($this->__('Sport and activities')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/Modules/Global/SportAndActivities', 'ipath' => '/1/2/32/40', 'status' => 'A');
     $objArray[] = array('id' => 41, 'parent_id' => 32, 'is_locked' => 0, 'is_leaf' => 1, 'value' => '', 'sort_value' => 41, 'name' => 'Business and work', 'display_name' => $this->makeDisplayName($this->__('Business and work')), 'display_desc' => $this->makeDisplayDesc(), 'path' => '/__SYSTEM__/Modules/Global/BusinessAndWork', 'ipath' => '/1/2/32/41', 'status' => 'A');
     DBUtil::insertObjectArray($objArray, 'categories_category', 'id', true);
 }
Exemple #18
0
 /**
  * create the default data for the groups module
  *
  * This function is only ever called once during the lifetime of a particular
  * module instance
  *
  * @return       bool       false
  */
 public function defaultdata()
 {
     $records = array(array('name' => $this->__('Users'), 'description' => $this->__('By default, all users are made members of this group.'), 'prefix' => $this->__('usr')), array('name' => $this->__('Administrators'), 'description' => $this->__('Group of administrators of this site.'), 'prefix' => $this->__('adm')));
     DBUtil::insertObjectArray($records, 'groups', 'gid');
     // Insert Anonymous and Admin users
     $records = array(array('gid' => '1', 'uid' => '1'), array('gid' => '1', 'uid' => '2'), array('gid' => '2', 'uid' => '2'));
     DBUtil::insertObjectArray($records, 'group_membership', 'gid', true);
 }