Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop: (279 commits)
  disabled plugin translator
  missing lng keys
  prepared Plugin-version for release
  [FIX] PLLV-64
  renamed conf::get
  fixed creation form
  plugin translator
  some basics
  fixed URL presentation
  fixed urls when accessing from sub directory
  possible fix for PLLV-54
  fixed modal in fullscreen
  fixed modal qr
  [FIX] PLLV-72
  [FIX] PLLV-63
  [FIX] PLLV-36
  [FIX] PLLV-65
  [FIX] PLLV-68
  [FIX] PLLV-71
  new qtype priorities
  ...
  • Loading branch information
chfsx committed Mar 2, 2016
2 parents f306396 + a44b17d commit 8f6809c
Show file tree
Hide file tree
Showing 880 changed files with 37,265 additions and 16,436 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.svn
path
164 changes: 0 additions & 164 deletions anonymous.php

This file was deleted.

8 changes: 0 additions & 8 deletions aspsms.php

This file was deleted.

192 changes: 192 additions & 0 deletions classes/Conf/class.xlvoConf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
<?php
require_once('./Services/ActiveRecord/class.ActiveRecord.php');
require_once('./Customizing/global/plugins/Services/Repository/RepositoryObject/LiveVoting/classes/Js/class.xlvoJs.php');

/**
* Class xlvoConf
*
* @author Fabian Schmid <[email protected]>
*/
class xlvoConf extends ActiveRecord {

const CONFIG_VERSION = 1;
const F_CONFIG_VERSION = 'config_version';
const F_ALLOW_FREEZE = 'allow_freeze';
const F_ALLOW_FULLSCREEN = 'allow_fullscreen';
const F_ALLOW_SHORTLINK = 'allow_shortlink';
const F_ALLOW_SHORTLINK_LINK = 'allow_shortlink_link';
const F_BASE_URL = 'base_url';
const F_ALLOW_GLOBAL_ANONYMOUS = 'global_anonymous';
const F_USE_QR = 'use_qr';
const REWRITE_RULE = "RewriteRule ^vote(/[\\w]*|) Customizing/global/plugins/Services/Repository/RepositoryObject/LiveVoting/pin.php?pin=$1 [L]";
const API_URL = './Customizing/global/plugins/Services/Repository/RepositoryObject/LiveVoting/classes/xlvoILIAS.php';


/**
* @return string
*/
public static function getShortLinkURL() {
if (self::getConfig(self::F_ALLOW_SHORTLINK)) {
$url = self::getConfig(self::F_ALLOW_SHORTLINK_LINK);
$url = rtrim($url, "/") . "/";
$url = str_replace("http://", '', $url);
$url = str_replace("https://", '', $url);

if (ilHTTPS::getInstance()->isDetected()) {
$url = 'https://' . $url;
} else {
$url = 'http://' . $url;
}
} else {
$url = ILIAS_HTTP_PATH . '/Customizing/global/plugins/Services/Repository/RepositoryObject/LiveVoting/pin.php?pin=';
}

return $url;
}


/**
* @return string
*/
public static function getBaseURL() {
if (self::getConfig(self::F_ALLOW_SHORTLINK)) {
$url = self::getConfig(self::F_BASE_URL);
$url = rtrim($url, "/") . "/";
} else {
$str = strstr(ILIAS_HTTP_PATH, 'Customizing', true);
$url = rtrim($str, "/") . "/";
}

return $url;
}


/**
* @return string
*/
public static function getFullApiURL() {
return self::getBaseURL() . ltrim(self::API_URL, "./");
}


/**
* @return string
* @description Return the Name of your Database Table
* @deprecated
*/
static function returnDbTableName() {
return 'xlvo_config';
}


/**
* @var array
*/
protected static $cache = array();
/**
* @var array
*/
protected static $cache_loaded = array();
/**
* @var bool
*/
protected $ar_safe_read = false;


/**
* @return bool
*/
public static function isConfigUpToDate() {
return self::getConfig(self::F_CONFIG_VERSION) == self::CONFIG_VERSION;
}


public static function load() {
$null = parent::get();
}


/**
* @param $name
*
* @return mixed
*/
public static function getConfig($name) {
if (!self::$cache_loaded[$name]) {
$obj = new self($name);
self::$cache[$name] = json_decode($obj->getValue());
self::$cache_loaded[$name] = true;
}

return self::$cache[$name];
}


/**
* @param $name
* @param $value
*/
public static function set($name, $value) {
$obj = new self($name);
$obj->setValue(json_encode($value));

if (self::where(array( 'name' => $name ))->hasSets()) {
$obj->update();
} else {
$obj->create();
}
}


/**
* @var string
*
* @db_has_field true
* @db_is_unique true
* @db_is_primary true
* @db_is_notnull true
* @db_fieldtype text
* @db_length 250
*/
protected $name;
/**
* @var string
*
* @db_has_field true
* @db_fieldtype text
* @db_length 4000
*/
protected $value;


/**
* @param string $name
*/
public function setName($name) {
$this->name = $name;
}


/**
* @return string
*/
public function getName() {
return $this->name;
}


/**
* @param string $value
*/
public function setValue($value) {
$this->value = $value;
}


/**
* @return string
*/
public function getValue() {
return $this->value;
}
}
Loading

0 comments on commit 8f6809c

Please sign in to comment.