Example #1
0
 public function findUsers($groupId, $count, $withPhoto = true)
 {
     $userTable = BOL_UserDao::getInstance()->getTableName();
     $avatarJoin = !$withPhoto ? '' : "INNER JOIN `" . BOL_AvatarDao::getInstance()->getTableName() . "` as `a`\n    \t\t\tON( `u`.`id` = `a`.`userId` )";
     $query = "\n            SELECT `u`.* FROM `{$userTable}` AS `u`\n\n            INNER JOIN `" . GROUPS_BOL_GroupUserDao::getInstance()->getTableName() . "` AS `g`\n                    ON( `u`.`id` = `g`.`userId` )\n\n            LEFT JOIN `" . BOL_UserSuspendDao::getInstance()->getTableName() . "` as `s`\n                    ON( `u`.`id` = `s`.`userId` )\n\n            LEFT JOIN `" . BOL_UserApproveDao::getInstance()->getTableName() . "` as `d`\n                    ON( `u`.`id` = `d`.`userId` )\n\n            {$avatarJoin}\n\n            WHERE g.groupId=:g AND `s`.`id` IS NULL AND `d`.`id` IS NULL\n            ORDER BY `u`.`activityStamp` DESC\n            LIMIT :ls, :le";
     return OW::getDbo()->queryForObjectList($query, BOL_UserDao::getInstance()->getDtoClassName(), array('ls' => 0, 'le' => $count, 'g' => $groupId));
 }
Example #2
0
 /**
  * Application init actions.
  */
 public function init()
 {
     //        $this->urlHostRedirect();
     //        //printVar(10);exit;
     $this->userAutoLogin();
     // setting default time zone
     date_default_timezone_set(OW::getConfig()->getValue('base', 'site_timezone'));
     //        OW::getRequestHandler()->setIndexPageAttributes('BASE_CTRL_ComponentPanel');
     //        OW::getRequestHandler()->setStaticPageAttributes('BASE_CTRL_StaticDocument');
     //
     //        // router init - need to set current page uri and base url
     $router = OW::getRouter();
     $router->setBaseUrl(OW_URL_HOME . 'api/');
     $uri = OW::getRequest()->getRequestUri();
     // before setting in router need to remove get params
     if (strstr($uri, '?')) {
         $uri = substr($uri, 0, strpos($uri, '?'));
     }
     $router->setUri($uri);
     $router->setDefaultRoute(new OW_ApiDefaultRoute());
     $beckend = OW::getEventManager()->call('base.cache_backend_init');
     if ($beckend !== null) {
         OW::getCacheManager()->setCacheBackend($beckend);
         OW::getCacheManager()->setLifetime(3600);
         OW::getDbo()->setUseCashe(true);
     }
     OW::getResponse()->setDocument($this->newDocument());
 }
Example #3
0
 public function import($params)
 {
     $importDir = $params['importDir'];
     $sqlFile = $importDir . 'configs.sql';
     //import configs
     if (file_exists($sqlFile)) {
         DATAIMPORTER_BOL_ImportService::getInstance()->sqlImport($sqlFile);
     }
     $configFile = $importDir . 'config.txt';
     $string = file_get_contents($configFile);
     $this->configs = json_decode($string, true);
     $this->importAvatars($this->configs['avatarUrl']);
     $this->importTheme($importDir);
     $this->importMediaPanelFiles();
     if (OW::getPluginManager()->getPlugin('dataimporter')) {
         if (file_exists(OW::getPluginManager()->getPlugin('dataimporter')->getRootDir() . 'langs.zip')) {
             OW::getLanguage()->importPluginLangs(OW::getPluginManager()->getPlugin('dataimporter')->getRootDir() . 'langs.zip', 'dataimporter');
         }
     }
     $languageId = OW::getLanguage()->getCurrentId();
     BOL_LanguageService::getInstance()->generateCache($languageId);
     OW::getDbo()->query("TRUNCATE " . OW_DB_PREFIX . 'base_component_place_cache');
     //TODO: Use service function
     // ADD MENU ITEMS add plugin and add theme
     try {
         OW::getDbo()->query("INSERT IGNORE INTO `" . OW_DB_PREFIX . "base_menu_item` ( `prefix`, `key`, `documentKey`, `type`, `order`, `routePath`, `externalUrl`, `newWindow`, `visibleFor`) VALUES ( 'admin', 'sidebar_menu_plugins_add', '', 'admin_plugins', 3, 'admin_plugins_add', NULL, 0, 2) ");
     } catch (Exception $ex) {
     }
     try {
         OW::getDbo()->query("INSERT IGNORE INTO `" . OW_DB_PREFIX . "base_menu_item` ( `prefix`, `key`, `documentKey`, `type`, `order`, `routePath`, `externalUrl`, `newWindow`, `visibleFor`) VALUES ( 'admin', 'sidebar_menu_themes_add', '', 'admin_appearance', 3, 'admin_themes_add_new', NULL, 0, 3) ");
     } catch (Exception $ex) {
     }
 }
Example #4
0
 public function saveToplink(TOPLINK_BOL_Toplink $toplinkitems, $permission = null)
 {
     TOPLINK_BOL_ToplinkDao::getInstance()->save($toplinkitems);
     if (!empty($toplinkitems->id)) {
         $newId = OW::getDbo()->getInsertId();
         //print_r( $toplinkitems );
     }
     $example = new OW_EXAMPLE();
     $example->andFieldEqual('itemid', $toplinkitems->id);
     $listOfItem = TOPLINK_BOL_ToplinkPermissionDao::getInstance()->findListByExample($example);
     if (!empty($listOfItem)) {
         if (!empty($permission)) {
             //get saved permission
             foreach ($listOfItem as $permissionObj) {
                 $visibleFor[$permissionObj->id] = $permissionObj->availablefor;
             }
             //if perm item is reduced, remove also from table
             $removeInstalled = array_diff($visibleFor, $permission);
             if (!empty($removeInstalled)) {
                 foreach ($removeInstalled as $id => $myperm) {
                     TOPLINK_BOL_ToplinkPermissionDao::getInstance()->deleteById($id);
                 }
             }
             //if perm is added, add also into table
             $installNew = array_diff($permission, $visibleFor);
             if (!empty($installNew)) {
                 foreach ($installNew as $id) {
                     $toplinkPermission = new TOPLINK_BOL_ToplinkPermission();
                     $toplinkPermission->itemid = $toplinkitems->id;
                     $toplinkPermission->availablefor = $id;
                     TOPLINK_BOL_ToplinkPermissionDao::getInstance()->save($toplinkPermission);
                 }
             }
         } else {
             //if permission is not provided, remove except for admin
             foreach ($listOfItem as $permissionObj) {
                 if ($permissionObj->availablefor != 1) {
                     TOPLINK_BOL_ToplinkPermissionDao::getInstance()->deleteById($permissionObj->availablefor);
                 }
             }
         }
     } else {
         if (!empty($permission)) {
             //if no perm found in table, add allow to admin
             foreach ($permission as $perm) {
                 $toplinkPermission = new TOPLINK_BOL_ToplinkPermission();
                 $toplinkPermission->itemid = $toplinkitems->id;
                 $toplinkPermission->availablefor = $perm;
                 TOPLINK_BOL_ToplinkPermissionDao::getInstance()->save($toplinkPermission);
             }
         } else {
             //if no perm found in table, add allow to admin
             $toplinkPermission = new TOPLINK_BOL_ToplinkPermission();
             $toplinkPermission->itemid = $toplinkitems->id;
             $toplinkPermission->availablefor = 1;
             TOPLINK_BOL_ToplinkPermissionDao::getInstance()->save($toplinkPermission);
         }
     }
     return $newId;
 }
Example #5
0
 public function import($params)
 {
     $importDir = $params['importDir'];
     $txtFile = $importDir . 'configs.txt';
     // import configs
     if (file_exists($txtFile)) {
         $string = file_get_contents($txtFile);
         $configs = json_decode($string, true);
     }
     if (!$configs) {
         return;
     }
     $attachmentService = FORUM_BOL_PostAttachmentService::getInstance();
     $attDir = OW::getPluginManager()->getPlugin('forum')->getUserFilesDir();
     $attachments = $attachmentService->findAllAttachments();
     if (!$attachments) {
         return;
     }
     foreach ($attachments as $file) {
         OW::getDbo()->query("SELECT 1 ");
         $ext = UTIL_File::getExtension($file->fileName);
         $path = $attachmentService->getAttachmentFilePath($file->id, $file->hash, $ext);
         $fileName = str_replace($attDir, '', $path);
         $content = file_get_contents($configs['url'] . '/' . $fileName);
         if (mb_strlen($content)) {
             OW::getStorage()->fileSetContent($path, $content);
         }
     }
 }
Example #6
0
 public function resetAllUsersLastData()
 {
     $sql = "SELECT COUNT(*) FROM `" . MAILBOX_BOL_UserLastDataDao::getInstance()->getTableName() . "` AS `uld`\nLEFT JOIN `" . BOL_UserOnlineDao::getInstance()->getTableName() . "` AS uo ON uo.userId = uld.userId\nWHERE uo.id IS NULL";
     $usersOfflineButOnline = OW::getDbo()->queryForColumn($sql);
     if ($usersOfflineButOnline > 0) {
         MAILBOX_BOL_ConversationService::getInstance()->resetAllUsersLastData();
     }
 }
Example #7
0
 private function copyFeed()
 {
     if (OW::getPluginManager()->isPluginActive('newsfeed')) {
         $tbl = NEWSFEED_BOL_ActionDao::getInstance()->getTableName();
         $query = 'UPDATE ' . $tbl . ' SET pluginKey="equestions" WHERE pluginKey="questions"';
         OW::getDbo()->query($query);
     }
 }
Example #8
0
 public function findUsers($kw, $limit = null)
 {
     $questionName = OW::getConfig()->getValue('base', 'display_name_question');
     $questionDataTable = BOL_QuestionDataDao::getInstance()->getTableName();
     $limitStr = $limit === null ? '' : 'LIMIT 0, ' . intval($limit);
     $query = 'SELECT DISTINCT qd.userId FROM ' . $questionDataTable . ' qd
         LEFT JOIN `' . BOL_UserSuspendDao::getInstance()->getTableName() . '` AS `us` ON ( `qd`.`userId` = `us`.`userId` )
         WHERE `us`.`userId` IS NULL AND questionName=:name AND textValue LIKE :kw ' . $limitStr;
     return OW::getDbo()->queryForColumnList($query, array('kw' => '%' . $kw . '%', 'name' => $questionName));
 }
Example #9
0
 public function detectCountry()
 {
     try {
         $sql = 'SELECT `cc2` FROM `' . BOL_GeolocationIpToCountryDao::getInstance()->getTableName() . '`
             WHERE inet_aton(:ip) >= ipFrom AND inet_aton(:ip) <= ipTo';
         return OW::getDbo()->queryForColumn($sql, array('ip' => OW::getRequest()->getRemoteAddress()));
     } catch (Exception $e) {
         return null;
     }
 }
Example #10
0
 /**
  * Returns rendered markup.
  *
  * @return string
  */
 public function render()
 {
     if (defined("OW_PROFILER_ENABLE") && OW_PROFILER_ENABLE) {
         $this->assign('queryLog', OW::getDbo()->getQueryLog());
         $this->assign('queryCount', OW::getDbo()->getQueryCount());
         $this->assign('queryExecutionTime', OW::getDbo()->getTotalQueryExecTime());
         $this->assign('pageTime', UTIL_Profiler::getInstance()->getResult());
     }
     return $this->assignedVars;
 }
Example #11
0
 public function findUsers($kw, $userId, $limit = null)
 {
     if (!OW::getPluginManager()->isPluginActive('friends')) {
         return array();
     }
     $friendsTable = FRIENDS_BOL_FriendshipDao::getInstance()->getTableName();
     $questionName = OW::getConfig()->getValue('base', 'display_name_question');
     $questionDataTable = BOL_QuestionDataDao::getInstance()->getTableName();
     $limitStr = $limit === null ? '' : 'LIMIT 0, ' . intval($limit);
     $query = "SELECT `fr`.`userId` FROM `" . $friendsTable . "` AS `fr`\n            INNER JOIN " . $questionDataTable . " qd ON fr.userId = qd.userId\n            LEFT JOIN `" . BOL_UserSuspendDao::getInstance()->getTableName() . "` AS `us` ON ( `fr`.`friendId` = `us`.`userId` )\n            WHERE `fr`.`status` = :status AND `us`.`userId` IS NULL AND `fr`.`friendId` = :userId\n                AND qd.questionName=:name AND qd.textValue LIKE :kw\n            UNION\n            SELECT `fr`.`friendId` AS `userId` FROM `" . $friendsTable . "` AS `fr`\n            INNER JOIN " . $questionDataTable . " qd ON fr.friendId = qd.userId\n            LEFT JOIN `" . BOL_UserSuspendDao::getInstance()->getTableName() . "` AS `us` ON ( `fr`.`friendId` = `us`.`userId` )\n            WHERE `fr`.`status` = :status AND `us`.`userId` IS NULL AND `fr`.`userId` = :userId\n                AND qd.questionName=:name AND qd.textValue LIKE :kw\n            {$limitStr}\n            ";
     return OW::getDbo()->queryForColumnList($query, array('userId' => $userId, 'status' => FRIENDS_BOL_FriendshipDao::VAL_STATUS_ACTIVE, 'kw' => '%' . $kw . '%', 'name' => $questionName));
 }
Example #12
0
function usearch_set_question_sql(BASE_CLASS_QueryBuilderEvent $event)
{
    $params = $event->getParams();
    if (empty($params['question']) || !$params['question'] instanceof BOL_Question || empty($params['value']) || !in_array($params['question']->name, array('sex', 'match_sex'))) {
        return;
    }
    $value = is_array($params['value']) ? array_sum($params['value']) : (int) $params['value'];
    $prefix = !empty($params['prefix']) ? $params['prefix'] : 'q' . rand(100, 10000);
    $questionName = $params['question']->name == 'sex' ? 'match_sex' : 'sex';
    $innerJoin = " INNER JOIN `" . BOL_QuestionDataDao::getInstance()->getTableName() . "` `" . $prefix . "`\n        ON ( `user`.`id` = `" . $prefix . "`.`userId` AND `" . $prefix . "`.`questionName` = '" . OW::getDbo()->escapeString($questionName) . "' AND `" . $prefix . "`.`intValue` & " . OW::getDbo()->escapeString($value) . " ) ";
    $event->addJoin($innerJoin);
}
Example #13
0
 public function findGroups($kw, $userId, $limit = null)
 {
     $groupDao = GROUPS_BOL_GroupDao::getInstance();
     $groupUserDao = GROUPS_BOL_GroupUserDao::getInstance();
     $params = array('u' => $userId);
     if (!empty($kw)) {
         $params["kw"] = "%" . $kw . "%";
     }
     $limitStr = $limit === null ? '' : 'LIMIT 0, ' . intval($limit);
     $kwWhere = empty($kw) ? "1" : "g.title LIKE :kw";
     $query = "SELECT DISTINCT g.* FROM " . $groupDao->getTableName() . " g\n            INNER JOIN " . $groupUserDao->getTableName() . " u ON g.id = u.groupId AND u.id != :u\n            WHERE g.userId=:u AND {$kwWhere} " . $limitStr;
     return OW::getDbo()->queryForObjectList($query, $groupDao->getDtoClassName(), $params);
 }
Example #14
0
 public function findEvents($past, $kw, $userId, $limit = null)
 {
     $eventDao = EVENT_BOL_EventDao::getInstance();
     $eventUserDao = EVENT_BOL_EventUserDao::getInstance();
     $params = array('startTime' => time(), 'endTime' => time(), 'u' => $userId, 's' => EVENT_BOL_EventUserDao::VALUE_STATUS_YES);
     if (!empty($kw)) {
         $params["kw"] = "%" . $kw . "%";
     }
     $limitStr = $limit === null ? '' : 'LIMIT 0, ' . intval($limit);
     $kwWhere = empty($kw) ? "1" : "e.title LIKE :kw";
     $order = "e.`startTimeStamp` " . ($past ? "DESC" : "");
     $query = "SELECT e.* FROM `" . $eventDao->getTableName() . "` e \n            INNER JOIN " . $eventUserDao->getTableName() . " u ON u.eventId=e.id AND u.status=:s\n            WHERE u.userId!=:u AND e.userId=:u AND " . $this->getTimeClause($past, "e") . " AND " . $kwWhere . "\n            ORDER BY {$order} {$limitStr}";
     return OW::getDbo()->queryForObjectList($query, $eventDao->getDtoClassName(), $params);
 }
Example #15
0
 public function findUserPhotos($userId, $start, $offset)
 {
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $photoDao = PHOTO_BOL_PhotoDao::getInstance();
     $albumDao = PHOTO_BOL_PhotoAlbumDao::getInstance();
     $query = 'SELECT p.* FROM ' . $photoDao->getTableName() . ' AS p
         INNER JOIN ' . $albumDao->getTableName() . ' AS a ON p.albumId=a.id
             WHERE a.userId=:u AND p.status = "approved" ORDER BY p.addDatetime DESC
                 LIMIT :start, :offset';
     $list = OW::getDbo()->queryForList($query, array('u' => $userId, 'start' => $start, 'offset' => $offset));
     $out = array();
     foreach ($list as $photo) {
         $id = $photo['id'];
         $out[$id] = array('id' => $id, 'thumb' => $photoService->getPhotoPreviewUrl($id), 'url' => $photoService->getPhotoUrl($id), 'path' => $photoService->getPhotoPath($id), 'description' => $photo['description'], 'permalink' => OW::getRouter()->urlForRoute('view_photo', array('id' => $id)));
         $out[$id]['oembed'] = json_encode(array('type' => 'photo', 'url' => $out[$id]['url'], 'href' => $out[$id]['permalink'], 'description' => $out[$id]['description']));
     }
     return $out;
 }
Example #16
0
 public function index()
 {
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
     header("Cache-Control: no-cache, must-revalidate");
     header("Pragma: no-cache");
     $room = $_POST["room"];
     if ($room != "" and is_numeric($room)) {
         $now = time();
         $user = OW::getUser()->getId();
         $user_service = BOL_UserService::getInstance();
         $displayname = $user_service->getDisplayName($user);
         $msg = "{$displayname} has left the room!";
         $sql = "INSERT INTO " . OW_DB_PREFIX . "super_feed_message VALUES(null,'{$room}','{$user}','{$msg}', {$now},'userjoin')";
         OW::getDbo()->insert($sql);
     }
     exit;
 }
Example #17
0
 private function exportThemes(ZipArchive $za, $archiveDir)
 {
     $currentTheme = OW::getThemeManager()->getSelectedTheme()->getDto();
     $currentThemeDir = OW::getThemeManager()->getSelectedTheme()->getRootDir();
     $currentThemeUserfilesDir = OW_DIR_THEME_USERFILES;
     $this->configs['currentTheme'] = array('name' => $currentTheme->name, 'customCss' => $currentTheme->customCss, 'customCssFileName' => $currentTheme->customCssFileName, 'description' => $currentTheme->description, 'isActive' => $currentTheme->isActive, 'sidebarPosition' => $currentTheme->sidebarPosition, 'title' => $currentTheme->title);
     $controlValueList = OW::getDbo()->queryForList(" SELECT * FROM " . BOL_ThemeControlValueDao::getInstance()->getTableName() . " WHERE themeId = :themeId ", array('themeId' => $currentTheme->id));
     foreach ($controlValueList as $controlValue) {
         $this->configs['controlValue'][$controlValue['themeControlKey']] = $controlValue['value'];
     }
     $za->addEmptyDir($archiveDir . '/' . $currentTheme->getName());
     $this->zipFolder($za, $currentThemeDir, $archiveDir . '/' . $currentTheme->getName() . '/');
     $themesDir = Ow::getPluginManager()->getPlugin('dataexporter')->getPluginFilesDir() . 'themes' . DS;
     UTIL_File::copyDir(OW_DIR_THEME_USERFILES, $themesDir);
     $fileList = Ow::getStorage()->getFileNameList(OW_DIR_THEME_USERFILES);
     mkdir($themesDir, 0777);
     foreach ($fileList as $file) {
         if (Ow::getStorage()->isFile($file)) {
             Ow::getStorage()->copyFileToLocalFS($file, $themesDir . mb_substr($file, mb_strlen(OW_DIR_THEME_USERFILES)));
         }
     }
     $za->addEmptyDir($archiveDir . '/themes');
     $this->zipFolder($za, $themesDir, $archiveDir . '/themes/');
 }
Example #18
0
 public function index($param)
 {
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
     header("Cache-Control: no-cache, must-revalidate");
     header("Pragma: no-cache");
     $chat = $param['chat'];
     $now = time();
     $sql = "SELECT block_id,reason FROM " . OW_DB_PREFIX . "superfeed_user_blocked WHERE user_id='{$user}' AND (room_id = '{$chat}' 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 != "") {
         exit;
     }
     $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();
     $then = strtotime("-1 Minute");
     $returns = array();
     $sql = "SELECT userId FROM " . OW_DB_PREFIX . "superfeed_chat_users WHERE chatId='{$chat}' AND LastUpdate >= {$then}";
     $query_data = OW::getDbo()->queryForList($sql);
     foreach ($query_data as $users) {
         $userIdx = $users['userId'];
         $displayname = $user_service->getDisplayName($userIdx);
         $displayimage = $avat_service->getAvatarUrl($userIdx);
         if (!$displayimage) {
             $displayimage = $no_avatar;
         }
         $return .= "-xUSERx-" . $displayname . ":data:" . $displayimage . ":data:" . $userIdx;
     }
     echo $return;
     exit;
 }
Example #19
0
 public function make_options($selected = 1, $plunin_installed = "", $option = "")
 {
     //return;
     $id_user = OW::getUser()->getId();
     //citent login user (uwner)
     $is_admin = OW::getUser()->isAdmin();
     $curent_url = OW_URL_HOME;
     $content = "";
     $add_opt = "";
     //echo "--------------".$option;
     if (!isset($option)) {
         $option = "";
     }
     if (!isset($plunin_installed)) {
         $plunin_installed = array();
     }
     $query = "";
     if (isset($_GET['query'])) {
         $query = $_GET['query'];
     }
     if ($query) {
         $add = "?query=" . $query;
     } else {
         $add = "";
     }
     if (strlen($query) < 2) {
         $query = "*";
     }
     $content_f = "";
     $content_t = "";
     //            $content_t .="<div class=\"ow_content\" style=\"min-height:0;\">";
     //$content_t .="<div class=\"ow_content_menu_wrap\">";
     //echo "sdfsdF";exit;
     //            if ($option=="user"){
     $sql = "SELECT * FROM " . OW_DB_PREFIX . "base_question WHERE onSearch='1' ORDER BY sortOrder ";
     $arr1 = OW::getDbo()->queryForList($sql);
     $enter = 1;
     $inline = 3;
     foreach ($arr1 as $value) {
         //                    $add_opt .=$value['name']."--".$value['type']."-".$value['presentation']."<hr>";
         if ($value['type'] == "select") {
             if ($add_opt) {
                 $add_opt .= "&nbsp; ";
             }
             $add_opt .= "<div class=\"clearfix\" style=\"margin:auto;min-width:100px;display:inline-block;width:100%;\">\n    <div class=\"ow_ipc_header clearfix\" style=\"\">";
             $add_opt .= OW::getLanguage()->text('base', 'questions_question_' . $value['name'] . '_label') . ":<br/>";
             $add_opt .= "<select name=\"search_sel[" . $value['name'] . "]\" style=\"min-width:100px;width:100%;\">";
             //                        if (!$_GET['search_sel'][$value['name']]) {
             if (!isset($_GET['search_sel'][$value['name']])) {
                 $_GET['search_sel'][$value['name']] = "";
                 $sel = " selected ";
             } else {
                 $sel = " ";
             }
             $add_opt .= "<option " . $sel . " value=\"\">-- " . OW::getLanguage()->text('search', 'select') . " --</option>";
             $sql2 = "SELECT * FROM " . OW_DB_PREFIX . "base_question_value WHERE questionName='" . $value['name'] . "' ORDER BY sortOrder ";
             $arr2 = OW::getDbo()->queryForList($sql2);
             foreach ($arr2 as $value2) {
                 if ($value2['value'] == $_GET['search_sel'][$value['name']]) {
                     $sel = " selected ";
                 } else {
                     $sel = " ";
                 }
                 $add_opt .= "<option " . $sel . " value=\"" . $value2['value'] . "\">" . OW::getLanguage()->text('base', 'questions_question_' . $value['name'] . '_value_' . $value2['value']) . "</option>";
             }
             $add_opt .= "</select>";
             $add_opt .= "    </div>\n</div>";
             /*
                                         $enter++;
                                         if ($enter>$inline){
                                             $enter=1;
                                             $add_opt .="<br/>";
                                         }
             */
         }
         if ($value['type'] == "datetime") {
             $format = json_decode(stripslashes($value['custom']), true);
             //                $date = UTIL_DateTime::parseDate($question['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
             //                $date = UTIL_DateTime::parseDate($value['custom'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
             //                $age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
             $add_opt .= "<div class=\"clearfix\" style=\"margin:auto;min-width:100px;display:inline-block;width:100%;\">\n    <div class=\"ow_ipc_header clearfix ow_left\" style=\"width:100%;margin:auto;\">";
             //$add_opt .=OW::getLanguage()->text('search', 'questions_question_age').":<br/>";
             $add_opt .= OW::getLanguage()->text('base', 'questions_question_' . $value['name'] . '_label') . ":<br/>";
             $add_opt .= "<div class=\"clearfix ow_center\" style=\"padding:0;\">";
             //$add_opt .=OW::getLanguage()->text('search', 'questions_question_age_from').":";
             $add_opt .= "<select name=\"search_sel[" . $value['name'] . "_from]\" style=\"min-width:20px;\">";
             if (!isset($format['year_range']['from']) or !$format['year_range']['from']) {
                 $sel = " selected ";
             } else {
                 $sel = " ";
             }
             $add_opt .= "<option " . $sel . " value=\"\">" . OW::getLanguage()->text('search', 'questions_question_age_from') . "</option>";
             for ($i = $format['year_range']['from']; $i <= $format['year_range']['to']; $i++) {
                 //    if ($value2['value']==$_GET['search_sel'][$value['name']]) $sel=" selected ";
                 //        else $sel=" ";
                 //    if ($i==$format['year_range']['from']) $sel=" selected ";
                 if (isset($_GET['search_sel'][$value['name'] . "_from"]) and $i == $_GET['search_sel'][$value['name'] . "_from"]) {
                     $sel = " selected ";
                 } else {
                     $sel = " ";
                 }
                 $add_opt .= "<option " . $sel . " value=\"" . $i . "\">" . $i . "</option>";
             }
             $add_opt .= "</select>";
             //$add_opt .="&nbsp;-&nbsp;";
             //$add_opt .=OW::getLanguage()->text('search', 'questions_question_age_to').":";
             $add_opt .= "<select name=\"search_sel[" . $value['name'] . "_to]\" style=\"min-width:20px;\">";
             if (!isset($format['year_range']['to']) or !$format['year_range']['to']) {
                 $sel = " selected ";
             } else {
                 $sel = " ";
             }
             $add_opt .= "<option " . $sel . " value=\"\">" . OW::getLanguage()->text('search', 'questions_question_age_to') . "</option>";
             for ($i = $format['year_range']['from']; $i <= $format['year_range']['to']; $i++) {
                 //    if ($value2['value']==$_GET['search_sel'][$value['name']]) $sel=" selected ";
                 //        else $sel=" ";
                 if (isset($_GET['search_sel'][$value['name'] . "_to"]) and $i == $_GET['search_sel'][$value['name'] . "_to"]) {
                     $sel = " selected ";
                 } else {
                     $sel = " ";
                 }
                 $add_opt .= "<option " . $sel . " value=\"" . $i . "\">" . $i . "</option>";
             }
             $add_opt .= "</select>";
             $add_opt .= "</div>";
             /*
             //$add_opt .=print_r($format['year_range'],1);
             $add_opt .=$format['year_range']['from'];
             $add_opt .="----";
             $add_opt .=$format['year_range']['to'];
             */
             //        $add_opt .=OW::getLanguage()->text('base', 'questions_question_'.$value['name'].'_label').":<br/>";
             //        if (!isset($_GET['search_text'][$value['name']]))  $_GET['search_text'][$value['name']]="";
             //        $add_opt .="<input type=\"text\" name=\"search_text[".$value['name']."]\" value=\"".$_GET['search_text'][$value['name']]."\" style=\"min-width:100px;width:100%;\">";
             $add_opt .= "    </div>\n</div>";
         }
         if ($value['type'] == "text") {
             if (isset($add_opt)) {
                 $add_opt .= " ";
             }
             //                        $add_opt .=OW::getLanguage()->text('base', 'questions_question_'.$value['name'].'_label').": ";
             //                        $add_opt .="<input type=\"text\" name=\"search_text[".$value['name']."]\" value=\"".$_GET['search_text'][$value['name']]."\" style=\"width:150px;\">";
             $add_opt .= "<div class=\"clearfix\" style=\"margin:auto;min-width:100px;display:inline-block;width:100%;\">\n    <div class=\"ow_ipc_header clearfix\" style=\"\">";
             $add_opt .= OW::getLanguage()->text('base', 'questions_question_' . $value['name'] . '_label') . ":<br/>";
             if (!isset($_GET['search_text'][$value['name']])) {
                 $_GET['search_text'][$value['name']] = "";
             }
             $add_opt .= "<input type=\"text\" name=\"search_text[" . $value['name'] . "]\" value=\"" . $_GET['search_text'][$value['name']] . "\" style=\"min-width:100px;width:100%;\">";
             $add_opt .= "    </div>\n</div>";
             /*
                                         $enter++;
                                         if ($enter>$inline){
                                             $enter=1;
                                             $add_opt .="<br/>";
                                         }
             */
         }
     }
     //for
     //                $content_f="";
     //                if ($add_opt){
     //                    $content_f .="<form metod=\"get\" action=\"".$curent_url."members/".$option.$add."\">";
     //                    $content_f .="<input type=\"text\" name=\"query\" value=\"".$query."\" style=\"width:80%;\">";
     //                    $content_f .="<input type=\"submit\" name=\"\" value=\"".OW::getLanguage()->text('search', 'search')."\">";
     //                    $content_f .="&nbsp;";
     //                    $content_f .="<span class=\"ow_button ow_ic_lens\"><span><input type=\"submit\" value=\"".OW::getLanguage()->text('search', 'search')."\" id=\"btn-add-new-photo\" class=\"ow_ic_lens\"></span></span>";
     //                    $content_f .=$add_opt;
     //                    $content_f .="<hr/>";
     //                    $content_f .="<span class=\"ow_button\"><span><input type=\"submit\" value=\"".OW::getLanguage()->text('search', 'search')."\" id=\"btn-add-new-photo\" class=\"ow_ic_lens\"></span></span>";
     //                    $content_f .=$add_opt;
     //                    $content_f .="<hr/>";
     //                    $content_f .="</form>";
     //                }
     //                $add_opt =$content_f;
     //            }
     //$content_t .="</div>";
     //        $content_t .=$content;
     //        $content_t .="</div>";
     //            $content_t .="<form metod=\"get\" action=\"".$curent_url."members/".$option.$add."\">";
     /*
     <form id="searchform" metod="get" action="http://test.a6.pl/query" style="display:inline;">
     <input style="position:relative;display:inline-block;float:left;left:3px;top:1px;width:310px;font-size:120%;" type="text" id="query" name="query" value="Search people, places, and more..." onblur="if(this.value == '') { this.value='Search people, places, and more...'};" onfocus="if (this.value == 'Search people, places, and more...') {this.value=''};" autocomplete="off" spellcheck="false">
     </form>
     */
     if ($add_opt) {
         $content_t .= "<div class=\"ow_content\" style=\"min-height:0;min-width:100px;width:165px;\">";
         $content_t .= $add_opt;
         $content_t .= "</div>";
     }
     //            $content_t .="</form>";
     return $content_t;
 }
Example #20
0
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
$plugin = OW::getPluginManager()->getPlugin('fbconnect');
$dbPrefix = OW_DB_PREFIX;
$sql = <<<EOT
CREATE TABLE IF NOT EXISTS `{$dbPrefix}fbconnect_field` (
  `id` int(11) NOT NULL auto_increment,
  `question` varchar(50) NOT NULL,
  `fbField` varchar(100) NOT NULL,
  `converter` varchar(100) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ;

INSERT INTO `{$dbPrefix}fbconnect_field` (`id`, `question`, `fbField`, `converter`) VALUES
(1, 'realname', 'name', 'FBCONNECT_FC_TextFieldConverter'),
(2, 'username', 'name', 'FBCONNECT_FC_Username'),
(3, 'email', 'email', 'FBCONNECT_FC_TextFieldConverter'),
(4, 'picture_small', 'pic_square', 'FBCONNECT_FC_Picture'),
(5, 'picture_big', 'pic_big', 'FBCONNECT_FC_Picture');

EOT;
OW::getDbo()->query($sql);
OW::getConfig()->addConfig('fbconnect', 'api_key', '', 'Facebook Api Key');
OW::getConfig()->addConfig('fbconnect', 'app_id', '', 'Facebook Application ID');
OW::getConfig()->addConfig('fbconnect', 'api_secret', '', 'Facebook Application Secret');
OW::getConfig()->addConfig('fbconnect', 'allow_synchronize', 0, 'Allow synchronization for non-Facebook profiles');
OW::getPluginManager()->addPluginSettingsRouteName('fbconnect', 'fbconnect_configuration_settings');
BOL_LanguageService::getInstance()->importPrefixFromZip($plugin->getRootDir() . 'langs.zip', 'fbconnect');
Example #21
0
 * ---
 * Copyright (c) 2011, Oxwall Foundation
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
 * following conditions are met:
 *
 *  - Redistributions of source code must retain the above copyright notice, this list of conditions and
 *  the following disclaimer.
 *
 *  - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
 *  the following disclaimer in the documentation and/or other materials provided with the distribution.
 *
 *  - Neither the name of the Oxwall Foundation nor the names of its contributors may be used to endorse or promote products
 *  derived from this software without specific prior written permission.
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
/**
 * @author Aybat Duyshokov <*****@*****.**>
 * @package ow_plugins.birthdays
 * @since 1.0
 */
OW::getConfig()->addConfig('birthdays', 'users_birthday_event_ts', '0');
OW::getLanguage()->importPluginLangs(OW::getPluginManager()->getPlugin('birthdays')->getRootDir() . 'langs.zip', 'birthdays');
OW::getDbo()->query("\nCREATE TABLE IF NOT EXISTS `" . OW_DB_PREFIX . "birthdays_privacy` (\n  `id` int(11) NOT NULL auto_increment,\n  `userId` int(11) NOT NULL,\n  `privacy` varchar(32) NOT NULL,\n  PRIMARY KEY  (`id`),\n  UNIQUE KEY `userId` (`userId`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;");
Example #22
0
$QUESTION_PRESENTATION_RADIO = BOL_QuestionService::QUESTION_PRESENTATION_RADIO;
$QUESTION_PRESENTATION_MULTICHECKBOX = BOL_QuestionService::QUESTION_PRESENTATION_MULTICHECKBOX;
$QUESTION_PRESENTATION_URL = BOL_QuestionService::QUESTION_PRESENTATION_URL;
$QUESTION_PRESENTATION_TEXT = BOL_QuestionService::QUESTION_PRESENTATION_TEXT;
$QUESTION_PRESENTATION_TEXTAREA = BOL_QuestionService::QUESTION_PRESENTATION_TEXTAREA;
$MYSQL_DATETIME_DATE_FORMAT = UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT;
$USER_LIST_SIZE = BOL_SearchService::USER_LIST_SIZE;
$SEARCH_RESULT_ID_VARIABLE = BOL_SearchService::SEARCH_RESULT_ID_VARIABLE;
$PARAM_OPTION_DEFAULT_VALUE = OW_Route::PARAM_OPTION_DEFAULT_VALUE;
$LIST_ORDER_MATCH_COMPATIBILITY = USEARCH_BOL_Service::LIST_ORDER_MATCH_COMPATIBILITY;
$LIST_ORDER_DISTANCE = USEARCH_BOL_Service::LIST_ORDER_DISTANCE;
$LIST_ORDER_LATEST_ACTIVITY = USEARCH_BOL_Service::LIST_ORDER_LATEST_ACTIVITY;
$LIST_ORDER_NEW = USEARCH_BOL_Service::LIST_ORDER_NEW;
$HAMMU_BOL_Service = HAMMU_BOL_Service::getInstance();
$language = OW::getLanguage();
$OWgetDbo = OW::getDbo();
$SKADATE_BOL_AccountTypeToGenderDao = SKADATE_BOL_AccountTypeToGenderDao::getInstance();
//
//
//$getClassInstance = OW::getClassInstance('USEARCH_CLASS_QuickSearchForm');
//$formatBirthdate = UTIL_DateTime::formatBirthdate;
//$autoLink = UTIL_HtmlTag::autoLink;
//$parseDate = UTIL_DateTime::parseDate;
// POST route
//$app->post('/loginapp', 'loginapp');
//$app->post('/loginapp', 'loginapp');
$app->post('/login', 'login');
$app->post('/forgot_password', 'forgot_password');
$app->post('/getAllServices', 'getAllServices');
$app->post('/getAllServicesOrPreferences', 'getAllServicesOrPreferences');
$app->post('/getProfiledetails', 'getProfiledetails');
Example #23
0
 * All rights reserved.
 * ATTENTION: This commercial software is intended for use with Oxwall Free Community Software http://www.oxwall.org/
 * and is licensed under Oxwall Store Commercial License.
 * Full text of this license can be found at http://www.oxwall.org/store/oscl
 */
OW::getPluginManager()->addPluginSettingsRouteName('profileprogressbar', 'profileprogressbar.admin');
$config = OW::getConfig();
if (!$config->configExists('profileprogressbar', 'theme')) {
    $config->addConfig('profileprogressbar', 'theme', 'standart');
}
if (!$config->configExists('profileprogressbar', 'features')) {
    $config->addConfig('profileprogressbar', 'features', '{"friends":1,"photo":1,"video":1}');
}
if (!$config->configExists('profileprogressbar', 'per_day')) {
    $config->addConfig('profileprogressbar', 'per_day', 7);
}
if (!$config->configExists('profileprogressbar', 'show_hint')) {
    $config->addConfig('profileprogressbar', 'show_hint', 1);
}
OW::getDbo()->query('DROP TABLE IF EXISTS `' . OW_DB_PREFIX . 'profileprogressbar_activity_log`;
CREATE TABLE `' . OW_DB_PREFIX . 'profileprogressbar_activity_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `userId` int(10) unsigned NOT NULL,
  `entityType` enum("blog-post", "event", "forum-topic", "friend_add", "group", "link", "photo_comments", "video_comments", "user_gift") NOT NULL,
  `timeStamp` int(10) unsigned NOT NULL,
  `entityId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `indexAll` (`userId`,`entityType`,`timeStamp`, `entityId`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
OW::getLanguage()->importPluginLangs(OW::getPluginManager()->getPlugin('profileprogressbar')->getRootDir() . 'langs.zip', 'profileprogressbar');
OW_ViewRenderer::getInstance()->clearCompiledTpl();
Example #24
0
 public function make_adsfromadsense($type = "full")
 {
     $curent_url = OW_URL_HOME;
     $ret = "";
     if (OW::getPluginManager()->isPluginActive('adsense') and OW::getConfig()->getValue('search', 'allow_ads_adsense')) {
         //                        LEFT JOIN " . OW_DB_PREFIX. "base_question_data uadd ON (uadd.userId=uss.id ".$add_query." )
         //                            LEFT JOIN " . OW_DB_PREFIX. "adspro_adverts_packs adxp ON (adxp.userId=uss.id ".$add_query." )
         //
         $timestamp = strtotime(date('Y-m-d H:i:s'));
         $sql = "SELECT * FROM " . OW_DB_PREFIX . "adsense adxs \n                            LEFT JOIN " . OW_DB_PREFIX . "adsense_ads adxp ON (adxp.id_ads=adxs.id) \n                        WHERE \n                        (\n                            adxs.active='1' AND\n                            adxs.is_published='1' AND\n                            adxs.data_end<'" . addslashes($timestamp) . "' AND \n                            adxs.description!='' \n                        )\n                        ORDER BY RAND() LIMIT 1";
         //echo $sql;exit;
         $arr = OW::getDbo()->queryForList($sql);
         if (isset($arr[0])) {
             //echo $sql;exit;
             $value = $arr[0];
             if (isset($value['id']) and $value['id'] > 0) {
                 $sql = "UPDATE " . OW_DB_PREFIX . "adsense SET count_show=count_show+1 WHERE id='" . addslashes($value['id']) . "' LIMIT 1";
                 OW::getDbo()->query($sql);
                 /*
                 
                                                 $ret .="<div class=\"ow_console_dropdown_hover clearfix\" style=\"overflow:hidden;margin:3px;width:300px;border-bottom:1px solid #eee;display:block;\">";
                                                     $ret .="<div class=\"ow_console_dropdown_hover clearfix\" style=\"font-weight:bold;font-size:14px;display:inline-block;float:left;width:45px;\">";
                 
                                                     if ($uimg){
                                                         $ret .="<a href=\"".$uurl."\" style=\"display:inline;;font-size:14px;font-weight:bold;\">";
                                                         $ret .="<img src=\"".$uimg."\" title=\"".$dname."\" width=\"45px\" style=\"border:0;margin:10px;align:left;display:inline;\" align=\"left\" >";
                                                         $ret .="</a>";
                                                     }else{
                                                         $ret .="<a href=\"".$uurl."\" style=\"display:inline;;font-size:14px;font-weight:bold;\">";
                                                         $ret .="<img src=\"".$curent_url."ow_static/themes/".OW::getConfig()->getValue('base', 'selectedTheme')."/images/no-avatar.png\" title=\"".OW::getLanguage()->text('search', 'index_hasnotimage')."\" width=\"45px\" style=\"border:0;margin:10px;align:left;display:inline;\" align=\"left\" >";
                                                         $ret .="</a>";
                                                     }
                 
                                                     $ret .="</div>";
                                                     $ret .="<div class=\"clearfix\" style=\"font-weight:bold;font-size:14px;display:inline-block;;float:left;min-height:40px;min-width:230px;max-width:230px;margin-left:20px;margin-top:20px;\">";
                                                     $ret .="<a href=\"".stripslashes($value['link'])."\" style=\"display:inline;;font-size:14px;font-weight:bold;\" title=\"".stripslashes($value['name'])."\" >";
                                                     $ret .=stripslashes($value['advert_text']);
                                                     $ret .="</a>";
                                                     $ret .="</div>";
                                                 $ret .="</div>";
                 */
                 if ($type == "full") {
                     $ret .= "<div class=\"ow_bg_color aron_dropdown_hover ow_comments_item_content clearfix\" style=\"overflow:hidden;margin:0px;margin-bottom:15px;min-width:300px;width:100%;display:block;min-height:50px;padding: 0;\">";
                 } else {
                     $ret .= "<div class=\"ow_bg_color aron_dropdown_hover ow_comments_item_content clearfix\" style=\"overflow:hidden;margin:0px;width:300px;display:block;min-height:50px;padding: 0;\">";
                 }
                 $ret .= "<div class=\"ow_center clearfix \" style=\"text-align:left;border-bottom:1px solid #eee;\">";
                 //$ret .="<i>Advertisement</i>";
                 $ret .= "<i style=\"font-weight:bold;font-size: 9px;line-height:9px;\">" . OW::getLanguage()->text('search', 'advertisement') . "</i>";
                 $ret .= "</div>";
                 //$linkopen=http://test3.a6.pl/ads/golink/1
                 //$linkopen=$curent_url."ads/golink/".$value['id'];
                 $linkopen = $curent_url . "adsense/click/" . $value['id'] . "_" . $value['id_owner'] . "/" . base64_encode(urlencode(stripslashes($value['ads_url'])));
                 //stripslashes($value['link'])
                 //                                        $ret .="<a href=\"".$linkopen."\" title=\"".stripslashes($value['name'])."\"  style=\"display:inline;;font-size:12px;font-weight:bold;\" target=\"_blank\">";
                 $ret .= "<a href=\"" . $linkopen . "\" title=\"" . stripslashes($value['name']) . "\"  style=\"display:inline;font-size:12px;font-weight:bold;\" target=\"_blank\">";
                 $ret .= "<div class=\"clearfix\" style=\"text-align:left;font-weight:bold;font-size:10px;display:inline-block;min-height:40px;min-width:230px;margin-left:0px;margin-top:10px;margin-bottom:10px;width:100%;\">";
                 //max_clicks      total_showntotal_shown  max_shown advert_text
                 //$ret .="<div class=\"ow_tooltip_body clearfix ow_comments_item_content\" style=\"\">";
                 //$ret .="<div class=\"ow_tooltip_body clearfix \" style=\"\">";
                 //                                        $ret .="<a href=\"".stripslashes($value['link'])."/index.html\" title=\"".stripslashes($value['name'])."\"  style=\"display:inline;;font-size:12px;font-weight:bold;\" >";
                 $content = stripslashes($value['description']);
                 $content = $this->html2txt($content, 160);
                 //                                        $ret .=
                 //                                        if (mb_strlen($content)>160) $content .="...";
                 $ret .= $content;
                 //                                        $ret .="</a>";
                 //$ret .="</div>";
                 $ret .= "</div>";
                 $ret .= "</a>";
                 $ret .= "</div>";
             }
             //if $value['id']>0
         }
     }
     return $ret;
 }
Example #25
0
 public function findMassMailingUserCount($ignoreUnsubscribe = false, $userRoles = array())
 {
     $join = '';
     $where = '';
     $queryParts = $this->getUserQueryFilter("u", "id", array("method" => "BOL_UserDao::findMassMailingUserCount"));
     if ($ignoreUnsubscribe !== true) {
         $join .= " LEFT JOIN `" . BOL_PreferenceDataDao::getInstance()->getTableName() . "` AS `preference`\n                    ON (`u`.`id` = `preference`.`userId` AND `preference`.`key` = 'mass_mailing_subscribe') ";
         $where .= " AND  ( `preference`.`value` = 'true' OR `preference`.`id` IS NULL ) ";
     }
     if (!empty($userRoles) && is_array($userRoles)) {
         $join .= " INNER JOIN `" . BOL_AuthorizationUserRoleDao::getInstance()->getTableName() . "` AS `userRole`\n                    ON (`u`.`id` = `userRole`.`userId`)\n                    INNER JOIN `" . BOL_AuthorizationRoleDao::getInstance()->getTableName() . "` AS `role`\n                        ON (`userRole`.`roleId` = `role`.`id`) ";
         $where .= " AND  ( `role`.`name` IN ( " . OW::getDbo()->mergeInClause($userRoles) . " ) ) ";
     }
     $query = "\n            SELECT  COUNT( DISTINCT `u`.`id`) FROM `{$this->getTableName()}` AS `u`\n                {$queryParts["join"]}\n                {$join}\n            WHERE {$queryParts["where"]}  {$where} ";
     return $this->dbo->queryForColumn($query);
 }
Example #26
0
 public function process()
 {
     if (OW_Request::getInstance()->isPost()) {
         $data = $this->prepareData($_POST);
         if ($this->isValid($data)) {
             $data = $this->getValues();
             // --------------------------------------------
             if (!$this->getElement('qst_answer_type')->getAttribute('disabled')) {
                 $this->question->presentation = htmlspecialchars($data['qst_answer_type']);
             }
             foreach ($this->getElements() as $element) {
                 if (!$element->getAttribute('disabled')) {
                     switch ($element->getName()) {
                         case 'qst_required':
                             $this->question->required = isset($data['qst_required']) ? 1 : 0;
                             break;
                         case 'qst_on_sign_up':
                             $this->question->onJoin = isset($data['qst_on_sign_up']) ? 1 : 0;
                             break;
                         case 'qst_on_edit':
                             $this->question->onEdit = isset($data['qst_on_edit']) ? 1 : 0;
                             break;
                         case 'qst_on_search':
                             $this->question->onSearch = isset($data['qst_on_search']) ? 1 : 0;
                             break;
                         case 'qst_on_view':
                             $this->question->onView = isset($data['qst_on_view']) ? 1 : 0;
                             break;
                         case 'qst_column_count':
                             $presentations2FormElements = $this->getPresentations2FormElements();
                             $this->question->columnCount = 1;
                             if ($presentations2FormElements[$this->question->presentation]['qst_column_count'] && !empty($data['qst_column_count']) && (int) $data['qst_column_count'] > 0) {
                                 $this->question->columnCount = (int) $data['qst_column_count'];
                             }
                             break;
                         case 'qst_section':
                             if (!empty($data['qst_section'])) {
                                 $section = $this->questionService->findSectionBySectionName(htmlspecialchars(trim($data['qst_section'])));
                                 $sectionName = null;
                                 if (isset($section)) {
                                     $sectionName = $section->name;
                                 }
                                 if ($this->question->sectionName !== $sectionName) {
                                     $this->question->sectionName = $sectionName;
                                     $this->question->sortOrder = (int) BOL_QuestionService::getInstance()->findLastQuestionOrder($this->question->sectionName) + 1;
                                 }
                             }
                             break;
                         case 'qst_account_type':
                             if ($data['qst_account_type'] !== null) {
                                 if (!empty($data['qst_account_type']) && is_array($data['qst_account_type'])) {
                                     $this->questionService->deleteQuestionToAccountTypeByQuestionName($this->question->name);
                                     $this->questionService->addQuestionToAccountType($this->question->name, $data['qst_account_type']);
                                 }
                             }
                             break;
                     }
                 }
             }
             // -----------------------
             //                if ( !$disableActionList['disable_display_config'] )
             //                {
             // save question configs
             $configs = array();
             $presentationConfigList = !empty($this->configToPresentation[$this->question->presentation]) ? $this->configToPresentation[$this->question->presentation] : array();
             foreach ($presentationConfigList as $config) {
                 if (isset($data[$config->name])) {
                     $configs[$config->name] = $data[$config->name];
                 }
             }
             $this->question->custom = json_encode($configs);
             //                }
             $this->questionService->saveOrUpdateQuestion($this->question);
             $updated = false;
             if (OW::getDbo()->getAffectedRows() > 0) {
                 $updated = true;
                 $list = $this->questionService->findQuestionChildren($this->question->name);
                 /* @var BOL_Question $child */
                 foreach ($list as $child) {
                     $child->columnCount = $this->question->columnCount;
                     $this->questionService->saveOrUpdateQuestion($child);
                 }
             }
             $this->questionService = BOL_QuestionService::getInstance();
             //update question values sort
             /* if ( !empty($_POST['qst_possible_values']) )
                {
                    $values = json_decode($_POST['qst_possible_values'], true);
                    
                    if ( !empty($values['deletedValues']) && is_array($values['deletedValues']) )
                    {
                        $this->questionService->deleteQuestionValues($this->question->name, $values['deletedValues']);
                    }
                } */
             if (!empty($data['qst_possible_values'])) {
                 if ($this->questionService->updateQuestionValues($this->question->name, $data['qst_possible_values'])) {
                     $updated = true;
                 }
             }
             $message = OW::getLanguage()->text('admin', 'questions_question_was_not_updated_message');
             if ($updated) {
                 $message = OW::getLanguage()->text('admin', 'questions_update_question_message');
             }
             OW::getFeedback()->info($message);
             echo json_encode(array('result' => true, 'errors' => array(), 'message' => $message));
         } else {
             echo json_encode(array('result' => false, 'errors' => $this->getErrors(), 'message' => OW::getLanguage()->text('admin', 'questions_update_error')));
         }
         exit;
     }
 }
Example #27
0
 /**
  * Application init actions.
  */
 public function init()
 {
     // router init - need to set current page uri and base url
     $router = OW::getRouter();
     $router->setBaseUrl(OW_URL_HOME);
     $this->urlHostRedirect();
     OW_Auth::getInstance()->setAuthenticator(new OW_SessionAuthenticator());
     $this->userAutoLogin();
     // setting default time zone
     date_default_timezone_set(OW::getConfig()->getValue('base', 'site_timezone'));
     // synchronize the db's time zone
     OW::getDbo()->setTimezone();
     //        OW::getRequestHandler()->setIndexPageAttributes('BASE_CTRL_ComponentPanel');
     OW::getRequestHandler()->setStaticPageAttributes('BASE_MCTRL_BaseDocument', 'staticDocument');
     $uri = OW::getRequest()->getRequestUri();
     // before setting in router need to remove get params
     if (strstr($uri, '?')) {
         $uri = substr($uri, 0, strpos($uri, '?'));
     }
     $router->setUri($uri);
     $defaultRoute = new OW_DefaultRoute();
     //$defaultRoute->setControllerNamePrefix('MCTRL');
     $router->setDefaultRoute($defaultRoute);
     $navService = BOL_NavigationService::getInstance();
     //
     //        // try to find static document with current uri
     //        $document = $navService->findStaticDocument($uri);
     //
     //        if ( $document !== null )
     //        {
     //            $this->documentKey = $document->getKey();
     //        }
     OW::getPluginManager()->initPlugins();
     $event = new OW_Event(OW_EventManager::ON_PLUGINS_INIT);
     OW::getEventManager()->trigger($event);
     $beckend = OW::getEventManager()->call('base.cache_backend_init');
     if ($beckend !== null) {
         OW::getCacheManager()->setCacheBackend($beckend);
         OW::getCacheManager()->setLifetime(3600);
         OW::getDbo()->setUseCashe(true);
     }
     $this->devActions();
     OW::getThemeManager()->initDefaultTheme(true);
     // setting current theme
     $activeThemeName = OW::getEventManager()->call('base.get_active_theme_name');
     $activeThemeName = $activeThemeName ? $activeThemeName : OW::getConfig()->getValue('base', 'selectedTheme');
     if ($activeThemeName !== BOL_ThemeService::DEFAULT_THEME && OW::getThemeManager()->getThemeService()->themeExists($activeThemeName)) {
         OW_ThemeManager::getInstance()->setCurrentTheme(BOL_ThemeService::getInstance()->getThemeObjectByName(trim($activeThemeName), true));
     }
     // adding static document routes
     $staticDocs = $navService->findAllMobileStaticDocuments();
     $staticPageDispatchAttrs = OW::getRequestHandler()->getStaticPageAttributes();
     /* @var $value BOL_Document */
     foreach ($staticDocs as $value) {
         OW::getRouter()->addRoute(new OW_Route($value->getKey(), $value->getUri(), $staticPageDispatchAttrs['controller'], $staticPageDispatchAttrs['action'], array('documentKey' => array(OW_Route::PARAM_OPTION_HIDDEN_VAR => $value->getKey()))));
         // TODO refactor - hotfix for TOS page
         if (UTIL_String::removeFirstAndLastSlashes($value->getUri()) == 'terms-of-use') {
             OW::getRequestHandler()->addCatchAllRequestsExclude('base.members_only', $staticPageDispatchAttrs['controller'], $staticPageDispatchAttrs['action'], array('documentKey' => $value->getKey()));
         }
     }
     //adding index page route
     $item = BOL_NavigationService::getInstance()->findFirstLocal(OW::getUser()->isAuthenticated() ? BOL_NavigationService::VISIBLE_FOR_MEMBER : BOL_NavigationService::VISIBLE_FOR_GUEST, OW_Navigation::MOBILE_TOP);
     if ($item !== null) {
         if ($item->getRoutePath()) {
             $route = OW::getRouter()->getRoute($item->getRoutePath());
             $ddispatchAttrs = $route->getDispatchAttrs();
         } else {
             $ddispatchAttrs = OW::getRequestHandler()->getStaticPageAttributes();
         }
         $router->addRoute(new OW_Route('base_default_index', '/', $ddispatchAttrs['controller'], $ddispatchAttrs['action'], array('documentKey' => array(OW_Route::PARAM_OPTION_HIDDEN_VAR => $item->getDocumentKey()))));
         $this->indexMenuItem = $item;
         OW::getEventManager()->bind(OW_EventManager::ON_AFTER_REQUEST_HANDLE, array($this, 'activateMenuItem'));
     } else {
         $router->addRoute(new OW_Route('base_default_index', '/', 'BASE_MCTRL_WidgetPanel', 'index'));
     }
     if (!OW::getRequest()->isAjax()) {
         OW::getResponse()->setDocument($this->newDocument());
         OW::getDocument()->setMasterPage(new OW_MobileMasterPage());
         OW::getResponse()->setHeader(OW_Response::HD_CNT_TYPE, OW::getDocument()->getMime() . '; charset=' . OW::getDocument()->getCharset());
     } else {
         OW::getResponse()->setDocument(new OW_AjaxDocument());
     }
     /* additional actions */
     if (OW::getUser()->isAuthenticated()) {
         BOL_UserService::getInstance()->updateActivityStamp(OW::getUser()->getId(), $this->getContext());
     }
     // adding global template vars
     $currentThemeImagesDir = OW::getThemeManager()->getCurrentTheme()->getStaticImagesUrl();
     $viewRenderer = OW_ViewRenderer::getInstance();
     $viewRenderer->assignVar('themeImagesUrl', $currentThemeImagesDir);
     $viewRenderer->assignVar('siteName', OW::getConfig()->getValue('base', 'site_name'));
     $viewRenderer->assignVar('siteTagline', OW::getConfig()->getValue('base', 'site_tagline'));
     $viewRenderer->assignVar('siteUrl', OW_URL_HOME);
     $viewRenderer->assignVar('isAuthenticated', OW::getUser()->isAuthenticated());
     $viewRenderer->assignVar('bottomPoweredByLink', '<a href="http://www.oxwall.org/" target="_blank" title="Powered by Oxwall Community Software"><img src="' . $currentThemeImagesDir . 'powered-by-oxwall.png" alt="Oxwall Community Software" /></a>');
     $viewRenderer->assignVar('adminDashboardIframeUrl', "http://static.oxwall.org/spotlight/?platform=oxwall&platform-version=" . OW::getConfig()->getValue('base', 'soft_version') . "&platform-build=" . OW::getConfig()->getValue('base', 'soft_build'));
     if (function_exists('ow_service_actions')) {
         call_user_func('ow_service_actions');
     }
     $this->handleHttps();
 }
 private function isBlockedByUserIdList($userId, $userIdList)
 {
     $userIdListString = OW::getDbo()->mergeInClause($userIdList);
     $sql = "SELECT `userId` FROM `" . BOL_UserBlockDao::getInstance()->getTableName() . "` WHERE `blockedUserId` = :userId AND `userId` IN ( {$userIdListString} )";
     return OW::getDbo()->queryForList($sql, array('userId' => $userId));
 }
Example #29
0
    if (OW::getConfig()->configExists('base', 'cron_is_configured')) {
        OW::getConfig()->saveConfig('base', 'cron_is_configured', 1);
    } else {
        OW::getConfig()->addConfig('base', 'cron_is_configured', 1);
    }
}
OW::getRouter()->setBaseUrl(OW_URL_HOME);
OW::getPluginManager()->initPlugins();
$event = new OW_Event(OW_EventManager::ON_PLUGINS_INIT);
OW::getEventManager()->trigger($event);
//init cache manager
$beckend = OW::getEventManager()->call('base.cache_backend_init');
if ($beckend !== null) {
    OW::getCacheManager()->setCacheBackend($beckend);
    OW::getCacheManager()->setLifetime(3600);
    OW::getDbo()->setUseCashe(true);
}
OW::getThemeManager()->initDefaultTheme();
// setting current theme
$activeThemeName = OW::getConfig()->getValue('base', 'selectedTheme');
if ($activeThemeName !== BOL_ThemeService::DEFAULT_THEME && OW::getThemeManager()->getThemeService()->themeExists($activeThemeName)) {
    OW_ThemeManager::getInstance()->setCurrentTheme(BOL_ThemeService::getInstance()->getThemeObjectByName(trim($activeThemeName)));
}
$plugins = BOL_PluginService::getInstance()->findActivePlugins();
foreach ($plugins as $plugin) {
    /* @var $plugin BOL_Plugin */
    $pluginRootDir = OW::getPluginManager()->getPlugin($plugin->getKey())->getRootDir();
    if (file_exists($pluginRootDir . DS . 'cron.php')) {
        include $pluginRootDir . DS . 'cron.php';
        $className = strtoupper($plugin->getKey()) . '_Cron';
        $cron = new $className();
Example #30
0
 /**
  * Uninstalls plugin.
  *
  * @param string $key
  */
 public function uninstall($key)
 {
     if (empty($key)) {
         throw new LogicException('');
     }
     $pluginDto = $this->findPluginByKey(trim($key));
     if ($pluginDto === null) {
         throw new LogicException('');
     }
     // trigger event
     $event = new OW_Event(OW_EventManager::ON_BEFORE_PLUGIN_UNINSTALL, array('pluginKey' => $pluginDto->getKey()));
     OW::getEventManager()->trigger($event);
     include OW_DIR_PLUGIN . $pluginDto->getModule() . DS . 'deactivate.php';
     // include plugin custom uninstall script
     include OW_DIR_PLUGIN . $pluginDto->getModule() . DS . 'uninstall.php';
     // delete plugin work dirs
     $dirsToRemove = array(OW_DIR_PLUGINFILES . $pluginDto->getModule(), OW_DIR_PLUGIN_USERFILES . $pluginDto->getModule());
     if (!defined('OW_PLUGIN_XP')) {
         $dirsToRemove[] = OW_DIR_STATIC_PLUGIN . $pluginDto->getModule();
     }
     foreach ($dirsToRemove as $dir) {
         if (file_exists($dir)) {
             UTIL_File::removeDir($dir);
         }
     }
     // remove plugin configs
     OW::getConfig()->deletePluginConfigs($pluginDto->getKey());
     // delete language prefix
     $prefixId = BOL_LanguageService::getInstance()->findPrefixId($pluginDto->getKey());
     if (!empty($prefixId)) {
         BOL_LanguageService::getInstance()->deletePrefix($prefixId, true);
     }
     //delete authorization stuff
     BOL_AuthorizationService::getInstance()->deleteGroup($pluginDto->getKey());
     // drop plugin tables
     $tables = OW::getDbo()->queryForColumnList("SHOW TABLES LIKE '" . str_replace('_', '\\_', OW_DB_PREFIX) . $pluginDto->getKey() . "\\_%'");
     if (!empty($tables)) {
         $query = "DROP TABLE ";
         foreach ($tables as $table) {
             $query .= "`" . $table . "`,";
         }
         $query = substr($query, 0, -1);
         OW::getDbo()->query($query);
     }
     //remove entry in DB
     $this->deletePluginById($pluginDto->getId());
 }