| 1 |
<?php
|
| 2 |
// $Id: indymedia_alba.profile,v 1.16 2008/05/17 16:06:14 tomm Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Return an array of the modules to be enabled when this profile is installed.
|
| 6 |
*
|
| 7 |
* @return
|
| 8 |
* An array of modules to enable.
|
| 9 |
*/
|
| 10 |
function indymedia_alba_profile_modules() {
|
| 11 |
return array('color', 'help', 'menu', 'taxonomy', 'dblog', 'aggregator',
|
| 12 |
'translation', 'search', 'upload', 'path',
|
| 13 |
|
| 14 |
'imc_alba', 'nodecomment', 'article', 'indymedia_cities', 'dadamigrate', 'imceditor',
|
| 15 |
'imcviews', 'nodextradata',
|
| 16 |
|
| 17 |
'fckeditor');
|
| 18 |
}
|
| 19 |
|
| 20 |
/**
|
| 21 |
* Return a description of the profile for the initial installation screen.
|
| 22 |
*
|
| 23 |
* @return
|
| 24 |
* An array with keys 'name' and 'description' describing this profile,
|
| 25 |
* and optional 'language' to override the language selection for
|
| 26 |
* language-specific profiles.
|
| 27 |
*/
|
| 28 |
function indymedia_alba_profile_details() {
|
| 29 |
return array(
|
| 30 |
'name' => 'Indymedia Alba',
|
| 31 |
'description' => 'A basic Indymedia site setup.'
|
| 32 |
);
|
| 33 |
}
|
| 34 |
|
| 35 |
/**
|
| 36 |
* Return a list of tasks that this profile supports.
|
| 37 |
*
|
| 38 |
* @return
|
| 39 |
* A keyed array of tasks the profile will perform during
|
| 40 |
* the final stage. The keys of the array will be used internally,
|
| 41 |
* while the values will be displayed to the user in the installer
|
| 42 |
* task list.
|
| 43 |
*/
|
| 44 |
function indymedia_alba_profile_task_list() {
|
| 45 |
}
|
| 46 |
|
| 47 |
function _indymedia_alba_add_page($title, $teaser, $body) {
|
| 48 |
$node = (object)array(
|
| 49 |
'type' => 'page', 'title' => $title,
|
| 50 |
'status' => 1, 'created' => time(), 'changed' => time(), 'promote' => 0,
|
| 51 |
'uid' => 1, 'comment' => 0, 'format' => 2, // unfiltered HTML
|
| 52 |
);
|
| 53 |
$node->teaser = $teaser;
|
| 54 |
$node->body = ($body ? $body : $teaser);
|
| 55 |
node_save($node);
|
| 56 |
path_set_alias('node/'.$node->nid, strtolower($title));
|
| 57 |
return $node->nid;
|
| 58 |
}
|
| 59 |
|
| 60 |
function _indymedia_alba_add_infodocs() {
|
| 61 |
$pages = array(t('About us') => "The Independent Media Center is a network of collectively run media outlets for the creation of radical, accurate, and passionate tellings of the truth. We work out of a love and inspiration for people who continue to work for a better world, despite corporate media's distortions and unwillingness to cover the efforts to free humanity.",
|
| 62 |
t('Contact information') => 'to do',
|
| 63 |
t('Editorial Policy') => 'to do',
|
| 64 |
t('Getting Involved') => 'to do',
|
| 65 |
t('Meetings') => 'to do',
|
| 66 |
t('Donations') => 'to do');
|
| 67 |
|
| 68 |
$nids = array();
|
| 69 |
foreach ($pages as $title => $body) {
|
| 70 |
$nids[$title] = _indymedia_alba_add_page($title, $body, '');
|
| 71 |
}
|
| 72 |
$teaser = t('You should put your mission statement, links to editorial guidelines, contact details, etc here.');
|
| 73 |
$body = $teaser;
|
| 74 |
foreach ($nids as $title => $nid) {
|
| 75 |
$body .= "\n\n".l($title, 'node/'.$nid);
|
| 76 |
}
|
| 77 |
$info_nid = _indymedia_alba_add_page(t('Information'), $teaser, $body);
|
| 78 |
|
| 79 |
$link = array('menu_name' => 'primary-links', 'weight' => 3, 'link_path' => 'node/'.$info_nid, 'link_title' => t('Information'));
|
| 80 |
menu_link_save(&$link);
|
| 81 |
}
|
| 82 |
|
| 83 |
function _indymedia_alba_stuff_terms(&$terms, $vid) {
|
| 84 |
$tids = array();
|
| 85 |
foreach ($terms as $name => $desc) {
|
| 86 |
$term = array(
|
| 87 |
'name' => $name, 'vid' => $vid,
|
| 88 |
'description' => $desc,
|
| 89 |
);
|
| 90 |
taxonomy_save_term($term);
|
| 91 |
$tids[] = $term['tid'];
|
| 92 |
}
|
| 93 |
return $tids;
|
| 94 |
}
|
| 95 |
|
| 96 |
/**
|
| 97 |
* Perform any final installation tasks for this profile.
|
| 98 |
*
|
| 99 |
* The installer goes through the profile-select -> locale-select
|
| 100 |
* -> requirements -> database -> profile-install-batch
|
| 101 |
* -> locale-initial-batch -> configure -> locale-remaining-batch
|
| 102 |
* -> finished -> done tasks, in this order, if you don't implement
|
| 103 |
* this function in your profile.
|
| 104 |
*
|
| 105 |
* Important: Any temporary variables should be removed using
|
| 106 |
* variable_del() before advancing to the 'profile-finished' phase.
|
| 107 |
*
|
| 108 |
* @param $task
|
| 109 |
* The current $task of the install system. When hook_profile_tasks()
|
| 110 |
* is first called, this is 'profile'.
|
| 111 |
* @param $url
|
| 112 |
* Complete URL to be used for a link or form action on a custom page,
|
| 113 |
* if providing any, to allow the user to proceed with the installation.
|
| 114 |
*
|
| 115 |
* @return
|
| 116 |
* An optional HTML string to display to the user. Only used if you
|
| 117 |
* modify the $task, otherwise discarded.
|
| 118 |
*/
|
| 119 |
function indymedia_alba_profile_tasks(&$task, $url) {
|
| 120 |
// Insert default user-defined node types into the database. For a complete
|
| 121 |
// list of available node type attributes, refer to the node type API
|
| 122 |
// documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info.
|
| 123 |
$types = array(
|
| 124 |
array(
|
| 125 |
'type' => 'page',
|
| 126 |
'name' => st('Page'),
|
| 127 |
'module' => 'node',
|
| 128 |
'description' => st("A <em>page</em>, similar in form to an <em>article</em>, is a simple method for creating and displaying information that rarely changes, such as an \"About us\" section of a website. By default, a <em>page</em> entry does not allow visitor comments and is not featured on the site's initial home page."),
|
| 129 |
'custom' => TRUE,
|
| 130 |
'modified' => TRUE,
|
| 131 |
'locked' => FALSE,
|
| 132 |
'help' => '',
|
| 133 |
'min_word_count' => '',
|
| 134 |
),
|
| 135 |
/*array(
|
| 136 |
'type' => 'story',
|
| 137 |
'name' => st('Story'),
|
| 138 |
'module' => 'node',
|
| 139 |
'description' => st("A <em>story</em>, similar in form to a <em>page</em>, is ideal for creating and displaying content that informs or engages website visitors. Press releases, site announcements, and informal blog-like entries may all be created with a <em>story</em> entry. By default, a <em>story</em> entry is automatically featured on the site's initial home page, and provides the ability to post comments."),
|
| 140 |
'custom' => TRUE,
|
| 141 |
'modified' => TRUE,
|
| 142 |
'locked' => FALSE,
|
| 143 |
'help' => '',
|
| 144 |
'min_word_count' => '',
|
| 145 |
),*/
|
| 146 |
);
|
| 147 |
|
| 148 |
foreach ($types as $type) {
|
| 149 |
$type = (object) _node_type_set_defaults($type);
|
| 150 |
node_type_save($type);
|
| 151 |
}
|
| 152 |
|
| 153 |
// Default page to not be promoted and have comments disabled.
|
| 154 |
variable_set('node_options_page', array('status', 'revision'));
|
| 155 |
variable_set('comment_page', COMMENT_NODE_DISABLED);
|
| 156 |
|
| 157 |
// if the indymedia_alba theme exists then use it
|
| 158 |
$theme = "garland";
|
| 159 |
if (db_result(db_query("SELECT COUNT(*) FROM {system} WHERE type = 'theme' AND name = 'indymedia_alba'"))) {
|
| 160 |
$theme_settings = variable_get('theme_settings', array());
|
| 161 |
$theme_settings['toggle_node_info_page'] = FALSE;
|
| 162 |
variable_set('theme_settings', $theme_settings);
|
| 163 |
variable_set('theme_indymedia_alba_settings', array('toggle_name' => 0));
|
| 164 |
|
| 165 |
system_theme_data();
|
| 166 |
system_initialize_theme_blocks('indymedia_alba');
|
| 167 |
db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' and name = 'indymedia_alba'");
|
| 168 |
variable_set('theme_default', 'indymedia_alba');
|
| 169 |
$theme = 'indymedia_alba';
|
| 170 |
}
|
| 171 |
db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region) VALUES ('imcviews','0','$theme',1,10,'right')");
|
| 172 |
db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region) VALUES ('imcviews','1','$theme',1,11,'right')");
|
| 173 |
db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region) VALUES ('indymedia_cities','en','$theme',1,10,'left')");
|
| 174 |
db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region) VALUES ('imceditor','0','$theme',1,9,'left')");
|
| 175 |
// article comments order age ascending
|
| 176 |
variable_set('comment_default_order_article', '2');
|
| 177 |
variable_set('comment_hidden_viewable_article', '1');
|
| 178 |
variable_set('comment_anonymous_article', '1');
|
| 179 |
|
| 180 |
// menu_link_save's behaviour is very odd.
|
| 181 |
$model_link = array('options' => array("attributes" => array('title'=>'')));
|
| 182 |
$link = $model_link + array('plid'=>0,'mlid'=>0, 'weight' => 1,
|
| 183 |
'link_path' => 'admin/content/imceditor/visible/nodecomment', 'link_title' => t('Moderate Comments'));
|
| 184 |
menu_link_save($link);
|
| 185 |
$link = $model_link + array('plid'=>0,'mlid'=>0, 'weight' => 2,
|
| 186 |
'link_path' => 'admin/content/imceditor/visible/article', 'link_title' => t('Moderate Articles'));
|
| 187 |
menu_link_save($link);
|
| 188 |
$link = $model_link + array('menu_name' => 'primary-links', 'weight' => 0, 'link_path' => '<front>', 'link_title' => t('Front Page'));
|
| 189 |
menu_link_save($link);
|
| 190 |
$link = $model_link + array('menu_name' => 'primary-links', 'weight' => 1, 'link_path' => 'newswire', 'link_title' => t('Newswire'));
|
| 191 |
menu_link_save($link);
|
| 192 |
$link = $model_link + array('menu_name' => 'primary-links', 'weight' => 2, 'link_path' => 'node/add/article', 'link_title' => t('Publish an article'));
|
| 193 |
menu_link_save($link);
|
| 194 |
$link = $model_link + array('menu_name' => 'primary-links', 'weight' => 3, 'link_path' => 'node/add/event', 'link_title' => t('Announce an event'));
|
| 195 |
menu_link_save($link);
|
| 196 |
// Update the menu router information.
|
| 197 |
menu_rebuild();
|
| 198 |
|
| 199 |
_indymedia_alba_add_infodocs();
|
| 200 |
|
| 201 |
db_query("INSERT INTO {role} VALUES (3,'editor')");
|
| 202 |
db_query("INSERT INTO {role} VALUES (4,'admin')");
|
| 203 |
|
| 204 |
db_query("DELETE FROM {permission}");
|
| 205 |
db_query("INSERT INTO {permission} VALUES (3,1,'create article content, access fckeditor, allow fckeditor file uploads, access content, create event content, view revisions, create nodecomment content, search content, use advanced search, upload files, view uploaded files, access user profiles',0)");
|
| 206 |
db_query("INSERT INTO {permission} VALUES (4,2,'create article content, edit own article content, access fckeditor, allow fckeditor file uploads, access content, create event content, edit own event content, view revisions, create nodecomment content, edit own nodecomment content, search content, use advanced search, translate content, upload files, view uploaded files, access user profiles, change own username',0)");
|
| 207 |
db_query("INSERT INTO {permission} VALUES (5,3,'create article content, edit any article content, edit own article content, access fckeditor, allow fckeditor file uploads, moderate content, access content, create event content, create page content, edit any event content, edit any page content, edit own event content, edit own page content, revert revisions, view revisions, create nodecomment content, edit own nodecomment content, search content, use advanced search, translate content, upload files, view uploaded files, access user profiles, change own username',0)");
|
| 208 |
db_query("INSERT INTO {permission} VALUES (6,4,'create article content, edit any article content, edit own article content, administer blocks, use PHP for block visibility, access fckeditor, administer fckeditor, allow fckeditor file uploads, administer filters, administer imceditor, moderate content, administer languages, translate interface, administer menu, administer imcviews, access content, administer content types, create event content, create page content, delete any page content, delete own page content, delete revisions, edit any event content, edit any page content, edit own event content, edit own page content, revert revisions, view revisions, create nodecomment content, edit own nodecomment content, administer search, search content, use advanced search, access administration pages, access site reports, administer actions, administer files, administer site configuration, select different theme, administer taxonomy, translate content, upload files, view uploaded files, access user profiles, administer permissions, administer users, change own username',0)");
|
| 209 |
|
| 210 |
variable_set('upload_uploadsize_default','2');
|
| 211 |
variable_set('upload_usersize_default','10000');
|
| 212 |
variable_set('upload_uploadsize_1','2');
|
| 213 |
variable_set('upload_usersize_1','10000');
|
| 214 |
variable_set('upload_uploadsize_2','2');
|
| 215 |
variable_set('upload_usersize_2','10000');
|
| 216 |
variable_set('upload_uploadsize_4','2');
|
| 217 |
variable_set('upload_usersize_4','10000');
|
| 218 |
variable_set('upload_uploadsize_3','2');
|
| 219 |
variable_set('upload_usersize_3','10000');
|
| 220 |
|
| 221 |
// filters
|
| 222 |
variable_set('allowed_html_1', '<img> <br> <p> <div> <span> <b> <i> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>');
|
| 223 |
|
| 224 |
$vocab = array(
|
| 225 |
'nodes' => array('article' => 1),
|
| 226 |
'name' => 'Category',
|
| 227 |
'relations' => 1,
|
| 228 |
'hierarchy' => 1,
|
| 229 |
'multiple' => 1,
|
| 230 |
'required' => 1,
|
| 231 |
'tags' => 0,
|
| 232 |
);
|
| 233 |
taxonomy_save_vocabulary($vocab);
|
| 234 |
|
| 235 |
$terms = array('Housing' => "Articles and information about housing issues, tenants' rights, homelessness, etc.",
|
| 236 |
'Protest Activity' => "News and media related to protests in the world.",
|
| 237 |
'Globalization' => "Anti-globalization activities have taken the forefront in recent years. The IndyMedia sites were originally conceived to promote coverage of anti-globalization protests, and in this category, we offer our perspectives on globalization in words and images.",
|
| 238 |
'Environment' => "Environment and climate-related news, activities and ideas in support of a greener world.",
|
| 239 |
'Workplace Struggle' => "Strike, struggle for workers' rights and labor issues.",
|
| 240 |
'Miscellaneous' => "Catch-all for topics that don't fit into other categories.",
|
| 241 |
'Gender' => "Women, Men and feminism",
|
| 242 |
'Sexuality' => "Identity? Lesbian, Gay, Bi, Trans, Straight",
|
| 243 |
'Animal Rights' => "Information concerning animal rights movements, actions, and protests.",
|
| 244 |
'Education' => "News and activities surrounding education.",
|
| 245 |
'Civil & Human Rights' => "News and activities concerning loss of civil liberties, human rights violations, Constitutional violations, etc.",
|
| 246 |
'Drugs' => "News on the War on Drugs, marijuana legalization, pharmaceutical companies.",
|
| 247 |
'Elections & Legislation' => "News on election results, campaigns, pending legislation, the democratic process.",
|
| 248 |
'Media' => "Media activism, media critiques.",
|
| 249 |
'Repression' => "Police brutality, corruption, use of deadly force, legal, prison activism, information on political prisoners.",
|
| 250 |
'Crime & Police' => "Information related to crime, police brutality, corruption, use of deadly force.",
|
| 251 |
'Urban Development' => "Issues of urban development, gentrification, renewal policies, etc.",
|
| 252 |
'Peace' => "Peace/Anti-war activity",
|
| 253 |
);
|
| 254 |
_indymedia_alba_stuff_terms(&$terms, $vocab['vid']);
|
| 255 |
|
| 256 |
$vocab = array(
|
| 257 |
'nodes' => array('article' => 1),
|
| 258 |
'name' => 'Section',
|
| 259 |
'relations' => 1,
|
| 260 |
'hierarchy' => 1,
|
| 261 |
'multiple' => 0,
|
| 262 |
'required' => 1,
|
| 263 |
'tags' => 0,
|
| 264 |
);
|
| 265 |
taxonomy_save_vocabulary($vocab);
|
| 266 |
|
| 267 |
$terms = array('News' => '',
|
| 268 |
'Commentary' => '',
|
| 269 |
'Announcements' => '',
|
| 270 |
'Reviews' => '',
|
| 271 |
'Interviews' => '',
|
| 272 |
'Other Press' => 'Links to interesting articles by other media outlets.');
|
| 273 |
$tids = _indymedia_alba_stuff_terms(&$terms, $vocab['vid']);
|
| 274 |
|
| 275 |
db_query("INSERT INTO {menu_custom} VALUES ('menu-section','Section','')");
|
| 276 |
db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, pages, cache) VALUES ('menu','menu-section','indymedia_alba',1,8,'left','',-1)");
|
| 277 |
|
| 278 |
$i=0;
|
| 279 |
foreach ($terms as $name => $poo) {
|
| 280 |
$link = array('menu_name' => 'menu-section', 'weight' => $i+10, 'link_path' => 'taxonomy/term/'.$tids[$i], 'link_title' => $name);
|
| 281 |
menu_link_save(&$link);
|
| 282 |
$i++;
|
| 283 |
}
|
| 284 |
|
| 285 |
// to help the dadamigrate script
|
| 286 |
variable_set('dada_section_vid', $vocab['vid']);
|
| 287 |
variable_set('dada_section_News', $tids[0]);
|
| 288 |
variable_set('dada_section_Commentary', $tids[1]);
|
| 289 |
variable_set('dada_section_Announcement', $tids[2]);
|
| 290 |
variable_set('dada_section_Review', $tids[3]);
|
| 291 |
variable_set('dada_section_Interview', $tids[4]);
|
| 292 |
variable_set('dada_section_Otherpress', $tids[5]);
|
| 293 |
|
| 294 |
variable_set('date_format_medium',"D, d/m/Y - H:i");
|
| 295 |
variable_set('date_format_short_custom',"m/d/Y - H:i");
|
| 296 |
variable_set('date_format_short',"d/m/Y - H:i");
|
| 297 |
variable_set('configurable_timezones', 0);
|
| 298 |
variable_set('date_format_long',"l, j F, Y - H:i");
|
| 299 |
|
| 300 |
variable_set('site_frontpage', 'front');
|
| 301 |
// allow users to be created without email verification
|
| 302 |
variable_set('user_email_verification', 0);
|
| 303 |
|
| 304 |
// allow editor moderation of some node types
|
| 305 |
variable_set('imceditor_moderate_type_article', 1);
|
| 306 |
variable_set('imceditor_moderate_type_nodecomment', 1);
|
| 307 |
|
| 308 |
// front page categories
|
| 309 |
$cats = array();
|
| 310 |
$cats[] = array('tid' => 21, 'color' => 'darkcyan', 'style' => 'summaries', 'num' => 6, 'title' => '', 'weight'=>-1);
|
| 311 |
$cats[] = array('tid' => 19, 'color' => '#606', 'style' => 'titles', 'num' => 1, 'title' => 'Other recent features', 'weight'=>0);
|
| 312 |
$cats[] = array('tid' => 20, 'color' => '#660', 'style' => 'summaries', 'num' => 6, 'title' => '', 'weight'=>1);
|
| 313 |
$cats[] = array('tid' => 23, 'color' => 'green', 'style' => 'summaries', 'num' => 6, 'title' => '', 'weight'=>2);
|
| 314 |
$cats[] = array('tid' => 22, 'color' => 'darkred', 'style' => 'summaries', 'num' => 6, 'title' => '', 'weight'=>3);
|
| 315 |
variable_set('imcviews_front_sections', $cats);
|
| 316 |
|
| 317 |
// enable author field for comments and articles
|
| 318 |
variable_set('nodextradata_author_article', 1);
|
| 319 |
variable_set('nodextradata_author_nodecomment', 1);
|
| 320 |
}
|
| 321 |
|
| 322 |
/**
|
| 323 |
* Implementation of hook_form_alter().
|
| 324 |
*
|
| 325 |
* Allows the profile to alter the site-configuration form. This is
|
| 326 |
* called through custom invocation, so $form_state is not populated.
|
| 327 |
*/
|
| 328 |
function indymedia_alba_form_alter(&$form, $form_state, $form_id) {
|
| 329 |
if ($form_id == 'install_configure') {
|
| 330 |
// Set default for site name field.
|
| 331 |
$form['site_information']['site_name']['#default_value'] = $_SERVER['SERVER_NAME'];
|
| 332 |
}
|
| 333 |
}
|