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; }
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; }
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; }
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; }
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; }
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 getData() { if ($this->data) { return $this->data; } $defaults = array('owner' => 'admin', 'public' => 'n', 'galleryId' => null, 'parent' => -1, 'visible' => 'n'); $conversions = array('owner' => 'user', 'max_rows' => 'maxRows', 'parent' => 'parentId'); $columns = array('id', 'icon', 'name', 'size', 'description', 'created', 'hits', 'lastDownload', 'lockedby', 'modified', 'author', 'last_user', 'comment', 'files', 'backlinks', 'deleteAfter', 'checked', 'share', 'source', 'explorer', 'path', 'slideshow'); $data = $this->obj->getData(); $data = Tiki_Profile::convertLists($data, array('flags' => 'y')); $column = isset($data['column']) ? $data['column'] : array(); $popup = isset($data['popup']) ? $data['popup'] : array(); if (in_array('name', $column) && in_array('filename', $column)) { $data['show_name'] = 'a'; unset($column[array_search('name', $column)], $column[array_search('filename', $column)]); unset($columns[array_search('name', $columns)]); } else { if (in_array('name', $column)) { $data['show_name'] = 'n'; unset($column[array_search('name', $column)]); unset($columns[array_search('name', $columns)]); } else { if (in_array('filename', $column)) { $data['show_name'] = 'f'; unset($column[array_search('filename', $column)]); unset($columns[array_search('name', $columns)]); } } } $both = array_intersect($column, $popup); if ($column || $popup) { $hide = array_diff($columns, array_merge($column, $popup)); } else { $hide = array(); // use defaults if nothing set } $column = array_diff($column, $both); $popup = array_diff($popup, $both); foreach ($both as $value) { $data["show_{$value}"] = 'a'; } foreach ($column as $value) { $data["show_{$value}"] = 'y'; } foreach ($popup as $value) { $data["show_{$value}"] = 'o'; } foreach ($hide as $value) { $data["show_{$value}"] = 'n'; } unset($data['popup']); unset($data['column']); $data = array_merge($defaults, $data); foreach ($conversions as $old => $new) { if (array_key_exists($old, $data)) { $data[$new] = $data[$old]; unset($data[$old]); } } unset($data['galleryId']); $this->replaceReferences($data); if (!empty($data['name'])) { global $filegallib; require_once 'lib/filegals/filegallib.php'; $data['galleryId'] = $filegallib->getGalleryId($data['name'], $data['parentId']); } return $this->data = $data; }
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; }