Exemple #1
0
 function getData()
 {
     if ($this->data) {
         return $this->data;
     }
     $data = $this->obj->getData();
     $data = Tiki_Profile::convertYesNo($data);
     return $this->data = $data;
 }
Exemple #2
0
 private function getData()
 {
     if ($this->data) {
         return $this->data;
     }
     $data = $this->obj->getData();
     $data = Tiki_Profile::convertLists($data, array('show' => 'y', 'allow' => 'y'), true);
     $data = Tiki_Profile::convertYesNo($data);
     return $this->data = $data;
 }
Exemple #3
0
 function getData()
 {
     if ($this->data) {
         return $this->data;
     }
     $defaults = array('sections' => array('wiki'), 'type' => 'static');
     $data = array_merge($defaults, $this->obj->getData());
     $data = Tiki_Profile::convertYesNo($data);
     return $this->data = $data;
 }
Exemple #4
0
 function getData()
 {
     if ($this->data) {
         return $this->data;
     }
     $defaults = array();
     $data = array_merge($defaults, $this->obj->getData());
     $data = Tiki_Profile::convertYesNo($data);
     return $this->data = $data;
 }
Exemple #5
0
 function getData()
 {
     if ($this->data) {
         return $this->data;
     }
     $defaults = array('title' => 'Title', 'private' => 'n', 'user' => '', 'geolocation' => '');
     $data = array_merge($defaults, $this->obj->getData());
     $data = Tiki_Profile::convertYesNo($data);
     return $this->data = $data;
 }
Exemple #6
0
 function getData()
 {
     if ($this->data) {
         return $this->data;
     }
     $defaults = array('description' => '', 'user' => 'admin', 'public' => 'n', 'max_posts' => 10, 'heading' => '', 'post_heading' => '', 'use_find' => 'y', 'comments' => 'n', 'show_avatar' => 'n');
     $data = array_merge($defaults, $this->obj->getData());
     $data = Tiki_Profile::convertYesNo($data);
     return $this->data = $data;
 }
Exemple #7
0
 function getData()
 {
     if ($this->data) {
         return $this->data;
     }
     $defaults = array('preferences' => array());
     $data = array_merge($defaults, $this->obj->getData());
     $data['preferences'] = Tiki_Profile::convertLists($data['preferences'], array('enable' => 'y', 'disable' => 'n'));
     $data['preferences'] = Tiki_Profile::convertYesNo($data['preferences']);
     return $this->data = $data;
 }
Exemple #8
0
 function getData()
 {
     if ($this->data) {
         return $this->data;
     }
     $defaults = array('cache' => 0, 'rows' => 10, 'custom' => null, 'groups' => array(), 'params' => array(), 'parse' => null);
     $data = array_merge($defaults, $this->obj->getData());
     $data = Tiki_Profile::convertYesNo($data);
     $data['params'] = Tiki_Profile::convertYesNo($data['params']);
     return $this->data = $data;
 }
Exemple #9
0
 function getData()
 {
     if ($this->data) {
         return $this->data;
     }
     $data = $this->obj->getData();
     $defaults = array('description' => '', 'flood_interval' => 120, 'moderator' => 'admin', 'per_page' => 10, 'prune_max_age' => 3 * 24 * 3600, 'prune_unreplied_max_age' => 30 * 24 * 3600, 'topic_order' => 'lastPost_desc', 'thread_order' => '', 'section' => '', 'inbound_pop_server' => '', 'inbound_pop_port' => 110, 'inbound_pop_user' => '', 'inbound_pop_password' => '', 'outbound_address' => '', 'outbound_from' => '', 'approval_type' => 'all_posted', 'moderator_group' => '', 'forum_password' => '', 'attachments' => 'none', 'attachments_store' => 'db', 'attachments_store_dir' => '', 'attachments_max_size' => 10000000, 'forum_last_n' => 0, 'comments_per_page' => '', 'thread_style' => '', 'is_flat' => 'n', 'list_topic_reads' => 'n', 'list_topic_replies' => 'n', 'list_topic_points' => 'n', 'list_topic_last_post' => 'n', 'list_topic_last_post_title' => 'n', 'list_topic_last_post_avatar' => 'n', 'list_topic_author' => 'n', 'list_topic_author_avatar' => 'n', 'show_description' => 'n', 'enable_flood_control' => 'n', 'enable_inbound_mail' => 'n', 'enable_prune_unreplied' => 'n', 'enable_prune_old' => 'n', 'enable_vote_threads' => 'n', 'enable_outbound_for_inbound' => 'n', 'enable_outbound_reply_link' => 'n', 'enable_topic_smiley' => 'n', 'enable_topic_summary' => 'n', 'enable_ui_avatar' => 'n', 'enable_ui_rating_choice_topic' => 'n', 'enable_ui_flag' => 'n', 'enable_ui_posts' => 'n', 'enable_ui_level' => 'n', 'enable_ui_email' => 'n', 'enable_ui_online' => 'n', 'enable_password_protection' => 'n', 'forum_language' => '');
     $data = Tiki_Profile::convertLists($data, array('enable' => 'y', 'list' => 'y', 'show' => 'y'), true);
     $data = array_merge($defaults, $data);
     $data = Tiki_Profile::convertYesNo($data);
     return $this->data = $data;
 }
Exemple #10
0
 function getData()
 {
     if ($this->data) {
         return $this->data;
     }
     $data = $this->obj->getData();
     $data = Tiki_Profile::convertLists($data, array('show' => 'y'), true);
     $defaults = array('description' => null, 'refresh' => 30, 'show_title' => 'n', 'show_publication_date' => 'n', 'article_generator' => null);
     $data = array_merge($defaults, $data);
     $data = Tiki_Profile::convertYesNo($data);
     return $this->data = $data;
 }
Exemple #11
0
 function getData()
 {
     if ($this->data) {
         return $this->data;
     }
     $data = $this->obj->getData();
     $data = Tiki_Profile::convertLists($data, array('show' => 'y', 'allow' => 'y'), true);
     $defaults = array('show_pre_publication' => 'n', 'show_post_expire' => 'n', 'show_heading_only' => 'n', 'show_image' => 'n', 'show_avatar' => 'n', 'show_author' => 'n', 'show_publication_date' => 'n', 'show_expiration_date' => 'n', 'show_reads' => 'n', 'show_size' => 'n', 'show_topline' => 'n', 'show_subtitle' => 'n', 'show_link_to' => 'n', 'show_image_caption' => 'n', 'allow_ratings' => 'n', 'allow_comments' => 'n', 'allow_comments_rating_article' => 'n', 'allow_creator_edit' => 'n');
     $data = array_merge($defaults, $data);
     $data = Tiki_Profile::convertYesNo($data);
     return $this->data = $data;
 }
Exemple #12
0
 function getData()
 {
     if ($this->data) {
         return $this->data;
     }
     $defaults = array('preserve' => 'n', 'guards' => array());
     $data = array_merge($defaults, $this->obj->getData());
     foreach ($data['guards'] as &$guard) {
         if (is_string($guard[2])) {
             $guard[2] = reset(Horde_Yaml::load("- " . $guard[2]));
         }
     }
     $data = Tiki_Profile::convertYesNo($data);
     return $this->data = $data;
 }
 function getPermissions($groupMap = array())
 {
     if (!array_key_exists('permissions', $this->data)) {
         return array();
     }
     $groups = array();
     foreach ($this->data['permissions'] as $groupName => $data) {
         if (isset($groupMap[$groupName])) {
             $groupName = $groupMap[$groupName];
         }
         $permissions = Tiki_Profile::convertLists($data, array('allow' => 'y', 'deny' => 'n'), 'tiki_p_');
         $permissions = Tiki_Profile::convertYesNo($permissions);
         foreach (array_keys($permissions) as $key) {
             if (strpos($key, 'tiki_p_') !== 0) {
                 unset($permissions[$key]);
             }
         }
         $defaultInfo = array('description' => '', 'home' => '', 'user_tracker' => 0, 'user_tracker_field' => 0, 'group_tracker' => 0, 'group_tracker_field' => 0, 'user_signup' => 'n', 'default_category' => 0, 'theme' => '', 'registration_fields' => array(), 'include' => array(), 'autojoin' => 'n');
         foreach ($defaultInfo as $key => $value) {
             if (array_key_exists($key, $data)) {
                 if (is_array($value)) {
                     $defaultInfo[$key] = (array) $data[$key];
                 } else {
                     $defaultInfo[$key] = $data[$key];
                 }
             }
         }
         $objects = array();
         if (isset($data['objects'])) {
             foreach ($data['objects'] as $o) {
                 if (!isset($o['type'], $o['id'])) {
                     $this->setFeedback(tra('Syntax error: ') . tra("Permissions' object must have a field 'type' and 'id'"));
                     continue;
                 }
                 $perms = Tiki_Profile::convertLists($o, array('allow' => 'y', 'deny' => 'n'), 'tiki_p_');
                 $perms = Tiki_Profile::convertYesNo($perms);
                 foreach (array_keys($perms) as $key) {
                     if (strpos($key, 'tiki_p_') !== 0) {
                         unset($perms[$key]);
                     }
                 }
                 $o['permissions'] = $perms;
                 $objects[] = $o;
             }
         }
         $groups[$groupName] = array('permissions' => $permissions, 'objects' => $objects, 'general' => $defaultInfo);
     }
     return $groups;
 }
 function getPermissions()
 {
     if (!array_key_exists('permissions', $this->data)) {
         return array();
     }
     $groups = array();
     foreach ($this->data['permissions'] as $groupName => $data) {
         $permissions = Tiki_Profile::convertLists($data, array('allow' => 'y', 'deny' => 'n'), 'tiki_p_');
         $permissions = Tiki_Profile::convertYesNo($permissions);
         foreach (array_keys($permissions) as $key) {
             if (strpos($key, 'tiki_p_') !== 0) {
                 unset($permissions[$key]);
             }
         }
         if (array_key_exists('description', $data)) {
             $description = $data['description'];
         } else {
             $description = '';
         }
         $objects = array();
         if (isset($data['objects'])) {
             foreach ($data['objects'] as $o) {
                 if (!isset($o['type'], $o['id'])) {
                     continue;
                 }
                 $perms = Tiki_Profile::convertLists($o, array('allow' => 'y', 'deny' => 'n'), 'tiki_p_');
                 $perms = Tiki_Profile::convertYesNo($perms);
                 foreach (array_keys($perms) as $key) {
                     if (strpos($key, 'tiki_p_') !== 0) {
                         unset($perms[$key]);
                     }
                 }
                 $o['permissions'] = $perms;
                 $objects[] = $o;
             }
         }
         $groups[$groupName] = array('permissions' => $permissions, 'objects' => $objects, 'general' => array('description' => $description));
     }
     return $groups;
 }
Exemple #15
0
 function _install()
 {
     $tikilib = TikiLib::lib('tiki');
     $modlib = TikiLib::lib('mod');
     $menulib = TikiLib::lib('menu');
     $data = $this->getData();
     $this->replaceReferences($data);
     $data = Tiki_Profile::convertYesNo($data);
     $type = 'f';
     if ($data['collapse'] == 'collapsed') {
         $type = 'd';
     } elseif ($data['collapse'] == 'expanded') {
         $type = 'e';
     }
     if ($data['use_items_icons'] == NULL) {
         $data['use_items_icons'] = '';
     }
     if ($data['parse'] == NULL) {
         $data['parse'] = '';
     }
     $menulib->replace_menu(0, $data['name'], $data['description'], $type, $data['icon'], $data['use_items_icons'], $data['parse']);
     $result = $tikilib->query("SELECT MAX(`menuId`) FROM `tiki_menus`");
     $menuId = reset($result->fetchRow());
     foreach ($data['items'] as $item) {
         $menulib->replace_menu_option($menuId, 0, $item['name'], $item['url'], $item['type'], $item['position'], $item['section'], implode(',', $item['permissions']), implode(',', $item['groups']), $item['level'], $item['icon']);
     }
     // Set module title to menu_nn if it is not set by a parameter
     if (!isset($data['title'])) {
         $modtitle = "menu_{$menuId}";
     } else {
         $modtitle = $data['title'];
     }
     // Set up module only as a custom module if position is set to 'none'
     if ($data['position'] == 'none') {
         // but still allow module_arguments	but keep it simple and don't include the $key=
         $extra = '';
         if (isset($data['module_arguments'])) {
             foreach ($data['module_arguments'] as $key => $value) {
                 $extra .= " {$value}";
             }
         }
         $content = "{menu id={$menuId}{$extra}}";
         $modlib->replace_user_module($data['name'], $modtitle, $content);
     } elseif (isset($data['position'], $data['order'])) {
         // Set module as side menu if both position and order are specified and position is not 'none'
         $column = $data['position'] == 'left' ? 'l' : 'r';
         $extra = '';
         if (isset($data['module_arguments'])) {
             foreach ($data['module_arguments'] as $key => $value) {
                 $extra .= " {$key}={$value}";
             }
         }
         $content = "{menu id={$menuId}{$extra}}";
         $modlib->replace_user_module($data['name'], $modtitle, $content);
         $modlib->assign_module(0, "menu_{$menuId}", null, $column, $data['order'], $data['cache'], 10, $data['groups'], '');
     }
     return $menuId;
 }