Exemplo n.º 1
0
function get($id)
{
    $id = getID($id);
    static $q = null;
    \cf\createStaticQuery($q, "SELECT id, code, name, action, method, template FROM cf_form WHERE id=:id");
    $form = \cf\query2array($q, array('id' => $id));
    if ($form['template']) {
        $form['template'] = \cf\query2array("\n\t\t\tSELECT name, subject, recipient, body \n\t\t\tFROM cf_mail_templates \n\t\t\tWHERE id=:id", array('id' => $form['template']));
    } else {
        $form['template'] = false;
    }
    static $qFields = null;
    \cf\createStaticQuery($qFields, "\n\t\tSELECT code,type,name,fmt,descr,mandatory,max_length,min_length,value\n\t\tFROM cf_form_field\n\t\tWHERE form_id=:id\n\t\tORDER BY sort_order\n\t");
    $form['fields'] = \cf\query2arrays($qFields, array('id' => $id), false, 'code');
    foreach ($form['fields'] as &$f) {
        $f['code'] = $form['code'] . '[' . $f['code'] . ']';
        if ($f['type'] == 'radio' || $f['type'] == 'checkbox') {
            $f['options'] = array();
            foreach (explode(';', $f['fmt']) as $option) {
                $f['options'][] = trim($option);
            }
        }
    }
    return $form;
}
Exemplo n.º 2
0
    public function getDuoshuoScript()
    {
        $short_name = $this->getConf('shortname');
        $wiki_id = getID();
        $wiki_title = tpl_pagetitle($wiki_id, true);
        $host = $_SERVER['HTTPS'] ? "https" : "http";
        $host = $host . "://" . $_SERVER['SERVER_NAME'];
        $wiki_url = $host . wl($wiki_id);
        $doc = '
        <!-- 多说评论框 start -->
    <div class="ds-thread" data-thread-key="" data-title="' . $wiki_title . '" data-url="' . $wiki_url . '"></div>
<!-- 多说评论框 end -->
<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
<script type="text/javascript">
var duoshuoQuery = {short_name:"' . $short_name . '"};
    (function() {
        var ds = document.createElement("script");
        ds.type = "text/javascript";ds.async = true;
        ds.src = (document.location.protocol == "https:" ? "https:" : "http:") + "//static.duoshuo.com/embed.js";
        ds.charset = "UTF-8";
        (document.getElementsByTagName("head")[0] 
         || document.getElementsByTagName("body")[0]).appendChild(ds);
    })();
    </script>
<!-- 多说公共JS代码 end -->';
        return $doc;
    }
Exemplo n.º 3
0
 /**
  * @param toiminto Toiminnon nimi jossa kyseinen komponentti sijaitsee.
  */
 function Component($toiminto)
 {
     $this->ID = getID(get_class($this));
     $this->TM = TranslationManager::instance();
     $this->toiminto = $toiminto;
     $_SESSION['IDS'][$this->ID] = 1;
 }
Exemplo n.º 4
0
 /**
  * Load the needed libraries and initialize the named oAuth service
  *
  * @param string $servicename
  * @return null|\OAuth\Plugin\AbstractAdapter
  */
 public function loadService(&$servicename)
 {
     $id = getID();
     // $ID isn't set in trustExternal, yet
     $servicename = preg_replace('/[^a-zA-Z_]+/', '', $servicename);
     if (!$servicename) {
         return null;
     }
     require_once __DIR__ . '/phpoauthlib/src/OAuth/bootstrap.php';
     require_once __DIR__ . '/classes/AbstractAdapter.php';
     require_once __DIR__ . '/classes/oAuthHTTPClient.php';
     require_once __DIR__ . '/classes/oAuthStorage.php';
     $file = __DIR__ . '/classes/' . $servicename . 'Adapter.php';
     if (!file_exists($file)) {
         return null;
     }
     require_once $file;
     $class = '\\OAuth\\Plugin\\' . $servicename . 'Adapter';
     /** @var \OAuth\Plugin\AbstractAdapter $service */
     $service = new $class($this->redirectURI());
     if (!$service->isInitialized()) {
         msg("Failed to initialize {$service} authentication service. Check credentials", -1);
         return null;
     }
     // The generic service can be externally configured
     if (is_a($service->oAuth, 'OAuth\\OAuth2\\Service\\Generic')) {
         $service->oAuth->setAuthorizationEndpoint($this->getAuthEndpoint($servicename));
         $service->oAuth->setAccessTokenEndpoint($this->getTokenEndpoint($servicename));
     }
     return $service;
 }
Exemplo n.º 5
0
function get($id)
{
    $id = getID($id);
    static $q = null;
    \cf\createStaticQuery($q, "SELECT IFNULL(code,id) AS id, file, file_name, file FROM cf_file WHERE id=:id");
    return \cf\query2array($q, array('id' => $id));
}
function isBlog()
{
    if (getRootNS(getID()) == 'blog' || noNSorNS(getID()) == 'blog') {
        return true;
    } else {
        return false;
    }
}
Exemplo n.º 7
0
function Add($No, $isLast, $pdo)
{
    $id = getID($No, $pdo);
    $data = Fetch_Data($id, $pdo);
    $last = $isLast;
    $name = $data['Name'];
    $phone = $data['phone'];
    $email = $data['email'];
    memberList($No, $id, $name, $phone, $email, $last);
}
function checkNS($ns)
{
    // This tests for root NS or pagename
    //if ( (getRootNS(getID()) == $ns) || (noNSorNS(getID()) == $ns ) ) {
    // This version just tests the namespace, not a pagename.
    if (getRootNS(getID()) == $ns) {
        return true;
    }
    return false;
}
 function getSearchObject()
 {
     list($sParamName, $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3) = $this->aAddParams;
     bx_import('Search', $this->oModule->_aModule);
     $sClassName = $this->oConfig->getClassPrefix() . 'Search';
     $oSearch = new $sClassName($sParamValue, $sParamValue1, $sParamValue2, $sParamValue3);
     if (!empty($sParamValue) && !empty($sParamValue1) && isset($oSearch->aCurrent['restriction'][$sParamValue])) {
         $oSearch->aCurrent['restriction'][$sParamValue]['value'] = 'owner' == $sParamValue ? getID($sParamValue1) : $sParamValue1;
     }
     return $oSearch;
 }
Exemplo n.º 10
0
 protected function determineLang()
 {
     /** @var helper_plugin_translation $trans */
     $trans = plugin_load('helper', 'translation');
     if ($trans) {
         $value = $trans->getLangPart(getID());
         if ($value) {
             return $value;
         }
     }
     global $conf;
     return $conf['lang'];
 }
 public function onInitLangLoad(Doku_Event $event, $param = null)
 {
     $id = getID();
     if (page_exists($id)) {
         return;
     }
     $page = $this->getActivity($id);
     if ($page instanceof \SimpleXMLElement && $page->attributes()->redirect == 'true' && !empty($page->attributes()->new_id)) {
         header("HTTP/1.1 301 Moved Permanently");
         header("Location: " . wl($page->attributes()->new_id));
         die;
     }
     // else just notify spiders page does not exist 404, instead of 200
     header("HTTP/1.1 404 Not Found");
 }
Exemplo n.º 12
0
 /**
  * [Custom event handler which performs action]
  *
  * @param Doku_Event $event event object by reference
  * @param mixed $param [the parameters passed as fifth argument to register_hook() when this
  *                           handler was registered]
  * @return void
  */
 public function handle_ajax_call_unknown(Doku_Event &$event, $param)
 {
     if ($event->data != 'rating') {
         return;
     }
     $event->preventDefault();
     $event->stopPropagation();
     global $ID;
     $ID = getID();
     // let the other handler do it
     $this->handle_vote($event, $param);
     /** @var helper_plugin_rating $hlp */
     $hlp = plugin_load('helper', 'rating');
     $hlp->tpl(true);
 }
Exemplo n.º 13
0
 /**
  * getID with given id in url and userewrite=2, no basedir set, dokuwiki not in document root.
  */
 function test3()
 {
     global $conf;
     $conf['basedir'] = '';
     $conf['userewrite'] = '2';
     $conf['baseurl'] = '';
     $_SERVER['DOCUMENT_ROOT'] = '/var/www/';
     $_SERVER['SCRIPT_FILENAME'] = '/usr/share/dokuwiki/doku.php';
     $_SERVER['SCRIPT_NAME'] = '/dokuwiki/doku.php';
     $_SERVER['REQUEST_URI'] = '/dokuwiki/doku.php/wiki:dokuwiki';
     $_SERVER['PATH_INFO'] = '/wiki:dokuwiki';
     $_SERVER['PATH_TRANSLATED'] = '/var/www/wiki:dokuwiki';
     $_SERVER['PHP_SELF'] = '/dokuwiki/doku.php/wiki:dokuwiki';
     $this->assertEqual(getID(), 'wiki:dokuwiki');
 }
Exemplo n.º 14
0
 function getUserLocation($sUser, $sPwd, $sNick)
 {
     if (!($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
         return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
     }
     $iProfileId = getID($sNick, false);
     $aLocation = BxDolService::call('wmap', 'get_location', array('profiles', $iProfileId, $iId));
     if (-1 == $aLocation) {
         return new xmlrpcval("-1");
     }
     if (!is_array($aLocation)) {
         return new xmlrpcval("0");
     }
     return new xmlrpcval(array('lat' => new xmlrpcval($aLocation['lat']), 'lng' => new xmlrpcval($aLocation['lng']), 'zoom' => new xmlrpcval($aLocation['zoom']), 'type' => new xmlrpcval($aLocation['type']), 'address' => new xmlrpcval($aLocation['address']), 'country' => new xmlrpcval($aLocation['country'])), 'struct');
 }
Exemplo n.º 15
0
function search($term)
{
    global $name, $path, $TweetsPulled, $TweetsAnalyzed, $tweets;
    $name = $term;
    $path = "Cache Files/cache" . $name . ".txt";
    $id = getID($name);
    $pic = getProfilePic($id, $name);
    $max_id = getNextID($path);
    //gets next tweet to cache, creates file if new cache to be made
    $tweets = getTweets($name, $id, $TweetsPulled, $max_id);
    if (!isset($tweets) || count($tweets) < 1) {
        echo "<script> alert('Bad Twitter Handle'); </script>";
        return;
    }
    $res = parseData($tweets, $TweetsAnalyzed);
}
Exemplo n.º 16
0
 /**
  * AJAX call handler for ACL plugin
  *
  * @param Doku_Event $event  event object by reference
  * @param mixed $param  empty
  * @return void
  */
 public function handle_ajax_call_acl(Doku_Event &$event, $param)
 {
     if ($event->data !== 'plugin_acl') {
         return;
     }
     $event->stopPropagation();
     $event->preventDefault();
     global $ID;
     global $INPUT;
     if (!auth_isadmin()) {
         echo 'for admins only';
         return;
     }
     if (!checkSecurityToken()) {
         echo 'CRSF Attack';
         return;
     }
     $ID = getID();
     /** @var $acl admin_plugin_acl */
     $acl = plugin_load('admin', 'acl');
     $acl->handle();
     $ajax = $INPUT->str('ajax');
     header('Content-Type: text/html; charset=utf-8');
     if ($ajax == 'info') {
         $acl->_html_info();
     } elseif ($ajax == 'tree') {
         $ns = $INPUT->str('ns');
         if ($ns == '*') {
             $ns = '';
         }
         $ns = cleanID($ns);
         $lvl = count(explode(':', $ns));
         $ns = utf8_encodeFN(str_replace(':', '/', $ns));
         $data = $acl->_get_tree($ns, $ns);
         foreach (array_keys($data) as $item) {
             $data[$item]['level'] = $lvl + 1;
         }
         echo html_buildlist($data, 'acl', array($acl, '_html_list_acl'), array($acl, '_html_li_acl'));
     }
 }
Exemplo n.º 17
0
function getAllMembersSQL($groupName, $grouptype)
{
    if ($grouptype == "InGame") {
        $groupName2 = str_replace(" ", "+", $groupName);
        $groupID = (int) getID($groupName2)["ownerID"];
        $isCorp = (int) getID($groupName2)["ownerGroupID"];
        if ($isCorp == 2) {
            return ' AND (corporationName ="' . $groupName . '") ';
        } else {
            if ($isCorp == 32) {
                return ' AND (allianceName ="' . $groupName . '") ';
            } else {
                if ($isCorp == 1) {
                    return ' AND (characterName ="' . $groupName . '") ';
                } else {
                    echo "No Corp or Alliance with this name exists, please check spelling.";
                }
            }
        }
    } elseif ($grouptype == "rischwa") {
        $groupName = str_replace("+", " ", $groupName);
        return getCoalitonAlliances($groupName);
    }
}
Exemplo n.º 18
0
/**
 * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
 * CC-BY License - http://creativecommons.org/licenses/by/3.0/
 */
require_once '../inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
bx_import('BxRSS');
bx_import('BxDolAdminDashboard');
define('BX_DOL_ADMIN_INDEX', 1);
$bLogged = isLogged();
$bNeedCheck = $bLogged && isAdmin() && $_POST['relocate'] && strncasecmp($_POST['relocate'], BX_DOL_URL_ADMIN . 'license.php', strlen(BX_DOL_URL_ADMIN . 'license.php')) == 0;
if ($bNeedCheck || isset($_POST['ID']) && isset($_POST['Password'])) {
    $iId = getID($_POST['ID']);
    $sPassword = process_pass_data($_POST['Password']);
    if (!$bLogged) {
        $oZ = new BxDolAlerts('profile', 'before_login', 0, 0, array('login' => $iId, 'password' => $sPassword, 'ip' => getVisitorIP()));
        $oZ->alert();
    }
    if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
        echo check_password($iId, $sPassword, BX_DOL_ROLE_ADMIN, false) ? 'OK' : 'Fail';
    } else {
        if ($bNeedCheck || check_password($iId, $sPassword, BX_DOL_ROLE_ADMIN)) {
            if ($_POST['relocate'] && (strncasecmp($_POST['relocate'], BX_DOL_URL_ROOT, strlen(BX_DOL_URL_ROOT)) == 0 || strncasecmp($_POST['relocate'], BX_DOL_URL_ADMIN . 'license.php', strlen(BX_DOL_URL_ADMIN . 'license.php')) == 0)) {
                $sUrlRelocate = $_POST['relocate'];
            } else {
                $sUrlRelocate = BX_DOL_URL_ADMIN . 'index.php';
            }
            $sUrlRelocate = bx_html_attribute($sUrlRelocate);
/**
 * Friend's member authentocation and setting up cookies
 **/
function SetCookieFromFriend()
{
    global $en_aff;
    if ($en_aff && $_GET['idFriend']) {
        $idFriend = getID($_GET['idFriend'], 1);
        if ($idFriend) {
            setcookie("idFriend", $idFriend, time() + 10000 * 3600, "/");
        }
    }
}
Exemplo n.º 20
0
define('DOKU_MEDIADETAIL', 1);
require_once DOKU_INC . 'inc/init.php';
//close session
session_write_close();
$IMG = getID('media');
$ID = cleanID($INPUT->str('id'));
if ($conf['allowdebug'] && $INPUT->has('debug')) {
    print '<pre>';
    foreach (explode(' ', 'basedir userewrite baseurl useslash') as $x) {
        print '$' . "conf['{$x}'] = '" . $conf[$x] . "';\n";
    }
    foreach (explode(' ', 'DOCUMENT_ROOT HTTP_HOST SCRIPT_FILENAME PHP_SELF ' . 'REQUEST_URI SCRIPT_NAME PATH_INFO PATH_TRANSLATED') as $x) {
        print '$' . "_SERVER['{$x}'] = '" . $_SERVER[$x] . "';\n";
    }
    print "getID('media'): " . getID('media') . "\n";
    print "getID('media',false): " . getID('media', false) . "\n";
    print '</pre>';
}
$ERROR = false;
// check image permissions
$AUTH = auth_quickaclcheck($IMG);
if ($AUTH >= AUTH_READ) {
    // check if image exists
    $SRC = mediaFN($IMG);
    if (!@file_exists($SRC)) {
        //doesn't exist!
        header("HTTP/1.0 404 File not Found");
        $ERROR = 'File not found';
    }
} else {
    // no auth
Exemplo n.º 21
0
 function __construct($sMode = '', $sValue = '', $sValue2 = '', $sValue3 = '')
 {
     switch ($sMode) {
         case 'pending':
             if (false !== bx_get('bx_store_filter')) {
                 $this->aCurrent['restriction']['keyword'] = array('value' => process_db_input(bx_get('bx_store_filter'), BX_TAGS_STRIP), 'field' => '', 'operator' => 'against');
             }
             $this->aCurrent['restriction']['activeStatus']['value'] = 'pending';
             $this->sBrowseUrl = "administration";
             $this->aCurrent['title'] = _t('_bx_store_page_title_pending_approval');
             unset($this->aCurrent['rss']);
             break;
         case 'my_pending':
             $oMain = $this->getMain();
             $this->aCurrent['restriction']['owner']['value'] = $oMain->_iProfileId;
             $this->aCurrent['restriction']['activeStatus']['value'] = 'pending';
             $this->sBrowseUrl = "browse/user/" . getNickName($oMain->_iProfileId);
             $this->aCurrent['title'] = _t('_bx_store_page_title_pending_approval');
             unset($this->aCurrent['rss']);
             break;
         case 'search':
             if ($sValue) {
                 $this->aCurrent['restriction']['keyword'] = array('value' => $sValue, 'field' => '', 'operator' => 'against');
             }
             if ($sValue2) {
                 $this->aCurrent['join']['category'] = array('type' => 'inner', 'table' => 'sys_categories', 'mainField' => 'id', 'onField' => 'ID', 'joinFields' => '');
                 $this->aCurrent['restriction']['category_type']['value'] = $this->aCurrent['name'];
                 $this->aCurrent['restriction']['category']['value'] = $sValue2;
                 if (is_array($sValue2)) {
                     $this->aCurrent['restriction']['category']['operator'] = 'in';
                 }
             }
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $sValue2 = $GLOBALS['MySQL']->unescape($sValue2);
             $this->sBrowseUrl = "search/{$sValue}/" . (is_array($sValue2) ? implode(',', $sValue2) : $sValue2);
             $this->aCurrent['title'] = _t('_bx_store_page_title_search_results') . ' ' . (is_array($sValue2) ? implode(', ', $sValue2) : $sValue2) . ' ' . $sValue;
             unset($this->aCurrent['rss']);
             break;
         case 'user':
             $iProfileId = $GLOBALS['oBxStoreModule']->_oDb->getProfileIdByNickName($sValue, false);
             $GLOBALS['oTopMenu']->setCurrentProfileID($iProfileId);
             // select profile subtab, instead of module tab
             if (!$iProfileId) {
                 $this->isError = true;
             } else {
                 $this->aCurrent['restriction']['owner']['value'] = $iProfileId;
             }
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $this->sBrowseUrl = "browse/user/{$sValue}";
             $iProfileId = getID($sValue);
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_by_author', $iProfileId ? getNickName($iProfileId) : $sValue);
             if (bx_get('rss')) {
                 $aData = getProfileInfo($iProfileId);
                 if ($aData['Avatar']) {
                     $a = array('ID' => $aData['author_id'], 'Avatar' => $aData['thumb']);
                     $aImage = BxDolService::call('photos', 'get_image', array($a, 'browse'), 'Search');
                     if (!$aImage['no_image']) {
                         $this->aCurrent['rss']['image'] = $aImage['file'];
                     }
                 }
             }
             break;
         case 'admin':
             $this->aCurrent['restriction']['owner']['value'] = 0;
             $this->sBrowseUrl = "browse/admin";
             $this->aCurrent['title'] = _t('_bx_store_page_title_admin_products');
             break;
         case 'category':
             $this->aCurrent['join']['category'] = array('type' => 'inner', 'table' => 'sys_categories', 'mainField' => 'id', 'onField' => 'ID', 'joinFields' => '');
             $this->aCurrent['restriction']['category_type']['value'] = $this->aCurrent['name'];
             $this->aCurrent['restriction']['category']['value'] = $sValue;
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $this->sBrowseUrl = "browse/category/" . title2uri($sValue);
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_by_category', $sValue);
             break;
         case 'tag':
             $this->aCurrent['restriction']['tag']['value'] = $sValue;
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $this->sBrowseUrl = "browse/tag/" . title2uri($sValue);
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_by_tag', $sValue);
             break;
         case 'free':
             $this->aCurrent['restriction']['price'] = array('value' => 'Free', 'field' => 'price_range', 'operator' => '=');
             $this->sBrowseUrl = "browse/free";
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_free_products') . ' ' . $sValue;
             break;
         case 'recent':
             $this->sBrowseUrl = 'browse/recent';
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_recent');
             break;
         case 'top':
             $this->sBrowseUrl = 'browse/top';
             $this->aCurrent['sorting'] = 'top';
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_top_rated');
             break;
         case 'popular':
             $this->sBrowseUrl = 'browse/popular';
             $this->aCurrent['sorting'] = 'popular';
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_popular');
             break;
         case 'featured':
             $this->aCurrent['restriction']['featured'] = array('value' => 1, 'field' => 'featured', 'operator' => '=');
             $this->sBrowseUrl = 'browse/featured';
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_featured');
             break;
         case 'calendar':
             $this->aCurrent['restriction']['calendar-min'] = array('value' => "UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 00:00:00')", 'field' => 'created', 'operator' => '>=', 'no_quote_value' => true);
             $this->aCurrent['restriction']['calendar-max'] = array('value' => "UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 23:59:59')", 'field' => 'created', 'operator' => '<=', 'no_quote_value' => true);
             $this->sEventsBrowseUrl = "browse/calendar/{$sValue}/{$sValue2}/{$sValue3}";
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_by_day', getLocaleDate(strtotime("{$sValue}-{$sValue2}-{$sValue3}"), BX_DOL_LOCALE_DATE_SHORT));
             break;
         case '':
             $this->sBrowseUrl = 'browse/';
             $this->aCurrent['title'] = _t('_bx_store');
             unset($this->aCurrent['rss']);
             break;
         default:
             $this->isError = true;
     }
     $oMain = $this->getMain();
     $this->aCurrent['paginate']['perPage'] = $oMain->_oDb->getParam('bx_store_perpage_browse');
     if (isset($this->aCurrent['rss'])) {
         $this->aCurrent['rss']['link'] = BX_DOL_URL_ROOT . $oMain->_oConfig->getBaseUri() . $this->sBrowseUrl;
     }
     if (bx_get('rss')) {
         $this->aCurrent['ownFields'][] = 'desc';
         $this->aCurrent['ownFields'][] = 'created';
         $this->aCurrent['paginate']['perPage'] = $oMain->_oDb->getParam('bx_store_max_rss_num');
     }
     bx_store_import('Voting', $this->getModuleArray());
     $oVotingView = new BxStoreVoting('bx_store', 0);
     $this->oVotingView = $oVotingView->isEnabled() ? $oVotingView : null;
     $this->sFilterName = 'bx_store_filter';
     parent::__construct();
 }
Exemplo n.º 22
0
$this->setSidebar(true);
try {
    $acl = new Acl(USER_ID);
    if (!$acl->Access("x")) {
        throw new Exception("Access denied");
    }
    $action = isset($this->args["var_a"]) ? $this->args['var_a'] : "";
    $tpl = new Template(PATH_APPLICATIONS . "admin/tpl/members/");
    switch ($action) {
        default:
            $tpl->loadFile("main.php");
            break;
        case 'edit':
            $tpl->userid = getID($this->args['var_b']) ? getID($this->args['var_b']) : 0;
            $tpl->loadFile("edit.php");
            break;
        case 'log':
            $tpl->userid = getID($this->args['var_b']) ? getID($this->args['var_b']) : 0;
            $tpl->loadFile("log.php");
            break;
        case 'create':
            $tpl->loadFile("create.php");
            break;
    }
    $tpl->build();
} catch (Exception $e) {
    echo error(_t($e->getMessage()));
}
?>

Exemplo n.º 23
0
 function registerMember()
 {
     $bEnAff = getParam('en_aff') == 'on';
     $oPC = new BxDolProfilesController();
     //convert to profile
     $aProfile = $this->oPF->getProfileFromValues($this->aValues[0]);
     //create it
     list($iMemID, $sStatus) = $oPC->createProfile($aProfile);
     if (!$iMemID) {
         return array(false, 'Fail');
     }
     if ($this->bCouple) {
         //convert
         $aProfile = $this->oPF->getProfileFromValues($this->aValues[1]);
         //create
         list($iMem1ID, $sStatus1) = $oPC->createProfile($aProfile, false, $iMemID);
         if (!$iMem1ID) {
             $oPC->deleteProfile($iMemID);
             return array(false, 'Fail');
         }
     }
     //send new user notification
     if (getParam('newusernotify') == 'on') {
         $oPC->sendNewUserNotify($iMemID);
     }
     // Affiliate and friend checking
     if ($bEnAff && $_COOKIE['idAff']) {
         $vRes = db_res("SELECT `ID` FROM `aff` WHERE `ID` = {$_COOKIE['idAff']} AND `Status` = 'active'");
         if (mysql_num_rows($vRes)) {
             $vRes = db_res("INSERT INTO `aff_members` (`idAff`,`idProfile`) VALUES ('{$_COOKIE['idAff']}', '{$iMemID}')");
         }
     }
     if ($bEnAff && $_COOKIE['idFriend']) {
         $iFriendID = getID($_COOKIE['idFriend']);
         if ($iFriendID) {
             $vRes = db_res("UPDATE `Profiles` SET `aff_num` = `aff_num` + 1 WHERE `ID` = '{$iFriendID}'");
             createUserDataFile($iFriendID);
         }
     }
     reparseObjTags('profile', $iMemID);
     return array($iMemID, $sStatus);
 }
Exemplo n.º 24
0
/**
 * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
 * CC-BY License - http://creativecommons.org/licenses/by/3.0/
 */
define('BX_JOIN_PAGE', 1);
require_once './inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'admin.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'db.inc.php';
bx_import('BxTemplJoinPageView');
check_logged();
if (isLogged()) {
    header('Location:' . BX_DOL_URL_ROOT . 'member.php');
    exit;
}
$_page['header'] = _t('_JOIN_H');
$_page['header_text'] = _t('_JOIN_H');
if (getParam('reg_by_inv_only') == 'on' && getID($_COOKIE['idFriend']) == 0) {
    $_page['name_index'] = 0;
    $_page_cont[0]['page_main_code'] = MsgBox(_t('_registration by invitation only'));
    PageCode();
    exit;
}
$_page['name_index'] = 81;
$_ni = $_page['name_index'];
$oJoinView = new BxTemplJoinPageView();
$_page_cont[$_ni]['page_main_code'] = $oJoinView->getCode();
$GLOBALS['oSysTemplate']->addJsTranslation('_Errors in join form');
$GLOBALS['oSysTemplate']->addJs(array('join.js', 'jquery.form.min.js'));
$GLOBALS['oSysTemplate']->addCss(array('join.css', 'explanation.css'));
PageCode();
Exemplo n.º 25
0
if (isset($_SERVER['HTTP_X_DOKUWIKI_DO'])) {
    $ACT = trim(strtolower($_SERVER['HTTP_X_DOKUWIKI_DO']));
} elseif (!empty($_REQUEST['idx'])) {
    $ACT = 'index';
} elseif (isset($_REQUEST['do'])) {
    $ACT = $_REQUEST['do'];
} else {
    $ACT = 'show';
}
// load and initialize the core system
require_once DOKU_INC . 'inc/init.php';
//import variables
$INPUT->set('id', str_replace("­", '', $INPUT->str('id')));
//soft-hyphen
$QUERY = trim($INPUT->str('id'));
$ID = getID();
$REV = $INPUT->int('rev');
$IDX = $INPUT->str('idx');
$DATE = $INPUT->int('date');
$RANGE = $INPUT->str('range');
$HIGH = $INPUT->param('s');
if (empty($HIGH)) {
    $HIGH = getGoogleQuery();
}
if ($INPUT->post->has('wikitext')) {
    $TEXT = cleanText($INPUT->post->str('wikitext'));
}
$PRE = cleanText(substr($INPUT->post->str('prefix'), 0, -1));
$SUF = cleanText($INPUT->post->str('suffix'));
$SUM = $INPUT->post->str('summary');
//make infos about the selected page available
Exemplo n.º 26
0
     $db->delete("friend_receiver = '" . USER_ID . "' AND friend_sender = '" . $friend_id . "' AND friend_status='0'");
     if ($db->affectedRows()) {
         //$notif->add($friend_id, "friend", json_encode(array("type" => "decline", "user" => USER_ID)));
         break;
     }
 case 'remove':
     $friend_id = getID($this->args['var_b']);
     $db = new DB("friends");
     $db->delete("friend_receiver = '" . $friend_id . "' AND friend_sender = '" . USER_ID . "' AND friend_status='1'");
     $db->delete("friend_receiver = '" . USER_ID . "' AND friend_sender = '" . $friend_id . "' AND friend_status='1'");
     if ($db->affectedRows()) {
         //$notif->add($friend_id, "friend", json_encode(array("type" => "remove", "user" => USER_ID)));
         break;
     }
 case 'add':
     $friend_id = getID($this->args['var_b']);
     if ($friend_id == USER_ID) {
         throw new Exception("Cannot add your self as friend");
     }
     $db = new DB("friends");
     $db->select("friend_receiver = '" . $friend_id . "' AND friend_sender = '" . USER_ID . "'");
     if (!$db->numRows()) {
         $db->nextRecord();
         if ($db->status == 0) {
             $db = new DB("friends");
             $db->friend_sender = USER_ID;
             $db->friend_receiver = $friend_id;
             $db->friend_status = 0;
             $db->insert();
             echo notice(_t("a friend request has been sent"));
         } else {
Exemplo n.º 27
0
 /**
  * Create new profile;
  *
  * @param  : $aProfileInfo (array) - remote profile's information;
  *
  * @param  : $sAlternativeName (string) - profiles alternative nickname;
  * @return : error string or error or profile info array on success
  */
 function _createProfileRaw($aProfileInfo, $sAlternativeName = '', $isAutoFriends = true, $isSetLoggedIn = true)
 {
     $sCountry = '';
     $sCity = '';
     // join by invite only
     if (getParam('reg_by_inv_only') == 'on' && (!isset($_COOKIE['idFriend']) || getID($_COOKIE['idFriend']) == 0)) {
         return _t('_registration by invitation only');
     }
     // convert fields
     $aProfileFields = $this->_convertRemoteFields($aProfileInfo, $sAlternativeName);
     if (empty($aProfileFields['Email'])) {
         return _t('_Incorrect Email');
     }
     // antispam check
     bx_import('BxDolStopForumSpam');
     $oBxDolStopForumSpam = new BxDolStopForumSpam();
     if (2 == getParam('ipBlacklistMode') && bx_is_ip_blocked()) {
         return _t('_Sorry, your IP been banned');
     } elseif ('on' == getParam('sys_dnsbl_enable') && 'block' == getParam('sys_dnsbl_behaviour') && bx_is_ip_dns_blacklisted('', 'join oauth') || $oBxDolStopForumSpam->isSpammer(array('email' => $aProfileFields['Email'], 'ip' => getVisitorIP(false)), 'join oauth')) {
         return sprintf(_t('_sys_spam_detected'), BX_DOL_URL_ROOT . 'contact.php');
     }
     // check fields existence;
     foreach ($aProfileFields as $sKey => $mValue) {
         if (!$this->_oDb->isFieldExist($sKey)) {
             // (field not existence) remove from array;
             unset($aProfileFields[$sKey]);
         }
     }
     // add some system values
     $sNewPassword = genRndPwd();
     $sPasswordSalt = genRndSalt();
     $aProfileFields['Password'] = encryptUserPwd($sNewPassword, $sPasswordSalt);
     $aProfileFields['Role'] = BX_DOL_ROLE_MEMBER;
     $aProfileFields['DateReg'] = date('Y-m-d H:i:s');
     // set current date;
     $aProfileFields['Salt'] = $sPasswordSalt;
     // set default privacy
     bx_import('BxDolPrivacyQuery');
     $oPrivacy = new BxDolPrivacyQuery();
     $aProfileFields['allow_view_to'] = $oPrivacy->getDefaultValueModule('profile', 'view_block');
     // check if user with the same email already exists
     $iExistingProfileId = $this->_oDb->isEmailExisting($aProfileFields['Email']);
     // check redirect page
     if ('join' == $this->_oConfig->sRedirectPage && !$iExistingProfileId) {
         return array('remote_profile_info' => $aProfileInfo, 'profile_fields' => $aProfileFields, 'join_page_redirect' => true);
     }
     // create new profile
     if ($iExistingProfileId) {
         $iProfileId = $iExistingProfileId;
     } else {
         $iProfileId = $this->_oDb->createProfile($aProfileFields);
     }
     $oProfileFields = new BxDolProfilesController();
     // remember remote profile id for created member
     $this->_oDb->saveRemoteId($iProfileId, $aProfileInfo['id']);
     // check profile status;
     if (!$iExistingProfileId) {
         if (getParam('autoApproval_ifNoConfEmail') == 'on') {
             if (getParam('autoApproval_ifJoin') == 'on') {
                 $sProfileStatus = 'Active';
                 if (!empty($aProfileInfo['email'])) {
                     $oProfileFields->sendActivationMail($iProfileId);
                 }
             } else {
                 $sProfileStatus = 'Approval';
                 if (!empty($aProfileInfo['email'])) {
                     $oProfileFields->sendApprovalMail($iProfileId);
                 }
             }
         } else {
             if (!empty($aProfileInfo['email'])) {
                 $oProfileFields->sendConfMail($iProfileId);
                 $sProfileStatus = 'Unconfirmed';
             } else {
                 if (getParam('autoApproval_ifJoin') == 'on') {
                     $sProfileStatus = 'Active';
                 } else {
                     $sProfileStatus = 'Approval';
                 }
             }
         }
         // update profile's status;
         $this->_oDb->updateProfileStatus($iProfileId, $sProfileStatus);
         $oProfileFields->createProfileCache($iProfileId);
         // send email notification
         if (!empty($aProfileInfo['email'])) {
             $oEmailTemplate = new BxDolEmailTemplates();
             $aTemplate = $oEmailTemplate->getTemplate($this->_oConfig->sEmailTemplatePasswordGenerated, $iProfileId);
             $aNewProfileInfo = getProfileInfo($iProfileId);
             $aPlus = array('NickName' => getNickName($aNewProfileInfo['ID']), 'NewPassword' => $sNewPassword);
             sendMail($aNewProfileInfo['Email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
         }
         // update location
         if (BxDolModule::getInstance('BxWmapModule')) {
             BxDolService::call('wmap', 'response_entry_add', array('profiles', $iProfileId));
         }
         // create system event
         $oZ = new BxDolAlerts('profile', 'join', $iProfileId);
         $oZ->alert();
     }
     // store IP
     bx_member_ip_store($iProfileId);
     // auto-friend members if they are already friends on remote site
     if ($isAutoFriends && method_exists($this, '_makeFriends')) {
         $this->_makeFriends($iProfileId);
     }
     // set logged
     if ($isSetLoggedIn) {
         $aProfile = getProfileInfo($iProfileId);
         $this->setLogged($iProfileId, $aProfile['Password'], '', false);
     }
     return array('remote_profile_info' => $aProfileInfo, 'profile_id' => $iProfileId, 'existing_profile' => $iExistingProfileId ? true : false);
 }
Exemplo n.º 28
0
<?php 
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
echo "<board>\n";
include "../ConDBi.php";
/*
==============================================
	POST VARS
==============================================
*/
$uid = $_POST["uid"];
$id = getID($application);
$title = $_POST["title"];
$content = $_POST["content"];
/*
==============================================
	INSERT REPLY
==============================================
*/
$stmt->prepare("INSERT INTO Board.board\n\t\t\t\t\tSELECT \n\t\t\t\t\t\t'', #uid(auto_increment)\n\t\t\t\t\t\tpid,\n\t\t\t\t\t\tapplication,\n\t\t\t\t\t\tcategory,\n\t\t\t\t\t\t\n\t\t\t\t\t\t?, #--> id\n\t\t\t\t\t\t?, #--> title\n\t\t\t\t\t\t?, #--> content\n\t\t\t\t\t\tnow(), #timestamp\n\t\t\t\t\t\t0, #hit\n\t\t\t\t\t\t\n\t\t\t\t\t\tCASE\n\t\t\t\t\t\t\tWHEN right_depth IS NULL THEN\n\t\t\t\t\t\t\t\tCONCAT(depth, 'A')\n\t\t\t\t\t\t\tELSE\n\t\t\t\t\t\t\t\tCONCAT(depth, CHAR(ASCII(right_depth) + 1))\n\t\t\t\t\t\tEND depth,\n\t\t\t\t\t\t1 #live\n\t\t\t\t\tFROM\n\t\t\t\t\t(\n\t\t\t\t\t\tSELECT B.application, B.category, B.pid, B.depth, right(D.depth, 1) right_depth\n\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\tBoard.board B LEFT OUTER JOIN Board.board D\n\t\t\t\t\t\t\t\tON B.pid = D.pid AND\n\t\t\t\t\t\t\t\t\tlength(D.depth) = length(B.depth) + 1 AND\n\t\t\t\t\t\t\t\t\tlocate(B.depth, D.depth) = 1\n\t\t\t\t\t\t\tWHERE B.uid = ? #parent uid -> as a role of fid\n\t\t\t\t\t\t\tORDER BY D.depth DESC LIMIT 1\n\t\t\t\t\t) P");
$stmt->bind_param("sssd", $id, $title, $content, $uid);
$stmt->execute();
$result = getResult($stmt);
echo "\t<result>" . $result . "</result>\n";
echo "</board>";
$stmt->close();
$mysqli->close();
Exemplo n.º 29
0
 /**
  * getID with given id / in url and userewrite=2, no basedir set, Apache and CGI.
  */
 function test5()
 {
     global $conf;
     $conf['basedir'] = '';
     $conf['userewrite'] = '2';
     $conf['baseurl'] = '';
     $_SERVER['DOCUMENT_ROOT'] = '/var/www/';
     $_SERVER['SCRIPT_FILENAME'] = '/var/www/dokuwiki/doku.php';
     $_SERVER['SCRIPT_NAME'] = '/dokuwiki/doku.php';
     $_SERVER['REQUEST_URI'] = '/dokuwiki/doku.php/?do=debug';
     $_SERVER['PATH_INFO'] = '/';
     $_SERVER['PATH_TRANSLATED'] = '/var/www/index.html';
     $_SERVER['PHP_SELF'] = '/dokuwiki/doku.php/';
     $this->assertEqual(getID(), cleanID($conf['start']));
 }
Exemplo n.º 30
0
<?php 
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
echo "<board>\n";
include "../ConDBi.php";
$uid = $_POST["uid"];
$title = $_POST["title"];
$content = $_POST["content"];
$stmt->prepare("UPDATE Board.board \n\t\t\t\t\tSET title = ?, content = ?, timestamp = now() \n\t\t\t\t\t\tWHERE uid = ? AND id = ?");
$stmt->bind_param("ssds", $title, $content, $uid, getID($application));
$stmt->execute();
$result = getResult($stmt);
echo "\t<result>" . $result . "</result>\n";
echo "</board>";
$stmt->close();
$mysqli->close();