Browse Source

Getting setup for actual mod

Nathaniel van Diepen 5 years ago
parent
commit
46dc0cc555
7 changed files with 93 additions and 0 deletions
  1. 21 0
      Package-info.xml
  2. 12 0
      install.php
  3. 5 0
      install.xml
  4. 17 0
      source/Stream.php
  5. 18 0
      source/Stream.template.php
  6. 8 0
      source/Subs-Stream.php
  7. 12 0
      uninstall.php

+ 21 - 0
Package-info.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
+<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
+	<id>omnimaga:smf-member-activity</id>
+	<name>Member Activity</name>
+	<type>modification</type>
+	<version>0.0.1</version>
+	<install>
+		<modification format="xml" type="file">install.xml</modification>
+		<require-file name="source/Stream.php" destination="$sourcedir"/>
+		<require-file name="source/Subs-Stream.php" destination="$sourcedir"/>
+		<require-file name="source/Stream.template.php" destination="$themedir"/>
+	</install>
+	<uninstall>
+		<readme type="inline">This will remove the SMF-Member-Activity mod</readme>
+		<modification type="file" reverse="true">install.xml</modification>
+		<remove-file name="source/Stream.php" destination="$sourcedir"/>
+		<remove-file name="source/Subs-Stream.php" destination="$sourcedir"/>
+		<remove-file name="source/Stream.template.php" destination="$themedir"/>
+	</uninstall>
+</package-info>

+ 12 - 0
install.php

@@ -0,0 +1,12 @@
+<?php
+	// If SSI.php is in the same place as this file, and SMF isn't defined, this is being run standalone.
+	if(file_exists(dirname(__FILE__).'/SSI.php') && !defined('SMF')){
+		require_once(dirname(__FILE__) . '/SSI.php');
+	}
+	// Hmm... no SSI.php and no SMF?
+	}elseif (!defined('SMF')){
+		die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');
+	}
+	add_integration_function('integrate_pre_include', '$sourcedir/Subs-Stream.php');
+	add_integration_function('integrate_actions', 'Stream_add_hook');
+?>

+ 5 - 0
install.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
+<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
+	
+</modification>

+ 17 - 0
source/Stream.php

@@ -0,0 +1,17 @@
+<?php
+	if (!defined('SMF')){
+		die('Hacking attempt...');
+	}
+	function Stream(){
+		global $context, $smcFunc;
+		loadtemplate('Stream');
+	}
+	$context['page_title'] = $txt['Stream_PageTitle'];
+	$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title']));
+	$context['linktree'][] = array(
+  		'url' => $scripturl. '?action=stream',
+ 		'name' => $txt['Stream'],
+	);
+	$context['youraction_Head'] = $txt['Stream'];
+	$context['youraction_Body'] = 'Hello World';
+?>

+ 18 - 0
source/Stream.template.php

@@ -0,0 +1,18 @@
+<?php
+	function template_main(){
+		global $context;
+		echo '<div class="cat_bar">
+			<h3 class="catbg">',$context['youraction_Head'],'</h3>
+		</div>
+		<div class="windowbg2">
+			<span class="topslice">
+				<span></span>
+			</span>
+			<div class="content">',$context['youraction_Body'], '</div>
+			<span class="botslice">
+				<span></span>
+			</span>
+		</div>
+		<br />';
+	}
+?>

+ 8 - 0
source/Subs-Stream.php

@@ -0,0 +1,8 @@
+<?php
+	if(!defined('SMF')){
+		die('Hacking attempt...');
+	}
+	function youraction_add_hook(&$actionArray){
+		$actionArray['youraction'] = array('YourAction.php', 'YourActionMain');
+	}
+?>

+ 12 - 0
uninstall.php

@@ -0,0 +1,12 @@
+<?php
+	// If SSI.php is in the same place as this file, and SMF isn't defined, this is being run standalone.
+	if(file_exists(dirname(__FILE__).'/SSI.php') && !defined('SMF')){
+		require_once(dirname(__FILE__) . '/SSI.php');
+	}
+	// Hmm... no SSI.php and no SMF?
+	}elseif (!defined('SMF')){
+		die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');
+	}
+	remove_integration_function('integrate_pre_include', '$sourcedir/Subs-Stream.php');
+	remove_integration_function('integrate_actions', 'Stream_add_hook');
+?>