Exemplo n.º 1
0
 /**
  * fetch
  * 
  * @param   void
  * 
  * @return  void
  **/
 public function fetch()
 {
     parent::fetch();
     $root =& XCube_Root::getSingleton();
     if (($value = $root->mContext->mRequest->getRequest('member_id')) !== null) {
         $this->mNavi->addExtra('member_id', $value);
         $this->_mCriteria->add(new Criteria('member_id', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('group_id')) !== null) {
         $this->mNavi->addExtra('group_id', $value);
         $this->_mCriteria->add(new Criteria('group_id', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('uid')) !== null) {
         $this->mNavi->addExtra('uid', $value);
         $this->_mCriteria->add(new Criteria('uid', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('status')) !== null) {
         $this->mNavi->addExtra('status', $value);
         $this->_mCriteria->add(new Criteria('status', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('since')) !== null) {
         $this->mNavi->addExtra('since', $value);
         $this->_mCriteria->add(new Criteria('since', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('rank')) !== null) {
         $this->mNavi->addExtra('rank', $value);
         $this->_mCriteria->add(new Criteria('rank', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('posttime')) !== null) {
         $this->mNavi->addExtra('posttime', $value);
         $this->_mCriteria->add(new Criteria('posttime', $value));
     }
     $this->_mCriteria->addSort($this->getSort(), $this->getOrder());
 }
Exemplo n.º 2
0
 /**
  * fetch
  * 
  * @param   void
  * 
  * @return  void
  **/
 public function fetch()
 {
     parent::fetch();
     $root =& XCube_Root::getSingleton();
     if (($value = $root->mContext->mRequest->getRequest('policy_id')) !== null) {
         $this->mNavi->addExtra('policy_id', $value);
         $this->_mCriteria->add(new Criteria('policy_id', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('group_id')) !== null) {
         $this->mNavi->addExtra('group_id', $value);
         $this->_mCriteria->add(new Criteria('group_id', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('dirname')) !== null) {
         $this->mNavi->addExtra('dirname', $value);
         $this->_mCriteria->add(new Criteria('dirname', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('dataname')) !== null) {
         $this->mNavi->addExtra('dataname', $value);
         $this->_mCriteria->add(new Criteria('dataname', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('action')) !== null) {
         $this->mNavi->addExtra('action', $value);
         $this->_mCriteria->add(new Criteria('action', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('rank')) !== null) {
         $this->mNavi->addExtra('rank', $value);
         $this->_mCriteria->add(new Criteria('rank', $value));
     }
     $this->_mCriteria->addSort($this->getSort(), $this->getOrder());
 }
Exemplo n.º 3
0
 /**
  * fetch
  * 
  * @param   void
  * 
  * @return  void
  **/
 public function fetch()
 {
     parent::fetch();
     $root =& XCube_Root::getSingleton();
     if (($value = $root->mContext->mRequest->getRequest('conne_id')) !== null) {
         $this->mNavi->addExtra('conne_id', $value);
         $this->_mCriteria->add(new Criteria('conne_id', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('uid')) !== null) {
         $this->mNavi->addExtra('uid', $value);
         $this->_mCriteria->add(new Criteria('uid', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('conne_uid')) !== null) {
         $this->mNavi->addExtra('conne_uid', $value);
         $this->_mCriteria->add(new Criteria('conne_uid', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('level')) !== null) {
         $this->mNavi->addExtra('level', $value);
         $this->_mCriteria->add(new Criteria('level', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('stat')) !== null) {
         $this->mNavi->addExtra('stat', $value);
         $this->_mCriteria->add(new Criteria('stat', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('accepttime')) !== null) {
         $this->mNavi->addExtra('accepttime', $value);
         $this->_mCriteria->add(new Criteria('accepttime', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('posttime')) !== null) {
         $this->mNavi->addExtra('posttime', $value);
         $this->_mCriteria->add(new Criteria('posttime', $value));
     }
     $this->_mCriteria->addSort($this->getSort(), $this->getOrder());
 }
Exemplo n.º 4
0
 public function prepare()
 {
     $root = XCube_Root::getSingleton();
     $handler = xoops_gethandler('config');
     $xoopsMailerConfig = $handler->getConfigsByCat(XOOPS_CONF_MAILER);
     $this->reset();
     if ($xoopsMailerConfig['from'] == '') {
         $this->From = $root->mContext->mXoopsConfig['adminmail'];
     } else {
         $this->From = $xoopsMailerConfig['from'];
     }
     $this->Sender = $root->mContext->mXoopsConfig['adminmail'];
     $this->SetLanguage(LEGACY_MAIL_LANG, XOOPS_ROOT_PATH . '/class/mail/phpmailer/language/');
     $this->CharSet = LEGACY_MAIL_CHAR;
     $this->Encoding = LEGACY_MAIL_ENCO;
     switch ($xoopsMailerConfig['mailmethod']) {
         case 'smtpauth':
             $this->IsSMTP();
             $this->SMTPAuth = true;
             $this->Host = implode(';', $xoopsMailerConfig['smtphost']);
             $this->Username = $xoopsMailerConfig['smtpuser'];
             $this->Password = $xoopsMailerConfig['smtppass'];
             break;
         case 'smtp':
             $this->IsSMTP();
             $this->SMTPAuth = false;
             $this->Host = implode(';', $xoopsMailerConfig['smtphost']);
             break;
         case 'sendmail':
             $this->IsSendmail();
             $this->Sendmail = $xoopsMailerConfig['sendmailpath'];
             break;
     }
     return true;
 }
Exemplo n.º 5
0
 /**
  * Drop table because this class is uninstaller.
  * 
  * @protected
  */
 function _uninstallTables()
 {
     $root =& XCube_Root::getSingleton();
     $db =& $root->mController->getDB();
     $dirname = $this->_mXoopsModule->get('dirname');
     $t_search = array('{prefix}', '{dirname}', '{Dirname}', '{_dirname_}');
     $t_replace = array(XOOPS_DB_PREFIX, strtolower($dirname), ucfirst(strtolower($dirname)), $dirname);
     $tables = $this->_mXoopsModule->getInfo('tables');
     if ($tables != false && is_array($tables)) {
         foreach ($tables as $table) {
             //
             // TODO Do we need to check reserved core tables?
             //
             $t_tableName = $table;
             if (isset($this->_mXoopsModule->modinfo['cube_style']) && $this->_mXoopsModule->modinfo['cube_style'] == true) {
                 $t_tableName = str_replace($t_search, $t_replace, $table);
             } else {
                 $t_tableName = $db->prefix($table);
             }
             $sql = "DROP TABLE " . $t_tableName;
             if ($db->query($sql)) {
                 $this->mLog->addReport(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_DROP_TABLE, $t_tableName));
             } else {
                 $this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_DROP_TABLE, $t_tableName));
             }
         }
     }
 }
function smarty_function_xoops_optionsArray($params, &$smarty)
{
    //
    // We should check more.
    //
    $tags = '';
    $objectArr =& $params['from'];
    $default = isset($params['default']) ? $params['default'] : null;
    $id = isset($params['id']) ? XOOPS_INPUT_DEFID_PREFIX . $params['id'] . '_' : null;
    static $textFilter;
    if (!isset($textFilter)) {
        $root =& XCube_Root::getSingleton();
        $textFilter = $root->getTextFilter();
    }
    $vname = $params['value'];
    $lname = $params['label'];
    $isarr = is_array($default);
    foreach ($objectArr as $object) {
        $value = $object->get($vname);
        $selected = $isarr ? in_array($value, $default) : $value == $default ? ' selected="selected"' : '';
        $value = $textFilter->toShow($value);
        $label = $textFilter->toShow($object->get($lname));
        $tags .= $id ? "<option id=\"{$id}{$value}\" value=\"{$value}\"{$selected}>{$label}</option>\n" : "<option value=\"{$value}\"{$selected}>{$label}</option>\n";
    }
    print $tags;
}
Exemplo n.º 7
0
 /**
  * fetch
  * 
  * @param	void
  * 
  * @return	void
  **/
 public function fetch()
 {
     parent::fetch();
     $root =& XCube_Root::getSingleton();
     if (($value = $root->mContext->mRequest->getRequest('group_id')) !== null) {
         $this->mNavi->addExtra('group_id', $value);
         $this->_mCriteria->add(new Criteria('group_id', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('title')) !== null) {
         $this->mNavi->addExtra('title', $value);
         $this->_mCriteria->add(new Criteria('title', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('publicity')) !== null) {
         $this->mNavi->addExtra('publicity', $value);
         $this->_mCriteria->add(new Criteria('publicity', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('approval')) !== null) {
         $this->mNavi->addExtra('approval', $value);
         $this->_mCriteria->add(new Criteria('approval', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('description')) !== null) {
         $this->mNavi->addExtra('description', $value);
         $this->_mCriteria->add(new Criteria('description', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('posttime')) !== null) {
         $this->mNavi->addExtra('posttime', $value);
         $this->_mCriteria->add(new Criteria('posttime', $value));
     }
     $this->_mCriteria->addSort($this->getSort(), $this->getOrder());
 }
Exemplo n.º 8
0
 function fetch()
 {
     parent::fetch();
     $root =& XCube_Root::getSingleton();
     $rank_special = $root->mContext->mRequest->getRequest('rank_special');
     $option_field = $root->mContext->mRequest->getRequest('option_field');
     $search = $root->mContext->mRequest->getRequest('search');
     if (isset($_REQUEST['rank_special'])) {
         $this->mNavi->addExtra('rank_special', xoops_getrequest('rank_special'));
         $this->_mCriteria->add(new Criteria('rank_special', xoops_getrequest('rank_special')));
     }
     if (isset($_REQUEST['option_field'])) {
         $this->mNavi->addExtra('option_field', xoops_getrequest('option_field'));
         $this->mOptionField = $option_field;
         if ($this->mOptionField == "special") {
             //only system avatar
             $this->_mCriteria->add(new Criteria('rank_special', '1'));
         } elseif ($this->mOptionField == "normal") {
             //only custom avatar
             $this->_mCriteria->add(new Criteria('rank_special', '0'));
         } else {
             //all
         }
     }
     //
     if (!empty($search)) {
         $this->mKeyword = $search;
         $this->mNavi->addExtra('search', $this->mKeyword);
         $this->_mCriteria->add(new Criteria('rank_title', '%' . $this->mKeyword . '%', 'LIKE'));
     }
     $this->_mCriteria->addSort($this->getSort(), $this->getOrder());
 }
Exemplo n.º 9
0
function smarty_function_xoops_optionsArray($params, &$smarty)
{
    //
    // We should check more.
    //
    $tags = "";
    $objectArr =& $params['from'];
    $default = isset($params['default']) ? $params['default'] : null;
    $id = isset($params['id']) ? $params['id'] : null;
    $root =& XCube_Root::getSingleton();
    $textFilter =& $root->getTextFilter();
    foreach ($objectArr as $object) {
        $value = $textFilter->toShow($object->get($params['value']));
        $label = $textFilter->toShow($object->get($params['label']));
        $selected = "";
        if (is_array($default) && in_array($object->get($params['value']), $default)) {
            $selected = " selected=\"selected\"";
        } elseif (!is_array($default) && $object->get($params['value']) == $default) {
            $selected = " selected=\"selected\"";
        }
        if ($id) {
            $t_id = XOOPS_INPUT_DEFID_PREFIX . $id . "_" . $value;
            $tags .= "<option id=\"{$t_id}\" value=\"{$value}\"{$selected}>{$label}</option>\n";
        } else {
            $tags .= "<option value=\"{$value}\"{$selected}>{$label}</option>\n";
        }
    }
    print $tags;
}
Exemplo n.º 10
0
 /**
  *	getckconfig
  */
 function getckconfig($params)
 {
     $mydirname = basename(dirname(dirname(__FILE__)));
     $mydirPath = dirname(dirname(__FILE__));
     //add ckconfig start
     $ckconfig = '';
     //-- set CKEdtior Option customConfig --//
     $root = XCube_Root::getSingleton();
     $ckconfigdirname = $root->mContext->mXoopsConfig['language'];
     if (!empty($ckconfigdirname) && !file_exists($mydirPath . '/language/' . $ckconfigdirname . '/config.js')) {
         $ckconfigdirname = '';
     }
     if (!empty($ckconfigdirname)) {
         $ckconfig .= "customConfig:'" . XOOPS_MODULE_URL . "/" . $mydirname . "/language/" . $ckconfigdirname . "/config.js'";
     } else {
         $ckconfig .= "customConfig:''";
     }
     if (isset($params['toolbar'])) {
         if (!empty($params['toolbar'])) {
             $ckconfig .= ",toolbar:'" . $params['toolbar'] . "'";
         }
     }
     //--------------------------------------//
     //set CKEdtior Option start from second
     //-- set CKEdtior Option Smailey for XoopsSmailey --//
     $ckconfig .= $this->_getCkconfig4XoopsSmailey();
     return $ckconfig;
     //add EXTconfig end
 }
Exemplo n.º 11
0
 function checkLogin(&$xoopsUser)
 {
     $root =& XCube_Root::getSingleton();
     if ($root->mContext->mUser->isInRole('Site.RegisteredUser')) {
         return;
     }
     $root->mLanguageManager->loadModuleMessageCatalog('user');
     $userHandler =& xoops_getmodulehandler('users', 'user');
     $criteria = new CriteriaCompo();
     if (xoops_getrequest('uname') != "" && strpos(xoops_getrequest('uname'), '@') !== false) {
         $criteria->add(new Criteria('email', xoops_getrequest('uname')));
     } else {
         $criteria->add(new Criteria('uname', xoops_getrequest('uname')));
         // use for both e-mail or uname logiin
         //	$criteria->add(new Criteria('uname',''));				// use for only e-mail logiin
     }
     $criteria->add(new Criteria('pass', md5(xoops_getrequest('pass'))));
     $userArr =& $userHandler->getObjects($criteria);
     if (count($userArr) != 1) {
         return;
     }
     if ($userArr[0]->get('level') == 0) {
         return;
     }
     $handler =& xoops_gethandler('user');
     $user =& $handler->get($userArr[0]->get('uid'));
     $xoopsUser = $user;
     require_once XOOPS_ROOT_PATH . '/include/session.php';
     xoops_session_regenerate();
     $_SESSION = array();
     $_SESSION['xoopsUserId'] = $xoopsUser->get('uid');
     $_SESSION['xoopsUserGroups'] = $xoopsUser->getGroups();
 }
Exemplo n.º 12
0
function smarty_function_legacy_map_edit($params, &$smarty)
{
    $dirname = isset($params['dirname']) ? $params['dirname'] : null;
    $dataname = isset($params['dataname']) ? $params['dataname'] : null;
    $dataId = isset($params['data_id']) ? $params['data_id'] : null;
    $addressId = isset($params['geocode']) ? $params['geocode'] : null;
    $template = isset($params['template']) ? $params['template'] : 'legacy_inc_map_edit.html';
    $places = array();
    XCube_DelegateUtils::call('Legacy_Map.GetPlaces', new XCube_Ref($places), $dirname, $dataname, $dataId);
    $root = XCube_Root::getSingleton();
    $latitude = $root->mContext->mRequest->getRequest('latitude');
    $longitude = $root->mContext->mRequest->getRequest('longitude');
    $request = null;
    if (isset($latitude) && isset($longitude)) {
        $request = array('latitude' => $latitude, 'longitude' => $longitude, 'zoom' => 10);
    }
    //render template
    $render = new XCube_RenderTarget();
    $render->setTemplateName($template);
    $render->setAttribute('legacy_buffertype', XCUBE_RENDER_TARGET_TYPE_MAIN);
    $render->setAttribute('places', $places);
    $render->setAttribute('geocode', $geocode);
    $render->setAttribute('request', $request);
    XCube_Root::getSingleton()->getRenderSystem('Legacy_RenderSystem')->render($render);
    echo $render->getResult();
}
Exemplo n.º 13
0
 /**
  * prepare
  * 
  * @param   string	$dirname
  * 
  * @return  void
  **/
 public static function prepare($dirname)
 {
     $root =& XCube_Root::getSingleton();
     $instance = new Lecat_AssetPreloadBase($root->mController);
     $instance->mDirname = $dirname;
     $root->mController->addActionFilter($instance);
 }
Exemplo n.º 14
0
 /**
  * fetch
  * 
  * @param   void
  * 
  * @return  void
  **/
 public function fetch()
 {
     parent::fetch();
     $root = XCube_Root::getSingleton();
     if (($value = $root->mContext->mRequest->getRequest('definition_id')) !== null) {
         $this->mNavi->addExtra('definition_id', $value);
         $this->_mCriteria->add(new Criteria('definition_id', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('field_name')) !== null) {
         $this->mNavi->addExtra('field_name', $value);
         $this->_mCriteria->add(new Criteria('field_name', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('label')) !== null) {
         $this->mNavi->addExtra('label', $value);
         $this->_mCriteria->add(new Criteria('label', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('field_type')) !== null) {
         $this->mNavi->addExtra('field_type', $value);
         $this->_mCriteria->add(new Criteria('field_type', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('validation')) !== null) {
         $this->mNavi->addExtra('validation', $value);
         $this->_mCriteria->add(new Criteria('validation', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('required')) !== null) {
         $this->mNavi->addExtra('required', $value);
         $this->_mCriteria->add(new Criteria('required', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('weight')) !== null) {
         $this->mNavi->addExtra('weight', $value);
         $this->_mCriteria->add(new Criteria('weight', $value));
     }
     $this->_mCriteria->addSort($this->getSort(), $this->getOrder());
 }
Exemplo n.º 15
0
 /**
  * Loads roles of the specific module with $module, and set loaded roles to
  * the current principal.
  * @static
  * @param XoopsModule $module
  */
 function loadRolesByModule(&$module)
 {
     static $cache;
     $root =& XCube_Root::getSingleton();
     $context =& $root->mContext;
     if ($module == null) {
         return;
     }
     if (isset($cache[$module->get('mid')])) {
         return;
     }
     $groups = is_object($context->mXoopsUser) ? $context->mXoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
     $handler =& xoops_gethandler('groupperm');
     if ($handler->checkRight('module_read', $module->get('mid'), $groups)) {
         $context->mUser->addRole('Module.' . $module->get('dirname') . '.Visitor');
     }
     if (is_object($context->mXoopsUser) && $handler->checkRight('module_admin', $module->get('mid'), $groups)) {
         $context->mUser->addRole('Module.' . $module->get('dirname') . '.Admin');
     }
     $handler =& xoops_getmodulehandler('group_permission', 'legacy');
     $roleArr = $handler->getRolesByModule($module->get('mid'), $groups);
     foreach ($roleArr as $role) {
         $context->mUser->addRole('Module.' . $module->get('dirname') . '.' . $role);
     }
     $cache[$module->get('mid')] = true;
 }
Exemplo n.º 16
0
function smarty_function_ck4dhtmltarea($params, &$smarty)
{
    if (isset($params['name'])) {
        $js = Ckeditor4_Utils::getJS($params);
        if ($js) {
            if (version_compare(LEGACY_BASE_VERSION, '2.2', '>=')) {
                // Add script into HEAD
                $root =& XCube_Root::getSingleton();
                $jQuery = $root->mContext->getAttribute('headerScript');
                $jQuery->addScript($js);
                $jQuery->addLibrary('/modules/ckeditor4/ckeditor/ckeditor.js');
                $addScript = '';
            } else {
                $xoopsURL = XOOPS_URL;
                $addScript = <<<EOD
<script type="text/javascript">
if (typeof jQuery != 'undefined') {
\tjQuery(function(\$){
\t\t{$js}
\t});
}
</script>
<script type="text/javascript" src="{$xoopsURL}/modules/ckeditor4/ckeditor/ckeditor.js"></script>
EOD;
                //$smarty->assign( 'xoops_module_header', $smarty->get_template_vars( 'xoops_module_header' ) . $addScript );
            }
        }
        //
        // Build the object for output.
        //
        print '<textarea name="' . $params['name'] . '" class="' . $params['class'] . '" style="' . $params['style'] . '" cols="' . $params['cols'] . '" rows="' . $params['rows'] . '" id="' . $params['id'] . '">' . $params['value'] . '</textarea>' . $addScript;
    }
}
 function viewDefaultOp()
 {
     $root =& XCube_Root::getSingleton();
     $controller =& $root->mController;
     $action = new NBFrame_PreferenceEditAction();
     if ($action->prepare($controller, $controller->mRoot->mContext->mXoopsUser) === false) {
         die;
         //< TODO
     }
     if (!$action->hasPermission($controller, $controller->mRoot->mContext->mXoopsUser)) {
         if ($this->mAdminFlag) {
             $controller->executeForward(XOOPS_URL . "/admin.php");
         } else {
             $controller->executeForward(XOOPS_URL);
         }
     }
     $this->mXoopsTpl->assign('actionForm', $action->mActionForm);
     $this->mXoopsTpl->assign('objectArr', $action->mObjects);
     $this->mXoopsTpl->assign('category', $action->mCategory);
     $this->mXoopsTpl->assign('module', $action->mModule);
     $handler =& xoops_gethandler('timezone');
     $timezoneArr =& $handler->getObjects();
     $this->mXoopsTpl->assign('timezoneArr', $timezoneArr);
     $handler =& xoops_gethandler('group');
     $groupArr =& $handler->getObjects();
     $this->mXoopsTpl->assign('groupArr', $groupArr);
     $handler =& xoops_gethandler('member');
     $userArr = $handler->getUserList();
     $this->mXoopsTpl->assign('userArr', $userArr);
 }
Exemplo n.º 18
0
 function update041()
 {
     $this->mLog->addReport(_AD_LEGACY_MESSAGE_UPDATE_STARTED);
     //Add Table
     $sqlfileInfo = $this->_mTargetXoopsModule->getInfo('sqlfile');
     $dirname = $this->_mTargetXoopsModule->getVar('dirname');
     $sqlfile = $sqlfileInfo[XOOPS_DB_TYPE];
     $sqlfilepath = XOOPS_MODULE_PATH . '/' . $dirname . '/' . $sqlfile;
     require_once XOOPS_MODULE_PATH . '/legacy/admin/class/Legacy_SQLScanner.class.php';
     $scanner = new Legacy_SQLScanner();
     $scanner->setDB_PREFIX(XOOPS_DB_PREFIX);
     $scanner->setDirname($this->_mTargetXoopsModule->get('dirname'));
     if (!$scanner->loadFile($sqlfilepath)) {
         $this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_SQL_FILE_NOT_FOUND, $sqlfile));
         return false;
     }
     $scanner->parse();
     $sqls = $scanner->getSQL();
     $root = XCube_Root::getSingleton();
     $db = $root->mController->getDB();
     foreach ($sqls as $sql) {
         if (strpos($sql, '_message_users') !== false) {
             if (!$db->query($sql)) {
                 $this->mLog->addError($db->error());
                 return false;
             }
         }
     }
     $this->mLog->addReport(_AD_LEGACY_MESSAGE_DATABASE_SETUP_FINISHED);
     //add table
     $this->updatemain();
     return true;
 }
Exemplo n.º 19
0
 function _processScript()
 {
     $root = XCube_Root::getSingleton();
     $db = $root->mController->getDB();
     /*
     $INBOX = "INSERT INTO `".$db->prefix('message_inbox')."` (`inbox_id`, `uid`, `from_uid`, `title`, `message`, `utime`, `is_read`) SELECT 0, to_userid, from_userid, subject, msg_text, msg_time, read_msg FROM `".$db->prefix('priv_msgs')."`";
     $OUTBOX = "INSERT INTO `".$db->prefix('message_outbox')."` (`outbox_id`, `uid`, `to_uid`, `title`, `message`, `utime`) SELECT 0, from_userid, to_userid, subject, msg_text, msg_time FROM `".$db->prefix('priv_msgs')."`";
     if ( $db->queryF($INBOX) ) {
       $this->mLog->addReport('Update to inbox.');
       if ( $db->queryF($OUTBOX) ) {
         $this->mLog->addReport('Update to outbox.');
       }
     }
     */
     //--- Start ---
     $INBOX = "INSERT INTO `" . $db->prefix('message_inbox') . "` (`inbox_id`, `uid`, `from_uid`, `title`, `message`, `utime`, `is_read`) VALUES (0, %d, %d, '%s', '%s', %d, %d)";
     $OUTBOX = "INSERT INTO `" . $db->prefix('message_outbox') . "` (`outbox_id`, `uid`, `to_uid`, `title`, `message`, `utime`) VALUES (0, %d, %d, '%s', '%s', %d)";
     $num = 0;
     $sql = "SELECT * FROM `" . $db->prefix('priv_msgs') . "` ORDER BY `msg_id`";
     $result = $db->query($sql);
     while ($val = $db->fetchArray($result)) {
         $sql = sprintf($INBOX, $val['to_userid'], $val['from_userid'], mysql_real_escape_string($val['subject']), mysql_real_escape_string($val['msg_text']), $val['msg_time'], $val['read_msg']);
         $result = $db->queryF($sql);
         $sql = sprintf($OUTBOX, $val['from_userid'], $val['to_userid'], mysql_real_escape_string($val['subject']), mysql_real_escape_string($val['msg_text']), $val['msg_time']);
         $result = $db->queryF($sql);
         $num++;
     }
     $this->mLog->addReport('Update to ' . $num . ' records.');
     //--- End ---
 }
Exemplo n.º 20
0
function smarty_function_legacy_comment($params, &$smarty)
{
	$cDirname = $params['cDirname'];
	$dirname = isset($params['dirname']) ? $params['dirname'] : null;
	$dataname = isset($params['dataname']) ? $params['dataname'] : null;
	$dataId = isset($params['data_id']) ? $params['data_id'] : 0;
	$categoryId = isset($params['category_id']) ? $params['category_id'] : 0;
	$comments = null;

	XCube_DelegateUtils::call('Legacy_Comment.'.$cDirname.'.GetComments',
		new XCube_Ref($comments),
		$cDirname,
		$dirname,
		$dataname,
		$dataId,
		$categoryId,
		$params
	);

	$template = isset($params['template']) ? $params['template'] : $comments['template'];

	//render template
	$render = new XCube_RenderTarget();
	$render->setTemplateName($template);
	$render->setAttribute('legacy_buffertype',XCUBE_RENDER_TARGET_TYPE_MAIN);
	$render->setAttribute('comments', $comments);
	XCube_Root::getSingleton()->getRenderSystem('Legacy_RenderSystem')->render($render);

	echo $render->getResult();
}
 function execute(&$controller, &$xoopsUser)
 {
     if (XCube_Root::getSingleton()->mContext->mRequest->getRequest('_form_control_cancel') != null) {
         return USER_FRAME_VIEW_CANCEL;
     }
     $memberHandler =& xoops_gethandler('member');
     $this->mNewUser =& $memberHandler->createUser();
     $this->mRegistForm->update($this->mNewUser);
     $this->mNewUser->set('uorder', $controller->mRoot->mContext->getXoopsConfig('com_order'), true);
     $this->mNewUser->set('umode', $controller->mRoot->mContext->getXoopsConfig('com_mode'), true);
     if ($this->mConfig['activation_type'] == 1) {
         $this->mNewUser->set('level', 1, true);
     }
     if (!$memberHandler->insertUser($this->mNewUser)) {
         $this->mRedirectMessage = _MD_USER_LANG_REGISTERNG;
         return USER_FRAME_VIEW_ERROR;
     }
     if (!$memberHandler->addUserToGroup(XOOPS_GROUP_USERS, $this->mNewUser->get('uid'))) {
         $this->mRedirectMessage = _MD_USER_LANG_REGISTERNG;
         return USER_FRAME_VIEW_ERROR;
     }
     $this->_clearRegistForm($controller);
     $this->_processMail($controller);
     $this->_eventNotifyMail($controller);
     XCube_DelegateUtils::call('Legacy.Event.RegistUser.Success', new XCube_Ref($this->mNewUser));
     return USER_FRAME_VIEW_SUCCESS;
 }
Exemplo n.º 22
0
 function resign(&$flag, &$controller, &$xoopsUser)
 {
     $handler =& xoops_gethandler('member');
     $groups = $handler->getGroupsByUser($xoopsUser->get('uid'));
     foreach ($groups as $group) {
         $handler->removeUserFromGroup($group, $xoopsUser->get('uid'));
     }
     $handler->addUserToGroup(RESIGN_USER_GROUP_ID, $xoopsUser->get('uid'));
     xoops_notification_deletebyuser($xoopsUser->get('uid'));
     XCube_DelegateUtils::call('Legacy.Event.UserDelete', new XCube_Ref($xoopsUser));
     $flag = true;
     $root =& XCube_Root::getSingleton();
     // Reset session
     $_SESSION = array();
     $root->mSession->destroy(true);
     // reset online
     $handler =& xoops_gethandler('online');
     $handler->destroy($xoopsUser->get('uid'));
     xoops_notification_deletebyuser($xoopsUser->get('uid'));
     // Redirect not to call behind delegates.
     $langMgr =& $root->getLanguageManager();
     $langMgr->loadPageTypeMessageCatalog('user');
     $controller =& $root->getController();
     $controller->executeRedirect(XOOPS_URL, 3, _US_BEENDELED);
 }
Exemplo n.º 23
0
 public function execute()
 {
     $root = XCube_Root::getSingleton();
     $root->mLanguageManager->loadModinfoMessageCatalog(basename(dirname(dirname(__FILE__))));
     $root->mLanguageManager->loadModuleMessageCatalog(basename(dirname(dirname(__FILE__))));
     $render = $this->getRenderTarget();
     $render->setTemplateName($this->_mBlock->get('template'));
     $render->setAttribute('mid', $this->_mBlock->get('mid'));
     $render->setAttribute('bid', $this->_mBlock->get('bid'));
     $service = $root->mServiceManager->getService('privateMessage');
     $uid = $root->mContext->mXoopsUser->get('uid');
     if ($service != null) {
         $client = $root->mServiceManager->createClient($service);
         $render->setAttribute('block', $client->call('getCountUnreadPM', array('uid' => $uid)));
     }
     if ($root->mServiceManager->getService('UserSearch') != null) {
         $render->setAttribute('UserSearch', true);
     }
     $modHand = xoops_getmodulehandler('inbox', 'message');
     $render->setAttribute('incount', $modHand->getInboxCount($uid));
     $modHand = xoops_getmodulehandler('outbox', 'message');
     $render->setAttribute('outcount', $modHand->getOutboxCount($uid));
     $render->setAttribute('message_url', XOOPS_URL . '/modules/message/index.php');
     $renderSystem = $root->getRenderSystem($this->getRenderSystemName());
     $renderSystem->renderBlock($render);
 }
Exemplo n.º 24
0
/**
 * This function is called back to display the user menu.
 * 
 * [Template Variables]
 *  $block.uid ... Curent user id for the menu.
 *  $block.flagShowInbox ... If there is the pm module, set true.
 *  $block.inbox_url ... Return url to access inbox of pm.
 *  $block.new_messages ... amount of unread messages.
 */
function b_legacy_usermenu_show()
{
    $root =& XCube_Root::getSingleton();
    $xoopsUser =& $root->mController->mRoot->mContext->mXoopsUser;
    if (is_object($xoopsUser)) {
        $block = array();
        $block['uid'] = $xoopsUser->get('uid');
        $block['flagShowInbox'] = false;
        //
        // Check does this system have PrivateMessage feature.
        //
        $url = null;
        $service =& $root->mServiceManager->getService('privateMessage');
        if ($service != null) {
            $client =& $root->mServiceManager->createClient($service);
            $url = $client->call('getPmInboxUrl', array('uid' => $xoopsUser->get('uid')));
            if ($url != null) {
                $block['inbox_url'] = $url;
                $block['new_messages'] = $client->call('getCountUnreadPM', array('uid' => $xoopsUser->get('uid')));
                $block['flagShowInbox'] = true;
            }
        }
        $block['show_adminlink'] = $root->mContext->mUser->isInRole('Site.Administrator');
        return $block;
    }
    return false;
}
Exemplo n.º 25
0
 /**
  * _setup
  * 
  * @param	void
  * 
  * @return	bool
  **/
 public static function _setup()
 {
     $root =& XCube_Root::getSingleton();
     $instance = new self($root->mController);
     $root->mController->addActionFilter($instance);
     return true;
 }
Exemplo n.º 26
0
 /**
  * fetch
  * 
  * @param   void
  * 
  * @return  void
  **/
 public function fetch()
 {
     parent::fetch();
     $root =& XCube_Root::getSingleton();
     if (($value = $root->mContext->mRequest->getRequest('sid')) !== null) {
         $this->mNavi->addExtra('sid', $value);
         $this->_mCriteria->add(new Criteria('sid', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('uid')) !== null) {
         $this->mNavi->addExtra('uid', $value);
         $this->_mCriteria->add(new Criteria('uid', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('valid')) !== null) {
         $this->mNavi->addExtra('valid', $value);
         $this->_mCriteria->add(new Criteria('valid', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('name')) !== null) {
         $this->mNavi->addExtra('name', $value);
         $this->_mCriteria->add(new Criteria('name', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('addon_url')) !== null) {
         $this->mNavi->addExtra('addon_url', $value);
         $this->_mCriteria->add(new Criteria('addon_url', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('theme_url')) !== null) {
         $this->mNavi->addExtra('theme_url', $value);
         $this->_mCriteria->add(new Criteria('theme_url', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('reg_unixtime')) !== null) {
         $this->mNavi->addExtra('reg_unixtime', $value);
         $this->_mCriteria->add(new Criteria('reg_unixtime', $value));
     }
     $this->_mCriteria->addSort($this->getSort(), $this->getOrder());
 }
Exemplo n.º 27
0
 function getRolesOfAction()
 {
     $args = func_get_args();
     $actionName = array_shift($args);
     $root =& XCube_Root::getSingleton();
     return $root->mPermissionManager->getRolesOfAction($actionName, $args);
 }
Exemplo n.º 28
0
 /**
  * fetch
  * 
  * @param	void
  * 
  * @return	void
  **/
 public function fetch()
 {
     parent::fetch();
     $root =& XCube_Root::getSingleton();
     if (($value = $root->mContext->mRequest->getRequest('thumbnail_id')) !== null) {
         $this->mNavi->addExtra('thumbnail_id', $value);
         $this->_mCriteria->add(new Criteria('thumbnail_id', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('dirname')) !== null) {
         $this->mNavi->addExtra('dirname', $value);
         $this->_mCriteria->add(new Criteria('dirname', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('dataname')) !== null) {
         $this->mNavi->addExtra('dataname', $value);
         $this->_mCriteria->add(new Criteria('dataname', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('max_width')) !== null) {
         $this->mNavi->addExtra('max_width', $value);
         $this->_mCriteria->add(new Criteria('max_width', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('max_height')) !== null) {
         $this->mNavi->addExtra('max_height', $value);
         $this->_mCriteria->add(new Criteria('max_height', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('file_type')) !== null) {
         $this->mNavi->addExtra('file_type', $value);
         $this->_mCriteria->add(new Criteria('file_type', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('tsize')) !== null) {
         $this->mNavi->addExtra('tsize', $value);
         $this->_mCriteria->add(new Criteria('tsize', $value));
     }
     $this->_mCriteria->addSort($this->getSort(), $this->getOrder());
 }
Exemplo n.º 29
0
 function &getTimeZoneList()
 {
     $root =& XCube_Root::getSingleton();
     $root->mLanguageManager->loadPageTypeMessageCatalog('timezone');
     $time_zone_list = array("-12" => _TZ_GMTM12, "-11" => _TZ_GMTM11, "-10" => _TZ_GMTM10, "-9" => _TZ_GMTM9, "-8" => _TZ_GMTM8, "-7" => _TZ_GMTM7, "-6" => _TZ_GMTM6, "-5" => _TZ_GMTM5, "-4.5" => _TZ_GMTM45, "-4" => _TZ_GMTM4, "-3.5" => _TZ_GMTM35, "-3" => _TZ_GMTM3, "-2" => _TZ_GMTM2, "-1" => _TZ_GMTM1, "0" => _TZ_GMT0, "1" => _TZ_GMTP1, "2" => _TZ_GMTP2, "3" => _TZ_GMTP3, "3.5" => _TZ_GMTP35, "4" => _TZ_GMTP4, "4.5" => _TZ_GMTP45, "5" => _TZ_GMTP5, "5.5" => _TZ_GMTP55, "5.75" => _TZ_GMTP575, "6" => _TZ_GMTP6, "6.5" => _TZ_GMTP65, "7" => _TZ_GMTP7, "8" => _TZ_GMTP8, "9" => _TZ_GMTP9, "9.5" => _TZ_GMTP95, "10" => _TZ_GMTP10, "11" => _TZ_GMTP11, "12" => _TZ_GMTP12, "13" => _TZ_GMTP13);
     return $time_zone_list;
 }
 /**
  * fetch
  * 
  * @param   void
  * 
  * @return  void
  **/
 public function fetch()
 {
     parent::fetch();
     $root =& XCube_Root::getSingleton();
     if (($value = $root->mContext->mRequest->getRequest('uid')) !== null) {
         $this->mNavi->addExtra('uid', $value);
         $this->_mCriteria->add(new Criteria('uid', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('topic_id')) !== null) {
         $this->mNavi->addExtra('topic_id', $value);
         $this->_mCriteria->add(new Criteria('topic_id', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('u2t_time')) !== null) {
         $this->mNavi->addExtra('u2t_time', $value);
         $this->_mCriteria->add(new Criteria('u2t_time', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('u2t_marked')) !== null) {
         $this->mNavi->addExtra('u2t_marked', $value);
         $this->_mCriteria->add(new Criteria('u2t_marked', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('u2t_rsv')) !== null) {
         $this->mNavi->addExtra('u2t_rsv', $value);
         $this->_mCriteria->add(new Criteria('u2t_rsv', $value));
     }
     if (($value = $root->mContext->mRequest->getRequest('posttime')) !== null) {
         $this->mNavi->addExtra('posttime', $value);
         $this->_mCriteria->add(new Criteria('posttime', $value));
     }
     $this->_mCriteria->addSort($this->getSort(), $this->getOrder());
 }