本文整理汇总了PHP中OW::getApplication方法的典型用法代码示例。如果您正苦于以下问题:PHP OW::getApplication方法的具体用法?PHP OW::getApplication怎么用?PHP OW::getApplication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OW
的用法示例。
在下文中一共展示了OW::getApplication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: browse
public function browse()
{
$categoryList = array();
$form = new Form('download_form');
$this->addForm($form);
$cmpCategories = new SPDOWNLOAD_CMP_Category();
$this->addComponent('cmpCategories', $cmpCategories);
$arraylabel = array('label_table_th1' => OW::getLanguage()->text('spdownload', 'label_table_th1'), 'label_table_th2' => OW::getLanguage()->text('spdownload', 'label_table_th2'), 'label_table_th3' => OW::getLanguage()->text('spdownload', 'label_table_th3'));
$files = null;
$arrayId = array();
if (empty($_GET['ct']) || !isset($_GET['ct'])) {
OW::getApplication()->redirect(OW::getRouter()->urlForRoute('spdownload.index'));
} else {
$arrayId = $_GET['ct'];
$files = SPDOWNLOAD_BOL_FileService::getInstance()->getFileCategoryIdList($arrayId);
$this->assign('arrayId', $arrayId);
}
$url = OW::getPluginManager()->getPlugin('spdownload')->getUserFilesUrl();
foreach ($files as $key => $value) {
$value->addedTime = date("Y-m-d H:i:s", $value->addedTime);
$nameImage = 'icon_small_' . $value->id . '.png';
$value->icon = $url . $nameImage;
}
$this->assign('files', $files);
$this->assign('arraylabel', $arraylabel);
}
示例2: run
public function run()
{
$config = OW::getConfig();
// check if uninstall is in progress
if (!$config->getValue('groups', 'uninstall_inprogress')) {
return;
}
if (!$config->configExists('groups', 'uninstall_cron_busy')) {
$config->addConfig('groups', 'uninstall_cron_busy', 0);
}
// check if cron queue is not busy
if ($config->getValue('groups', 'uninstall_cron_busy')) {
return;
}
$config->saveConfig('groups', 'uninstall_cron_busy', 1);
$service = GROUPS_BOL_Service::getInstance();
try {
$groups = $service->findLimitedList(self::GROUPS_DELETE_LIMIT);
if (empty($groups)) {
BOL_PluginService::getInstance()->uninstall('groups');
OW::getApplication()->setMaintenanceMode(false);
return;
}
foreach ($groups as $group) {
$service->deleteGroup($group->id);
}
$config->saveConfig('groups', 'uninstall_cron_busy', 0);
} catch (Exception $e) {
$config->saveConfig('groups', 'uninstall_cron_busy', 0);
throw $e;
}
}
示例3: __construct
/**
* Constructor.
*/
public function __construct()
{
parent::__construct();
if (OW::getApplication()->getContext() != OW_Application::CONTEXT_DESKTOP) {
throw new InterceptException(array(OW_RequestHandler::ATTRS_KEY_CTRL => 'BASE_MCTRL_BaseDocument', OW_RequestHandler::ATTRS_KEY_ACTION => 'notAvailable'));
}
if (!OW::getUser()->isAdmin()) {
throw new AuthenticateException();
}
if (!OW::getRequest()->isAjax()) {
$document = OW::getDocument();
$document->setMasterPage(new ADMIN_CLASS_MasterPage());
$this->setPageTitle(OW::getLanguage()->text('admin', 'page_default_title'));
}
BOL_PluginService::getInstance()->checkManualUpdates();
BOL_ThemeService::getInstance()->checkManualUpdates();
$plugin = BOL_PluginService::getInstance()->findNextManualUpdatePlugin();
$handlerParams = OW::getRequestHandler()->getHandlerAttributes();
// TODO refactor shortcut below
if (!defined('OW_PLUGIN_XP') && $plugin !== null) {
if ($handlerParams['controller'] === 'ADMIN_CTRL_Plugins' && $handlerParams['action'] === 'manualUpdateRequest') {
//action
} else {
throw new RedirectException(OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'manualUpdateRequest', array('key' => $plugin->getKey())));
}
}
// TODO temp admin pge inform event
function admin_check_if_admin_page()
{
return true;
}
OW::getEventManager()->bind('admin.check_if_admin_page', 'admin_check_if_admin_page');
}
示例4: redirectToDesktop
public function redirectToDesktop()
{
$urlToRedirect = OW::getRouter()->getBaseUrl();
if (!empty($_GET['back-uri'])) {
$urlToRedirect .= urldecode($_GET['back-uri']);
}
OW::getApplication()->redirect($urlToRedirect, OW::CONTEXT_DESKTOP);
}
示例5: index
public function index($params = array())
{
if (OW::getRequest()->isAjax()) {
exit;
}
if (!OW::getUser()->isAuthenticated()) {
throw new AuthenticateException();
}
$plugin = OW::getPluginManager()->getPlugin('blogs');
OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, 'blogs', 'main_menu_item');
$this->setPageHeading(OW::getLanguage()->text('blogs', 'save_page_heading'));
$this->setPageHeadingIconClass('ow_ic_write');
if (!OW::getUser()->isAuthorized('blogs', 'add')) {
$this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCtrlViewDir() . 'authorization_failed.html');
return;
}
$eventParams = array('pluginKey' => 'blogs', 'action' => 'add_blog');
$credits = OW::getEventManager()->call('usercredits.check_balance', $eventParams);
if ($credits === false) {
$this->assign('authMsg', OW::getEventManager()->call('usercredits.error_message', $eventParams));
return;
}
$this->assign('authMsg', null);
$id = empty($params['id']) ? 0 : $params['id'];
$service = PostService::getInstance();
/* @var $service PostService */
$tagService = BOL_TagService::getInstance();
if (intval($id) > 0) {
$post = $service->findById($id);
if ($post->authorId != OW::getUser()->getId() && !OW::getUser()->isAuthorized('blogs')) {
throw new Redirect404Exception();
}
$eventParams = array('action' => PostService::PRIVACY_ACTION_VIEW_BLOG_POSTS, 'ownerId' => $post->authorId);
$privacy = OW::getEventManager()->getInstance()->call('plugin.privacy.get_privacy', $eventParams);
if (!empty($privacy)) {
$post->setPrivacy($privacy);
}
} else {
$post = new Post();
$eventParams = array('action' => PostService::PRIVACY_ACTION_VIEW_BLOG_POSTS, 'ownerId' => OW::getUser()->getId());
$privacy = OW::getEventManager()->getInstance()->call('plugin.privacy.get_privacy', $eventParams);
if (!empty($privacy)) {
$post->setPrivacy($privacy);
}
$post->setAuthorId(OW::getUser()->getId());
}
$form = new SaveForm($post);
if (OW::getRequest()->isPost() && (!empty($_POST['command']) && in_array($_POST['command'], array('draft', 'publish'))) && $form->isValid($_POST)) {
$form->process($this);
OW::getApplication()->redirect(OW::getRouter()->urlForRoute('post-save-edit', array('id' => $post->getId())));
}
$this->addForm($form);
$this->assign('info', array('dto' => $post));
OW::getDocument()->setTitle(OW::getLanguage()->text('blogs', 'meta_title_new_blog_post'));
OW::getDocument()->setDescription(OW::getLanguage()->text('blogs', 'meta_description_new_blog_post'));
}
示例6: index
public function index()
{
if (!OW::getUser()->isAuthenticated()) {
throw new AuthenticateException();
}
$form = new BuyCreditsForm();
$this->addForm($form);
$creditService = USERCREDITS_BOL_CreditsService::getInstance();
if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
$values = $form->getValues();
$lang = OW::getLanguage();
$userId = OW::getUser()->getId();
$billingService = BOL_BillingService::getInstance();
if (empty($values['gateway']['url']) || empty($values['gateway']['key']) || !($gateway = $billingService->findGatewayByKey($values['gateway']['key']) || !$gateway->active)) {
OW::getFeedback()->error($lang->text('base', 'billing_gateway_not_found'));
$this->redirect();
}
if (!($pack = $creditService->findPackById($values['pack']))) {
OW::getFeedback()->error($lang->text('usercredits', 'pack_not_found'));
$this->redirect();
}
// create pack product adapter object
$productAdapter = new USERCREDITS_CLASS_UserCreditsPackProductAdapter();
// sale object
$sale = new BOL_BillingSale();
$sale->pluginKey = 'usercredits';
$sale->entityDescription = strip_tags($creditService->getPackTitle($pack->price, $pack->credits));
$sale->entityKey = $productAdapter->getProductKey();
$sale->entityId = $pack->id;
$sale->price = floatval($pack->price);
$sale->period = 30;
$sale->userId = $userId ? $userId : 0;
$sale->recurring = 0;
$saleId = $billingService->initSale($sale, $values['gateway']['key']);
if ($saleId) {
// sale Id is temporarily stored in session
$billingService->storeSaleInSession($saleId);
$billingService->setSessionBackUrl($productAdapter->getProductOrderUrl());
// redirect to gateway form page
OW::getApplication()->redirect($values['gateway']['url']);
}
}
$lang = OW::getLanguage();
$accountTypeId = $creditService->getUserAccountTypeId(OW::getUser()->getId());
$packs = $creditService->getPackList($accountTypeId);
$this->assign('packs', $packs);
$this->setPageHeading($lang->text('usercredits', 'buy_credits_page_heading'));
$this->setPageHeadingIconClass('ow_ic_user');
OW::getDocument()->setTitle($lang->text('usercredits', 'meta_title_buy_credits'));
OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, 'base', 'dashboard');
}
示例7: __construct
/**
* Constructor.
*/
public function __construct()
{
parent::__construct();
if (OW::getApplication()->getContext() != OW_Application::CONTEXT_DESKTOP) {
throw new InterceptException(array(OW_RequestHandler::ATTRS_KEY_CTRL => 'BASE_MCTRL_BaseDocument', OW_RequestHandler::ATTRS_KEY_ACTION => 'notAvailable'));
}
if (!OW::getUser()->isAdmin()) {
throw new AuthenticateException();
}
if (!OW::getRequest()->isAjax()) {
$document = OW::getDocument();
$document->setMasterPage(new ADMIN_CLASS_MasterPage());
$this->setPageTitle(OW::getLanguage()->text('admin', 'page_default_title'));
}
}
示例8: onAfterRout
public function onAfterRout(OW_Event $event)
{
$handlerAtr = OW::getRequestHandler()->getHandlerAttributes();
if ($handlerAtr['controller'] == 'BASE_CTRL_ComponentPanel' && $handlerAtr['action'] == 'profile') {
$profileUserName = empty($handlerAtr['params']['username']) ? false : $handlerAtr['params']['username'];
$profileUserId = BOL_UserService::getInstance()->findByUsername($profileUserName)->id;
$currentId = OW::getUser()->getId();
if ($profileUserId == $currentId) {
return;
}
$total = BOL_QuestionService::getInstance()->getQuestionData(array($profileUserId, $currentId), array('sex'));
if ($total[$profileUserId]['sex'] == $total[$currentId]['sex']) {
OW::getApplication()->redirect(OW::getRouter()->urlForRoute('not-for-your-sex', array('type' => $_POST['type'])));
}
}
}
示例9: init
public function init()
{
$configDev = (int) OW::getConfig()->getValue("base", self::CONFIG_NAME);
if ($configDev > 0) {
$this->refreshEntitiesCache($configDev);
OW::getConfig()->saveConfig("base", self::CONFIG_NAME, 0);
OW::getApplication()->redirect();
}
if (defined("OW_DEV_MODE") && OW_DEV_MODE) {
$this->refreshEntitiesCache(OW_DEV_MODE);
}
// show profiler only for desktop and if it's enabled
if (!OW::getApplication()->isDesktop() || OW::getRequest()->isAjax() || !OW_PROFILER_ENABLE) {
return;
}
OW_View::setCollectDevInfo(true);
OW::getEventManager()->setDevMode(true);
OW::getEventManager()->bind("base.append_markup", array($this, "onAppendMarkup"));
}
示例10: processCatchAllRequestsAttrs
/**
* Returns processed catch all requests attributes.
*
* @return string
*/
protected function processCatchAllRequestsAttrs()
{
if (empty($this->catchAllRequestsAttributes)) {
return null;
}
$catchRequest = true;
$lastKey = array_search(end($this->catchAllRequestsAttributes), $this->catchAllRequestsAttributes);
foreach ($this->catchAllRequestsExcludes[$lastKey] as $exclude) {
if ($exclude[self::CATCH_ALL_REQUEST_KEY_CTRL] == $this->handlerAttributes[self::ATTRS_KEY_CTRL]) {
if ($exclude[self::CATCH_ALL_REQUEST_KEY_ACTION] === null || $exclude[self::CATCH_ALL_REQUEST_KEY_ACTION] == $this->handlerAttributes[self::ATTRS_KEY_ACTION]) {
if ($exclude[self::CATCH_ALL_REQUEST_KEY_PARAMS] === null || $exclude[self::CATCH_ALL_REQUEST_KEY_PARAMS] == $this->handlerAttributes[self::ATTRS_KEY_VARLIST]) {
$catchRequest = false;
break;
}
}
}
}
if ($catchRequest) {
if (isset($this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_REDIRECT]) && (bool) $this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_REDIRECT]) {
$route = isset($this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_ROUTE]) ? trim($this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_ROUTE]) : null;
$params = isset($this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_PARAMS]) ? $this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_PARAMS] : array();
$redirectUrl = $route !== null ? OW::getRouter()->urlForRoute($route, $params) : OW::getRouter()->urlFor($this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_CTRL], $this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_ACTION], $params);
$redirectUrl = OW::getRequest()->buildUrlQueryString($redirectUrl, array('back_uri' => OW::getRequest()->getRequestUri()));
if (isset($this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_JS]) && (bool) $this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_JS]) {
// TODO resolve hotfix
// hotfix for splash screen + members only case
if (array_key_exists('base.members_only', $this->catchAllRequestsAttributes)) {
if (in_array($this->handlerAttributes[self::CATCH_ALL_REQUEST_KEY_CTRL], array('BASE_CTRL_User', 'BASE_MCTRL_User')) && $this->handlerAttributes[self::CATCH_ALL_REQUEST_KEY_ACTION] === 'standardSignIn') {
$backUri = isset($_GET['back_uri']) ? $_GET['back_uri'] : OW::getRequest()->getRequestUri();
OW::getDocument()->addOnloadScript("window.location = '" . OW::getRequest()->buildUrlQueryString($redirectUrl, array('back_uri' => $backUri)) . "'");
return null;
} else {
$ru = OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlForRoute('static_sign_in'), array('back_uri' => OW::getRequest()->getRequestUri()));
OW::getApplication()->redirect($ru);
}
}
OW::getDocument()->addOnloadScript("window.location = '" . $redirectUrl . "'");
return null;
}
UTIL_Url::redirect($redirectUrl);
}
return $this->getCatchAllRequestsAttributes($lastKey);
}
return null;
}
示例11: getDocumentKey
/**
* Returns document key for current page.
*
* @return string
*/
public function getDocumentKey()
{
return OW::getApplication()->getDocumentKey();
}
示例12: process
public function process()
{
$values = $this->getValues();
$lang = OW::getLanguage();
$userId = OW::getUser()->getId();
$billingService = BOL_BillingService::getInstance();
$membershipService = MEMBERSHIP_BOL_MembershipService::getInstance();
$url = OW::getRouter()->urlForRoute('membership_subscribe');
if (!($plan = $membershipService->findPlanById($values['plan']))) {
OW::getFeedback()->error($lang->text('membership', 'plan_not_found'));
OW::getApplication()->redirect($url);
}
if ($plan->price == 0) {
// trial plan
// check if trial plan used
$used = $membershipService->isTrialUsedByUser($userId);
if ($used) {
OW::getFeedback()->error($lang->text('membership', 'trial_used_error'));
OW::getApplication()->redirect($url);
} else {
// give trial plan
$userMembership = new MEMBERSHIP_BOL_MembershipUser();
$userMembership->userId = $userId;
$userMembership->typeId = $plan->typeId;
$userMembership->expirationStamp = time() + (int) $plan->period * 3600 * 24;
$userMembership->recurring = 0;
$userMembership->trial = 1;
$membershipService->setUserMembership($userMembership);
$membershipService->addTrialPlanUsage($userId, $plan->id, $plan->period);
OW::getFeedback()->info($lang->text('membership', 'trial_granted', array('days' => $plan->period)));
OW::getApplication()->redirect($url);
}
}
if (empty($values['gateway']['url']) || empty($values['gateway']['key'])) {
OW::getFeedback()->error($lang->text('base', 'billing_gateway_not_found'));
OW::getApplication()->redirect($url);
}
$gateway = $billingService->findGatewayByKey($values['gateway']['key']);
if (!$gateway || !$gateway->active) {
OW::getFeedback()->error($lang->text('base', 'billing_gateway_not_found'));
OW::getApplication()->redirect($url);
}
// create membership plan product adapter object
$productAdapter = new MEMBERSHIP_CLASS_MembershipPlanProductAdapter();
// sale object
$sale = new BOL_BillingSale();
$sale->pluginKey = 'membership';
$sale->entityDescription = $membershipService->getFormattedPlan($plan->price, $plan->period, $plan->recurring);
$sale->entityKey = $productAdapter->getProductKey();
$sale->entityId = $plan->id;
$sale->price = floatval($plan->price);
$sale->period = $plan->period;
$sale->userId = $userId ? $userId : 0;
$sale->recurring = $plan->recurring;
$saleId = $billingService->initSale($sale, $values['gateway']['key']);
if ($saleId) {
// sale Id is temporarily stored in session
$billingService->storeSaleInSession($saleId);
$billingService->setSessionBackUrl($productAdapter->getProductOrderUrl());
// redirect to gateway form page
OW::getApplication()->redirect($values['gateway']['url']);
}
}
示例13: check_user_activity
//.........这里部分代码省略.........
if ($test1 == "forgot-password" or $test1 == "/forgot-password") {
return;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
//if (OW::getConfig()->getValue('startpage', 'disable_startpage')=="1" AND !$id_user){
//OW::getDocument()->getMasterPage()->setTemplate(OW::getThemeManager()->getMasterPageTemplate(OW_MasterPage::TEMPLATE_BLANK));
//exit;
//echo OW::getRequest()->isPost()."|";
//return;
//session_destroy();
//print_r($_POST);print_r($_GET);print_r($_SESSION);
//echo $id_user;exit;
if ($id_user > 0) {
return;
} else {
if (OW::getRequest()->isPost()) {
if (isset($_SERVER['REQUEST_URI']) and strpos($_SERVER['REQUEST_URI'], "base/join/join-form-submit") !== false) {
OW::getApplication()->redirect($curent_url . "join");
exit;
} else {
if (OW::getConfig()->getValue('startpage', 'force_for_guest') == "1" and !$id_user) {
} else {
return;
}
}
} else {
if (!OW::getRequest()->isPost()) {
//echo "dfsdf";exit;
//print_r($_GET);
//print_r($_POST);
//print_r($_SESSION);exit;
//exit;
$test = str_replace($curent_url, "", $_SERVER['REQUEST_URI']);
if (strpos($test, "?language_id") !== false) {
return;
// OW::getApplication()->redirect($curent_url."join");
OW::getApplication()->redirect($curent_url . "start");
exit;
}
$test2_tmp = explode("?", $test);
if (isset($test2_tmp[0])) {
$test = $test2_tmp[0];
}
$test = str_replace("///", "/", $test);
$test = str_replace("//", "/", $test);
//echo "-----".$test;exit;
if (OW::getConfig()->getValue('startpage', 'force_for_guest') == "1" and !$id_user) {
} else {
if ($test != "/join" and $test != "/" and $test != "" and $test != "startx" and $test != "/startx" and $test != "startx/") {
return;
示例14: index
public function index($param)
{
if (!OW::getUser()->isAuthenticated()) {
exit;
}
$smile = "<img style=\"height: 20px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/smilies/smiley.gif\">";
$cool = "<img style=\"height: 20px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/smilies/smiley-cool.gif\">";
$confused = "<img style=\"height: 20px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/smilies/smiley-confused.gif\">";
$cry = "<img style=\"height: 20px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/smilies/smiley-cry.gif\">";
$lol = "<img style=\"height: 20px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/smilies/smiley-lol.gif\">";
$mad = "<img style=\"height: 20px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/smilies/smiley-mad.gif\">";
$neutral = "<img style=\"height: 20px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/smilies/smiley-neutral.gif\">";
$razz = "<img style=\"height: 20px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/smilies/smiley-razz.gif\">";
$sad = "<img style=\"height: 20px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/smilies/smiley-sad.gif\">";
$shock = "<img style=\"height: 20px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/smilies/smiley-surprise.gif\">";
$wink = "<img style=\"height: 20px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/smilies/smiley-wink.gif\">";
$thumbsup = "<img style=\"height: 61px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugin/chatrooms/smilies/cool.gif\">";
$bash = "<img style=\"height: 20px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/smilies/smiley-bash.gif\">";
$censored = "<img style=\"height: 20px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/smilies/smiley-censored.gif\">";
$santa = "<img style=\"height: 20px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/smilies/smiley-santa.gif\">";
$shy = "<img style=\"height: 20px; width: 20px;\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/smilies/smiley-shy.gif\">";
$content = "";
$is_admin = false;
if (OW::getUser()->isAdmin()) {
$is_admin = true;
$content .= "<script type=\"text/javascript\" src=\"" . OW_URL_HOME . "ow_static/plugins/chatrooms/jquery.contextmenu.js\"></script>";
}
$no_avatar = OW_URL_HOME . "ow_static/themes/" . OW::getConfig()->getValue('base', 'selectedTheme') . "/images/no-avatar.png";
$user = OW::getUser()->getId();
$user_service = BOL_UserService::getInstance();
$avat_service = BOL_AvatarService::getInstance();
$chats = "";
$chat_id = $param['chat'];
if ($chat_id == "" or $chat_id <= 0 or $chat_id >= 6 or !is_numeric($chat_id)) {
$chat_id = 1;
}
//check for blocked status
$now = time();
$sql = "SELECT block_id,reason FROM " . OW_DB_PREFIX . "superfeed_user_blocked WHERE user_id='{$user}' AND (room_id = '{$chat_id}' OR room_id = '*') LIMIT 1";
$query_data = OW::getDbo()->queryForList($sql);
$data = $query_data[0];
$block = $data['block_id'];
$reason = $data['reason'];
if ($block != "" or $reason != "") {
$info = "You have been blocked from live chat (reason: {$reason})";
OW::getFeedback()->warning($info);
OW::getApplication()->redirect(OW_URL_HOME);
exit;
}
// GET LATEST CHAT COMMENTS
$sql = "SHOW TABLE STATUS WHERE `Name` = '" . OW_DB_PREFIX . "super_feed_message'";
$query_data = OW::getDbo()->queryForList($sql);
$latest = $query_data[0]['Auto_increment'];
$now = time();
$sql = "DELETE FROM " . OW_DB_PREFIX . "superfeed_chat_users WHERE userId='{$user}' LIMIT 1;\n INSERT INTO " . OW_DB_PREFIX . "superfeed_chat_users VALUES(null,'{$user}','{$chat_id}','{$now}');\n ";
OW::getDbo()->query($sql);
$displayname = $user_service->getDisplayName($user);
$now = time();
$msg = "{$displayname} has joined the room!";
$sql = "INSERT INTO " . OW_DB_PREFIX . "super_feed_message VALUES(null,'{$chat_id}','{$user}','{$msg}', {$now},'userjoin')";
OW::getDbo()->insert($sql);
// END GET LATEST CHAT COMMENTS
// GET PEOPLE IN CHAT
$totpeople = "";
$users_in_chat = "";
$then = strtotime("-2 Minute");
$sql = "SELECT userId FROM " . OW_DB_PREFIX . "superfeed_chat_users WHERE chatId='{$chat_id}' AND LastUpdate >= {$then}";
$query_data = OW::getDbo()->queryForList($sql);
foreach ($query_data as $users) {
$totpeople = intval($totpeople) + 1;
//added to get total chatters
$userIdx = $users['userId'];
$displayname = $user_service->getDisplayName($userIdx);
$displayimage = $avat_service->getAvatarUrl($userIdx);
if (!$displayimage) {
$displayimage = $no_avatar;
}
$users_in_chat .= "\n <div style=\"padding-bottom:5px;\"><img style=\"width:24px;height:24px;vertical-align:middle\" src=\"{$displayimage}\"> <span id=\"{$userIdx}\" class=\"userblock\" style=\"\">{$displayname}</span></div>\n ";
}
// END GET PEOPLE IN CHAT
if ($latest == "") {
$latest = 0;
}
$s1 = "";
$s2 = "";
$s3 = "";
$s4 = "";
$s5 = "";
$title1 = OW::getConfig()->getValue('chatrooms', 'chat_1_title');
if ($title1 == "") {
$title1 = "Chat 1";
}
$title2 = OW::getConfig()->getValue('chatrooms', 'chat_2_title');
if ($title2 == "") {
$title2 = "Chat 2";
}
$title3 = OW::getConfig()->getValue('chatrooms', 'chat_3_title');
if ($title3 == "") {
$title3 = "Chat 3";
}
//.........这里部分代码省略.........
示例15: uninstall
public function uninstall()
{
$config = OW::getConfig();
if (!$config->configExists('groups', 'uninstall_inprogress')) {
$config->addConfig('groups', 'uninstall_inprogress', 0);
}
if (isset($_POST['action']) && $_POST['action'] == 'delete_content') {
$config->saveConfig('groups', 'uninstall_inprogress', 1);
OW::getFeedback()->info(OW::getLanguage()->text('groups', 'plugin_set_for_uninstall'));
OW::getApplication()->setMaintenanceMode(true);
$this->redirect();
}
$this->setPageHeading(OW::getLanguage()->text('groups', 'page_title_uninstall'));
$this->setPageHeadingIconClass('ow_ic_delete');
$inprogress = $config->getValue('groups', 'uninstall_inprogress');
$this->assign('inprogress', $inprogress);
$js = new UTIL_JsGenerator();
$js->jQueryEvent('#btn-delete-content', 'click', 'if ( !confirm("' . OW::getLanguage()->text('groups', 'confirm_delete_groups') . '") ) return false;');
OW::getDocument()->addOnloadScript($js);
}