Dolphin Social Networking php script

Mar 15, 2012, by admin

The world’s most popular open-source platform for social networking, dating and community sites . comprises video chat, groups, events, video/photo sharing, builders, status updates, IM, Google OpenSocial, OpenID, Facebook Connect and much more. Comes with iPhone App and Adobe-AIR app . reversed by community of over 50,000 web-masters .

  1. <?php
  2. /***************************************************************************
  3. *                            Dolphin Smart Community Builder
  4. *                              ——————-
  5. *     begin                : Mon Mar 23 2006
  6. *     copyright            : (C) 2007 BoonEx Group
  7. *     website              : http://www.boonex.com
  8. * This file is part of Dolphin – Smart Community Builder
  9. *
  10. * Dolphin is free software; you can redistribute it and/or modify it under
  11. * the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the
  13. * License, or  any later version.
  14. *
  15. * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  16. * without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17. * See the GNU General Public License for more details.
  18. * You should have received a copy of the GNU General Public License along with Dolphin,
  19. * see license.txt file; if not, write to marketing@boonex.com
  20. ***************************************************************************/
  21. define(‘BX_CATEG_ACTION_ALL’, ‘all’);
  22. define(‘BX_CATEG_ACTION_COMMON’, ‘common’);
  23. define(‘BX_CATEG_ACTION_USERS’, ‘users’);
  24. define(‘BX_CATEG_ACTION_CALENDAR’, ‘calendar’);
  25. define(‘BX_CATEG_ACTION_SEARCH’, ‘search’);
  26. require_once( ‘inc/header.inc.php’ );
  27. require_once( BX_DIRECTORY_PATH_INC . ‘design.inc.php’ );
  28. bx_import(‘BxTemplCategories’);
  29. bx_import(‘BxDolPageView’);
  30. bx_import(‘BxTemplCalendar’);
  31. $bAjaxMode = isset($_SERVER[‘HTTP_X_REQUESTED_WITH’]) and $_SERVER[‘HTTP_X_REQUESTED_WITH’] == ‘XMLHttpRequest’ ? true : false;
  32. function showCategories($aParam = array(), $iBoxId = 1, $sAction = ”, $isBox = false, $bOrderPanel = false, $sTitle)
  33. {
  34.  $oCateg = new BxTemplCategories();
  35.  $oCateg->getTagObjectConfig($aParam);
  36.  if (empty($oCateg->aTagObjects))
  37.  {
  38.  if ($isBox)
  39.  return DesignBoxContent($sTitle, MsgBox(_t(‘_Empty’)), 1);
  40.  else
  41.  return MsgBox(_t(‘_Empty’));
  42.  }
  43.  $aParam[‘type’] = isset($_GET[‘tags_mode’]) && isset($oCateg->aTagObjects[$_GET[‘tags_mode’]]) ? $_GET[‘tags_mode’] : $oCateg->getFirstObject();
  44.  $sCode = $oCateg->display($aParam, $iBoxId, $sAction, $bOrderPanel, getParam(‘categ_show_columns’));
  45.  if ($isBox)
  46.  {
  47.  $aCaptionMenu = $oCateg->getCategTopMenuHtml($aParam, $iBoxId, $sAction);
  48.  $sCode = DesignBoxContent($sTitle, $sCode, 1, $aCaptionMenu);
  49.  $sCode = ‘<div id=”page_block_’ . $iBoxId . ‘”>’ . $sCode . ‘<div></div></div>’;
  50.  return $sCode;
  51.  }
  52.  else
  53.  return array(
  54.  $sCode,
  55.  $oCateg->getCategTopMenu($aParam, $sAction),
  56.  array(),
  57.  ($sDate ? _t(‘_categ_by_day’) . $sDate : ”)
  58.  );
  59. }
  60. class CategoriesCalendar extends BxTemplCalendar
  61. {
  62.  function CategoriesCalendar($iYear, $iMonth)
  63.  {
  64.  parent::BxTemplCalendar($iYear, $iMonth);
  65.  }
  66.  function display() {
  67.  $aVars = array (
  68.  ‘bx_repeat:week_names’ => $this->_getWeekNames (),
  69.  ‘bx_repeat:calendar_row’ => $this->_getCalendar (),
  70.  ‘month_prev_url’ => $this->getBaseUri () . “&year={$this->iPrevYear}&month={$this->iPrevMonth}”,
  71.  ‘month_prev_name’ => _t(‘_month_prev’),
  72.  ‘month_prev_icon’ => getTemplateIcon(‘sys_back.png’),
  73.  ‘month_next_url’ => $this->getBaseUri () . “&year={$this->iNextYear}&month={$this->iNextMonth}”,
  74.  ‘month_next_name’ => _t(‘_month_next’),
  75.  ‘month_next_icon’ => getTemplateIcon(‘sys_next.png’),
  76.  ‘month_current’ => $this->getTitle(),
  77.  );
  78.  $sHtml = $GLOBALS[‘oSysTemplate’]->parseHtmlByName(‘calendar.html’, $aVars);
  79.  $sHtml = preg_replace (‘#<bx_repeat:events>.*?</bx_repeat:events>#s’, ”, $sHtml);
  80.  $GLOBALS[‘oSysTemplate’]->addCss(‘calendar.css’);
  81.  return $sHtml;
  82.  }
  83.  function getData()
  84.  {
  85.  $oDb = new BxDolDb();
  86.  return $oDb->getAll(“SELECT *, DAYOFMONTH(`Date`) AS `Day`
  87.  FROM `sys_categories`
  88.  WHERE `Date` >= TIMESTAMP(‘{$this->iYear}-{$this->iMonth}-1’)
  89.  AND `Date` < TIMESTAMP(‘{$this->iNextYear}-{$this->iNextMonth}-1’)
  90.  AND `Owner` <> 0 AND `Status` = ‘active'”);
  91.  }
  92.  function getBaseUri()
  93.  {
  94.  return BX_DOL_URL_ROOT . ‘categories.php?action=calendar’;
  95.  }
  96.  function getBrowseUri()
  97.  {
  98.  return BX_DOL_URL_ROOT . ‘categories.php?action=calendar’;
  99.  }
  100.  function getEntriesNames ()
  101.  {
  102.  return array(_t(‘_categ_single’), _t(‘_categ_plural’));
  103.  }
  104.  function _getCalendar ()
  105.  {
  106.  $sBrowseUri = $this->getBrowseUri();
  107.  list ($sEntriesSingle, $sEntriesMul) = $this->getEntriesNames ();
  108.  $this->_getCalendarGrid($aCalendarGrid);
  109.  $aRet = array ();
  110.  for ($i = 0; $i < 6; $i++) {
  111.  $aRow = array (‘bx_repeat:cell’);
  112.  $isRowEmpty = true;
  113.  for ($j = $this->iWeekStart; $j < $this->iWeekEnd; $j++) {
  114.  $aCell = array ();
  115.  if ($aCalendarGrid[$i][$j][‘today’]) {
  116.  $aCell[‘class’] = ‘sys_cal_cell sys_cal_today’;
  117.  $aCell[‘day’] = $aCalendarGrid[$i][$j][‘day’];
  118.  $aCell[‘bx_if:num’] = array (‘condition’ => $aCalendarGrid[$i][$j][‘num’], ‘content’ => array(
  119.  ‘num’ => $aCalendarGrid[$i][$j][‘num’],
  120.  ‘href’ => $sBrowseUri . ‘&year=’ . $this->iYear . ‘&month=’ . $this->iMonth . ‘&day=’ . $aCell[‘day’],
  121.  ‘entries’ => 1 == $aCalendarGrid[$i][$j][‘num’] ? $sEntriesSingle : $sEntriesMul,
  122.  ));
  123.  $isRowEmpty = false;
  124.  } elseif (isset($aCalendarGrid[$i][$j][‘day’])) {
  125.  $aCell[‘class’] = ‘sys_cal_cell’;
  126.  $aCell[‘day’] = $aCalendarGrid[$i][$j][‘day’];
  127.  $aCell[‘bx_if:num’] = array (‘condition’ => $aCalendarGrid[$i][$j][‘num’], ‘content’ => array(
  128.  ‘num’ => $aCalendarGrid[$i][$j][‘num’],
  129.  ‘href’ => $sBrowseUri . ‘&year=’ . $this->iYear . ‘&month=’ . $this->iMonth . ‘&day=’ . $aCell[‘day’],
  130.  ‘entries’ => 1 == $aCalendarGrid[$i][$j][‘num’] ? $sEntriesSingle : $sEntriesMul,
  131.  ));
  132.  $isRowEmpty = false;
  133.  } else {
  134.  $aCell[‘class’] = ‘sys_cal_cell_blank’;
  135.  $aCell[‘day’] = ”;
  136.  $aCell[‘bx_if:num’] = array (‘condition’ => false, ‘content’ => array(
  137.  ‘num’ => ”,
  138.  ‘href’ => ”,
  139.  ‘entries’ => ”,
  140.  ));
  141.  }
  142.  if ($aCell)
  143.  $aRow[‘bx_repeat:cell’][] = $aCell;
  144.  }
  145.  if ($aRow[‘bx_repeat:cell’] && !$isRowEmpty) {
  146.  $aRet[] = $aRow;
  147.  }
  148.  }
  149.  return $aRet;
  150.  }
  151. }
  152. class CategoriesCalendarPage extends BxDolPageView
  153. {
  154.  var $sPage;
  155.  function CategoriesCalendarPage()
  156.  {
  157.  $this->sPage = ‘categ_calendar’;
  158.  parent::BxDolPageView($this->sPage);
  159.  }
  160.  function getBlockCode_Calendar($iBlockId)
  161.  {
  162.  $sYear = isset($_GET[‘year’]) ? (int)$_GET[‘year’] : ”;
  163.  $sMonth = isset($_GET[‘month’]) ? (int)$_GET[‘month’] : ”;
  164.  $oCalendar = new CategoriesCalendar($sYear, $sMonth);
  165.  return $oCalendar->display();
  166.  }
  167.  function getBlockCode_CategoriesDate($iBlockId)
  168.  {
  169.  if (isset($_GET[‘year’]) && isset($_GET[‘month’]) && isset($_GET[‘day’]))
  170.  {
  171.  $aParam = array(
  172.  ‘pagination’ => getParam(‘categ_perpage_browse’),
  173.  ‘date’ => array(
  174.  ‘year’ => (int)$_GET[‘year’],
  175.  ‘month’ => (int)$_GET[‘month’],
  176.  ‘day’ => (int)$_GET[‘day’]
  177.  )
  178.  );
  179.  return showCategories($aParam, $iBlockId, BX_CATEG_ACTION_CALENDAR, false, false, _t(‘_categ_caption_calendar’));
  180.  }
  181.  else
  182.  return MsgBox(_t(‘_Empty’));
  183.  }
  184. }
  185. class CategoriesSearchPage extends BxDolPageView {
  186.  var $aSearchForm;
  187.  var $oForm;
  188.  var $sPage;
  189.  function CategoriesSearchPage()
  190.  {
  191.  $this->sPage = ‘categ_search’;
  192.  parent::BxDolPageView($this->sPage);
  193.  bx_import(‘BxTemplFormView’);
  194.  $this->aSearchForm = array(
  195.  ‘form_attrs’ => array(
  196.  ‘name’     => ‘form_search_categories’,
  197.  ‘action’   => ”,
  198.  ‘method’   => ‘post’,
  199.  ),
  200.  ‘params’ => array (
  201.  ‘db’ => array(
  202.  ‘submit_name’ => ‘submit_form’,
  203.  ),
  204.  ),
  205.  ‘inputs’ => array(
  206.  ‘Keyword’ => array(
  207.  ‘type’ => ‘text’,
  208.  ‘name’ => ‘Keyword’,
  209.  ‘caption’ => _t(‘_categ_caption_keyword’),
  210.  ‘required’ => true,
  211.  ‘checker’ => array (
  212.  ‘func’ => ‘length’,
  213.  ‘params’ => array(1, 100),
  214.  ‘error’ => _t (‘_categ_err_keyword’),
  215.  ),
  216.  ‘db’ => array (
  217.  ‘pass’ => ‘Xss’,
  218.  ),
  219.  ),
  220.  ‘Submit’ => array (
  221.  ‘type’ => ‘submit’,
  222.  ‘name’ => ‘submit_form’,
  223.  ‘value’ => _t(‘_Submit’),
  224.  ‘colspan’ => true,
  225.  ),
  226.  ),
  227.  );
  228.  $this->oForm = new BxTemplFormView($this->aSearchForm);
  229.  $this->oForm->initChecker();
  230.  }
  231.  function getBlockCode_Form()
  232.  {
  233.  return $GLOBALS[‘oSysTemplate’]->parseHtmlByName(‘search_tags_box.html’, array(‘form’ => $this->oForm->getCode()));
  234.  }
  235.  function getBlockCode_Founded($iBlockId)
  236.  {
  237.  $aParam = array(
  238.  ‘pagination’ => getParam(‘categ_perpage_browse’)
  239.  );
  240.  $sFilter = bx_get(‘filter’);
  241.  if ($sFilter !== false)
  242.  $aParam[‘filter’] = process_db_input($sFilter);
  243.  else if ($this->oForm->isSubmittedAndValid())
  244.  $aParam[‘filter’] = $this->oForm->getCleanValue(‘Keyword’);
  245.  if (isset($aParam[‘filter’]))
  246.  return showCategories($aParam, $iBlockId, BX_CATEG_ACTION_SEARCH, false, false, _t(‘_categ_caption_founded_categ’));
  247.  else
  248.  return MsgBox(_t(‘_Empty’));
  249.  }
  250. }
  251. function getPage_All()
  252. {
  253.  $aParam = array(
  254.  ‘pagination’ => getParam(‘categ_perpage_browse’)
  255.  );
  256.  return showCategories($aParam, 1, BX_CATEG_ACTION_ALL, true, true, _t(‘_categ_caption_all’));
  257. }
  258. function getPage_Common()
  259. {
  260.  $aParam = array(
  261.  ‘pagination’ => getParam(‘categ_perpage_browse’),
  262.  ‘common’ => true,
  263.  );
  264.  return showCategories($aParam, 1, BX_CATEG_ACTION_COMMON, true, false, _t(‘_categ_caption_common’));
  265. }
  266. function getPage_Users()
  267. {
  268.  $aParam = array(
  269.  ‘pagination’ => getParam(‘categ_perpage_browse’),
  270.  ‘common’ => false
  271.  );
  272.  return showCategories($aParam, 1, BX_CATEG_ACTION_USERS, true, false, _t(‘_categ_caption_users’));
  273. }
  274. function getPage_Calendar()
  275. {
  276.  $oCalendarPage = new CategoriesCalendarPage();
  277.  return $oCalendarPage->getCode();
  278. }
  279. function getPage_Search()
  280. {
  281.  $oSearchPage = new CategoriesSearchPage();
  282.  return $oSearchPage->getCode();
  283. }
  284. $sAction = empty($_GET[‘action’]) ? ” : $_GET[‘action’];
  285. switch ($sAction)
  286. {
  287.  case BX_CATEG_ACTION_COMMON:
  288.  $sContent = getPage_Common();
  289.  break;
  290.  case BX_CATEG_ACTION_USERS:
  291.  $sContent = getPage_Users();
  292.  break;
  293.  case BX_CATEG_ACTION_CALENDAR:
  294.  $sContent = getPage_Calendar();
  295.  break;
  296.  case BX_CATEG_ACTION_SEARCH:
  297.  $sContent = getPage_Search();
  298.  break;
  299.  default:
  300.  $sContent = getPage_All();
  301. }
  302. if (!$bAjaxMode)
  303. {
  304.  global $_page;
  305.  global $_page_cont;
  306.  $iIndex = 25;
  307.  $_page[‘name_index’]    = $iIndex;
  308.  $_page[‘css_name’]      = ‘tags.css’;
  309.  $_page[‘header’] = _t(‘_Categories’);
  310.  $_page[‘header_text’] = _t(‘_Categories’);
  311.  $_page_cont[$iIndex][‘page_main_code’] = $sContent;
  312.  check_logged();
  313.  PageCode();
  314. }
  315. else
  316.  echo $sContent;
  317. ?>
  318. &nbsp;