mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
Global: add mobile theme support for dumbphones
By setting defaultFeaturePhoneTheme, you can enable very basic html theme for old phones, like Nokia 6680 or iPhone 3GS. I'm currently making this theme, but it would take a time to make it ofc
This commit is contained in:
parent
3f87bab3f2
commit
d8a8dd920a
1 changed files with 35 additions and 2 deletions
|
@ -284,10 +284,14 @@ abstract class OpenVKPresenter extends SimplePresenter
|
||||||
parent::onBeforeRender();
|
parent::onBeforeRender();
|
||||||
|
|
||||||
$whichbrowser = new WhichBrowser\Parser(getallheaders());
|
$whichbrowser = new WhichBrowser\Parser(getallheaders());
|
||||||
|
$featurephonetheme = OPENVK_ROOT_CONF["openvk"]["preferences"]["defaultFeaturePhoneTheme"];
|
||||||
$mobiletheme = OPENVK_ROOT_CONF["openvk"]["preferences"]["defaultMobileTheme"];
|
$mobiletheme = OPENVK_ROOT_CONF["openvk"]["preferences"]["defaultMobileTheme"];
|
||||||
if($mobiletheme && $whichbrowser->isType('mobile') && Session::i()->get("_tempTheme") == NULL)
|
|
||||||
|
if($featurephonetheme && $this->isOldThing($whichbrowser) && Session::i()->get("_tempTheme") == NULL) {
|
||||||
|
$this->setSessionTheme($featurephonetheme);
|
||||||
|
} elseif($mobiletheme && $whichbrowser->isType('mobile') && Session::i()->get("_tempTheme") == NULL)
|
||||||
$this->setSessionTheme($mobiletheme);
|
$this->setSessionTheme($mobiletheme);
|
||||||
|
|
||||||
$theme = NULL;
|
$theme = NULL;
|
||||||
if(Session::i()->get("_tempTheme")) {
|
if(Session::i()->get("_tempTheme")) {
|
||||||
$theme = Themepacks::i()[Session::i()->get("_tempTheme", "ovk")];
|
$theme = Themepacks::i()[Session::i()->get("_tempTheme", "ovk")];
|
||||||
|
@ -318,4 +322,33 @@ abstract class OpenVKPresenter extends SimplePresenter
|
||||||
header("Content-Length: $size");
|
header("Content-Length: $size");
|
||||||
exit($payload);
|
exit($payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function isOldThing($whichbrowser) {
|
||||||
|
if($whichbrowser->isOs('Series60') ||
|
||||||
|
$whichbrowser->isOs('Series40') ||
|
||||||
|
$whichbrowser->isOs('Series80') ||
|
||||||
|
$whichbrowser->isOs('Windows CE') ||
|
||||||
|
$whichbrowser->isOs('Windows Mobile') ||
|
||||||
|
$whichbrowser->isOs('Nokia Asha Platform') ||
|
||||||
|
$whichbrowser->isOs('UIQ') ||
|
||||||
|
$whichbrowser->isEngine('NetFront') || // PSP and other japanese portable systems
|
||||||
|
$whichbrowser->isOs('Android') ||
|
||||||
|
$whichbrowser->isOs('iOS') ||
|
||||||
|
$whichbrowser->isBrowser('Internet Explorer', '<=', '8')) {
|
||||||
|
// yeah, it's old, but ios and android are?
|
||||||
|
if($whichbrowser->isOs('iOS') && $whichbrowser->isOs('iOS', '<=', '9'))
|
||||||
|
return true;
|
||||||
|
elseif($whichbrowser->isOs('iOS') && $whichbrowser->isOs('iOS', '>', '9'))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if($whichbrowser->isOs('Android') && $whichbrowser->isOs('Android', '<=', '5'))
|
||||||
|
return true;
|
||||||
|
elseif($whichbrowser->isOs('Android') && $whichbrowser->isOs('Android', '>', '5'))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue