Compare commits
	
		
			16 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						ad5d8afcc6
	
				 | 
					
					
						|||
| 
						
						
							
						
						f57edf60c1
	
				 | 
					
					
						|||
| a29d3fe803 | |||
| 8bcadd1d2d | |||
| 8a82e2795c | |||
| 4ee8b73044 | |||
| 6580cfe546 | |||
| 
						
						
							
						
						a0f9e71d46
	
				 | 
					
					
						|||
| 6e4a79ed3d | |||
| ce99b309f8 | |||
| 37445f42b5 | |||
| 9717c11af5 | |||
| 2cab4df4b1 | |||
| 18c8426246 | |||
| 
						
						
							
						
						4890a0af04
	
				 | 
					
					
						|||
| 7bf2c31db3 | 
							
								
								
									
										975
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										975
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -33,9 +33,5 @@
 | 
			
		||||
    devShells = forAllSystems (system: pkgs: {
 | 
			
		||||
      default = pkgs.callPackage ./nix/shell.nix { inherit pkgs; };
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    # TODO:
 | 
			
		||||
    # - Relicense the project to GPL or something
 | 
			
		||||
    # - Write a module for the project
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -24,9 +24,9 @@ use \pvv\side\Agenda;
 | 
			
		||||
$agenda = new \pvv\side\Agenda([
 | 
			
		||||
  // new \pvv\side\social\NerdepitsaActivity,
 | 
			
		||||
  // new \pvv\side\social\AnimekveldActivity,
 | 
			
		||||
  new \pvv\side\social\HackekveldActivity,
 | 
			
		||||
  new \pvv\side\social\BrettspillActivity,
 | 
			
		||||
  new \pvv\side\social\DriftkveldActivity,
 | 
			
		||||
  // new \pvv\side\social\HackekveldActivity,
 | 
			
		||||
  // new \pvv\side\social\BrettspillActivity,
 | 
			
		||||
  // new \pvv\side\social\DriftkveldActivity,
 | 
			
		||||
  new \pvv\side\DBActivity($pdo),
 | 
			
		||||
]);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -20,6 +20,10 @@ pkgs.mkShellNoCC {
 | 
			
		||||
    test -e config.php || cp -v dist/config.local.php config.php
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    if [ ! -d www/galleri/bilder/slideshow ] ; then
 | 
			
		||||
      mkdir -p www/galleri/bilder/slideshow
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if [ ! -d vendor ] ; then
 | 
			
		||||
      composer install || exit $?
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,8 @@ use \DateInterval;
 | 
			
		||||
 | 
			
		||||
class Agenda {
 | 
			
		||||
 | 
			
		||||
  private $activities;
 | 
			
		||||
 | 
			
		||||
	const TODAY = 0;
 | 
			
		||||
	const TOMORROW = 1;
 | 
			
		||||
	const THIS_WEEK = 2;
 | 
			
		||||
@@ -18,7 +20,7 @@ class Agenda {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    public static function getFormattedDate($date) {
 | 
			
		||||
       return trim(strftime('%A %e. %b %H.%M', $date->getTimeStamp()));
 | 
			
		||||
       return $date->format("l j. M H.i");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public function getEventsBetween(DateTimeImmutable $from, DateTimeImmutable $to) {
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,7 @@ use \DateTimeImmutable;
 | 
			
		||||
use \PDO;
 | 
			
		||||
 | 
			
		||||
class DBActivity implements Activity {
 | 
			
		||||
  private $pdo;
 | 
			
		||||
 | 
			
		||||
	public function __construct(PDO $pdo) {
 | 
			
		||||
		$this->pdo = $pdo;
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ abstract class Event {
 | 
			
		||||
			return 'i morgen';
 | 
			
		||||
		}
 | 
			
		||||
		if (Agenda::isThisWeek($this->getStart()) || $this->getStart()->sub(new DateInterval('P4D'))->getTimestamp() < time()) {
 | 
			
		||||
			return strftime('%A', $this->getStart()->getTimestamp());
 | 
			
		||||
			return $this->getStart()->format("l");
 | 
			
		||||
		}
 | 
			
		||||
		if (Agenda::isNextWeek($this->getStart())) {
 | 
			
		||||
			return 'neste uke';
 | 
			
		||||
@@ -32,7 +32,7 @@ abstract class Event {
 | 
			
		||||
		if (Agenda::isThisMonth($this->getStart())) {
 | 
			
		||||
			return 'denne måneden';
 | 
			
		||||
		}
 | 
			
		||||
		return trim(strftime('%e. %B', $this->getStart()->getTimestamp()));
 | 
			
		||||
		return $this->getStart()->format("j. F");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public abstract function getStop(); /* : DateTimeImmutable */
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ class SimpleEvent extends Event {
 | 
			
		||||
 | 
			
		||||
	private $id, $name, $descr, $start, $end, $org, $loc;
 | 
			
		||||
 | 
			
		||||
	public function __construct($id, $name,\DateTimeImmutable $start,\DateTimeImmutable $end,$org, $loc, $descr, $isDBEvent = false){
 | 
			
		||||
	public function __construct($id, $name,\DateTimeImmutable $start,\DateTimeImmutable $end,$org, $loc, $descr, $_isDBEvent = false){
 | 
			
		||||
		$this->id = $id;
 | 
			
		||||
		$this->name = $name;
 | 
			
		||||
		$this->start = $start;
 | 
			
		||||
@@ -13,7 +13,6 @@ class SimpleEvent extends Event {
 | 
			
		||||
		$this->org = $org;
 | 
			
		||||
		$this->loc = $loc;
 | 
			
		||||
		$this->descr = explode("\n", $descr);
 | 
			
		||||
		$this->isDBEvent = $isDBEvent;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function getID(){
 | 
			
		||||
@@ -52,10 +51,6 @@ class SimpleEvent extends Event {
 | 
			
		||||
		return $this->descr;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function isDBEvent() {
 | 
			
		||||
		return $this->isDBEvent;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function getColor() {
 | 
			
		||||
		return "#3b7";
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,6 @@ class AnimekveldEvent extends Event {
 | 
			
		||||
			'',
 | 
			
		||||
			'Alle kan være med på å anbefale eller veto serier.',
 | 
			
		||||
			'',
 | 
			
		||||
			'I disse tider blir visningene i all hovedsak holdt online på vår <a href="https://discord.gg/cx4aXU7">Discord server</a>'
 | 
			
		||||
			];
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -105,7 +105,7 @@ else {
 | 
			
		||||
				</div>
 | 
			
		||||
 | 
			
		||||
				<p class="subtitle">Beskrivelse (<i>markdown</i>)</p>
 | 
			
		||||
				<textarea name="desc" rows="8" class="boxinput" placeholder="Beskrivese" required><?= implode($event->getDescription(), "\n"); ?></textarea>
 | 
			
		||||
				<textarea name="desc" rows="8" class="boxinput" placeholder="Beskrivelse" required><?= implode("\n", $event->getDescription()); ?></textarea>
 | 
			
		||||
				
 | 
			
		||||
				
 | 
			
		||||
			</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -93,7 +93,7 @@ foreach($members as $i => $data){
 | 
			
		||||
				<?= '<input type="text" name="title" value="' . $project->getName() . '" class="boxinput">' ?><br>
 | 
			
		||||
 | 
			
		||||
				<p class="subtitle">Beskrivelse (<i>markdown</i>)</p>
 | 
			
		||||
				<textarea name="desc" cols="40" rows="5" class="boxinput"><?= implode($project->getDescription(), "\n"); ?></textarea>
 | 
			
		||||
				<textarea name="desc" cols="40" rows="5" class="boxinput"><?= implode("\n", $project->getDescription()); ?></textarea>
 | 
			
		||||
			</div>
 | 
			
		||||
 | 
			
		||||
			<div class="gridr noborder">
 | 
			
		||||
 
 | 
			
		||||
@@ -65,39 +65,23 @@ img.float-right {
 | 
			
		||||
    list-style: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.calendar-events ul li :not(.date):not(.time) {
 | 
			
		||||
    display: inline-block;
 | 
			
		||||
    width: calc(100% - 7em);
 | 
			
		||||
    white-space: nowrap;
 | 
			
		||||
    overflow: hidden;
 | 
			
		||||
    text-overflow: ellipsis;
 | 
			
		||||
}
 | 
			
		||||
.calendar-events ul .date {
 | 
			
		||||
    color: rgba(0, 0, 0, 0.5);
 | 
			
		||||
    font-size: 0.8em;
 | 
			
		||||
    margin-top: 0.2em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.calendar-events > li > p {
 | 
			
		||||
    border-bottom: 0.1em dotted rgba(0, 0, 0, 0.2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.calendar-events ul {
 | 
			
		||||
    list-style: none;
 | 
			
		||||
    padding: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.calendar-events a,
 | 
			
		||||
 | 
			
		||||
.calendar-events ul .time {
 | 
			
		||||
    color: rgba(0, 0, 0, 0.5);
 | 
			
		||||
    float: right;
 | 
			
		||||
.calendar-events a {
 | 
			
		||||
    color: rgba(0,0,0, 0.85);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.calendar-events ul .icon,
 | 
			
		||||
.calendar-events ul .date {
 | 
			
		||||
.calendar-events ul .datetime {
 | 
			
		||||
    color: rgba(0, 0, 0, 0.5);
 | 
			
		||||
    float: right;
 | 
			
		||||
    margin-right: 0.5em;
 | 
			
		||||
    margin-left: 0.2em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.calendar-events ul li {
 | 
			
		||||
    margin-bottom: 0.4em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
main.contentsplit {
 | 
			
		||||
 
 | 
			
		||||
@@ -77,18 +77,20 @@ $doorTime = date("H:i", $doorEntry->time);
 | 
			
		||||
							<?php } else { ?>
 | 
			
		||||
								<strong><?= $event->getName(); ?></strong>
 | 
			
		||||
							<?php } ?>
 | 
			
		||||
							<?php /* <a class="icon subscribe">+</a> */ ?>
 | 
			
		||||
							<?php if ($period !== \pvv\side\Agenda::TODAY) {
 | 
			
		||||
								echo '<span class="time">' . $event->getStart()->format('H:i') . '</span>';
 | 
			
		||||
								if (\pvv\side\Agenda::isThisWeek($event->getStart()) || $event->getStart()->sub(new DateInterval('P3D'))->getTimestamp() < time()) {
 | 
			
		||||
									echo '<span class="date">' . strftime('%a', $event->getStart()->getTimestamp()) . '</span>';
 | 
			
		||||
								} else {
 | 
			
		||||
									echo '<span class="date">' . strftime('%e. %b', $event->getStart()->getTimestamp()) . '</span>';
 | 
			
		||||
								}
 | 
			
		||||
							} else {
 | 
			
		||||
								echo '<span class="time">' . $event->getStart()->format('H:i') . '</span>';
 | 
			
		||||
							}
 | 
			
		||||
							?>
 | 
			
		||||
 | 
			
		||||
                            <span class="datetime">
 | 
			
		||||
                            <?php if ($period !== \pvv\side\Agenda::TODAY) {
 | 
			
		||||
                                echo $event->getStart()->format('H:i') . " " ;
 | 
			
		||||
                                if (\pvv\side\Agenda::isThisWeek($event->getStart()) || $event->getStart()->sub(new DateInterval('P3D'))->getTimestamp() < time()) {
 | 
			
		||||
                                    echo $event->getStart()->format('D');
 | 
			
		||||
                                } else {
 | 
			
		||||
                                    echo $event->getStart()->format('j. F');
 | 
			
		||||
                                }
 | 
			
		||||
                            } else {
 | 
			
		||||
                                echo $event->getStart()->format('H:i');
 | 
			
		||||
                            }
 | 
			
		||||
                            ?>
 | 
			
		||||
                            </span>
 | 
			
		||||
						</li>
 | 
			
		||||
						<?php } ?>
 | 
			
		||||
					</ul>
 | 
			
		||||
@@ -108,7 +110,7 @@ $doorTime = date("H:i", $doorEntry->time);
 | 
			
		||||
					echo $title;
 | 
			
		||||
				}
 | 
			
		||||
				echo "</h1>";
 | 
			
		||||
				
 | 
			
		||||
 | 
			
		||||
				$Parsedown = new Parsedown();
 | 
			
		||||
				echo $Parsedown->text(implode("\n", $motd["content"]));
 | 
			
		||||
			?>
 | 
			
		||||
 
 | 
			
		||||
@@ -43,11 +43,11 @@ require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc'
 | 
			
		||||
 | 
			
		||||
		<p>Vi har en <a href="http://list.pvv.org/mailman/listinfo/aktive">e-postliste for aktive medlemmer</a>. All offisiell informasjon blir sendt på denne listen, og alle arrengementer blir også annonsert her.</p>
 | 
			
		||||
 | 
			
		||||
		<p>Vi har en <a target="_blank" href="https://matrix.to/#/#pvv:pvv.ntnu.no">Matrix-server</a> for chat, memes, og all annen kommunikasjon. Den er bridget med IRC-kanalen og Discord-guilden vår. Hvis du er medlem kan du bruke vår <a href="https://chat.pvv.ntnu.no">self-hosted web client</a>.</p>
 | 
			
		||||
		<p>Vi har et <a target="_blank" href="https://matrix.to/#/#pvv:pvv.ntnu.no">Matrix Space™</a> for chat, memes, og all annen kommunikasjon. Den er bridget med IRC-kanalen og Discord-serveren vår. Hvis du er medlem kan du bruke vår egen instans av <a href="https://chat.pvv.ntnu.no">Element web</a>.</p>
 | 
			
		||||
		
 | 
			
		||||
		<p>Vi har en IRC-kanal på <a href="http://webchat.ircnet.net/">IRCnet</a> kalt #pvv.</p>
 | 
			
		||||
 | 
			
		||||
		<p>Vi har en <a target="_blank" href="https://discord.gg/8VTBr6Q">Discord-guild</a> for de som foretrekker Discord over Matrix. </p>
 | 
			
		||||
		<p>Vi har en <a target="_blank" href="https://discord.gg/8VTBr6Q">Discord-server</a> for de som foretrekker Discord over Matrix. </p>
 | 
			
		||||
 | 
			
		||||
	</main>
 | 
			
		||||
</body>
 | 
			
		||||
 
 | 
			
		||||
@@ -79,7 +79,7 @@ if($new == 0){
 | 
			
		||||
			<p class="subtitle no-chin">Beskrivelse (<i style="opacity:0.5;">markdown</i>)</p>
 | 
			
		||||
			<p class="subnote no-chin">Hva går prosjektet ditt ut på?</p>
 | 
			
		||||
			<p class="subnote">De første to linjene blir vist på prosjektkortet, prøv å gjøre de til et fint sammendrag eller intro!</p>
 | 
			
		||||
			<textarea class="tall" name="desc" style="width:100%" rows="8" class="boxinput"><?= implode($project->getDescription(), "\n"); ?></textarea>
 | 
			
		||||
			<textarea class="tall" name="desc" style="width:100%" rows="8" class="boxinput"><?= implode("\n", $project->getDescription()); ?></textarea>
 | 
			
		||||
 | 
			
		||||
			<?= '<input type="hidden" name="id" value="' . $project->getID() . '" />' ?>
 | 
			
		||||
			<input type="hidden" name="active" value="1"/>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										71
									
								
								www/spaceapi.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								www/spaceapi.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,71 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
 | 
			
		||||
 | 
			
		||||
header('Content-Type: application/json');
 | 
			
		||||
header('Access-Control-Allow-Origin: *');
 | 
			
		||||
 | 
			
		||||
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
 | 
			
		||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 | 
			
		||||
 | 
			
		||||
$door = new \pvv\side\Door($pdo);
 | 
			
		||||
$doorEntry = (object)($door->getCurrent());
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
{
 | 
			
		||||
  "api_compatibility": ["14"],
 | 
			
		||||
  "space": "Programvareverkstedet",
 | 
			
		||||
  "logo": "https://git.pvv.ntnu.no/assets/img/logo.png",
 | 
			
		||||
  "url": "https://www.pvv.ntnu.no/",
 | 
			
		||||
  "location": {
 | 
			
		||||
    "ext_campus": "NTNU Gløshaugen",
 | 
			
		||||
    "ext_room_name": "Oppredning/Gruvedrift, Floor 2, Room 247",
 | 
			
		||||
    "ext_mazemap": "https://link.mazemap.com/2n2HWa7H",
 | 
			
		||||
    "address": "Sem Sælands vei 1, 7034 Trondheim, Norway",
 | 
			
		||||
    "timezone": "Europe/Oslo",
 | 
			
		||||
    "lon": 10.4063852,
 | 
			
		||||
    "lat": 63.4170226
 | 
			
		||||
  },
 | 
			
		||||
  "contact": {
 | 
			
		||||
    "irc": "irc://irc.pvv.ntnu.no/pvv",
 | 
			
		||||
    "email": "pvv@pvv.ntnu.no",
 | 
			
		||||
    "ext_discord": "https://discord.gg/8VTBr6Q",
 | 
			
		||||
    "gopher": "gopher://isvegg.pvv.ntnu.no",
 | 
			
		||||
    "matrix": "#pvv:pvv.ntnu.no"
 | 
			
		||||
  },
 | 
			
		||||
  "issue_report_channels": ["email"],
 | 
			
		||||
  "state": {
 | 
			
		||||
    "open": <?php echo($doorEntry->open ? "true" : "false"); ?>,
 | 
			
		||||
    "lastchange": <?php echo($doorEntry->time ? $doorEntry->time : 0); ?>,
 | 
			
		||||
    "message": "<?php echo($doorEntry->open ? "open for public, members are present" : "closed"); ?>"
 | 
			
		||||
  },
 | 
			
		||||
  "feeds": {
 | 
			
		||||
    "wiki": {
 | 
			
		||||
      "type": "atom",
 | 
			
		||||
      "url": "https://wiki.pvv.ntnu.no/w/api.php?hidebots=1&urlversion=1&action=feedrecentchanges&feedformat=atom"
 | 
			
		||||
    },
 | 
			
		||||
    "calendar": {
 | 
			
		||||
      "type": "html",
 | 
			
		||||
      "url": "https://www.pvv.ntnu.no/hendelser/"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "projects": [
 | 
			
		||||
    "https://github.com/Programvareverkstedet/",
 | 
			
		||||
    "https://git.pvv.ntnu.no/",
 | 
			
		||||
    "https://www.pvv.ntnu.no/prosjekt/"
 | 
			
		||||
  ],
 | 
			
		||||
  "links": [
 | 
			
		||||
    {
 | 
			
		||||
      "name": "YouTube",
 | 
			
		||||
      "url": "https://www.youtube.com/@pvvntnu5640"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "LinkedIn",
 | 
			
		||||
      "url": "https://www.linkedin.com/company/pvvntnu/"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "Facebook",
 | 
			
		||||
      "url": "https://www.facebook.com/pvvntnu/"
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user