Beispiel #1
0
 private static function createGroups(Module_Audit $module, $dropTable)
 {
     $table = GDO::table('GWF_Group');
     $groups = array('live', 'auditor', 'sysmin', 'poweruser');
     foreach ($groups as $group) {
         if (false !== GWF_Group::getByName($group)) {
             continue;
         }
         if (false === $table->insertAssoc(array('group_name' => $group, 'group_lang' => 1, 'group_date' => GWF_Time::getDate()))) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
     }
     return '';
 }
Beispiel #2
0
 private function getAdminProfiles()
 {
     $admin = GWF_Group::getByName('admin')->getID();
     $u = GWF_TABLE_PREFIX . 'user';
     $ug = GWF_TABLE_PREFIX . 'usergroup';
     $db = gdo_db();
     $query = "SELECT user_name FROM {$ug} AS ug INNER JOIN {$u} AS u ON u.user_id=ug_userid WHERE ug_groupid={$admin}";
     if (false === ($result = $db->queryRead($query))) {
         return '';
     }
     $back = '';
     while (false !== ($row = $db->fetchRow($result))) {
         $name = $row[0];
         $back .= sprintf(', <a href="%s">%s</a>', GWF_WEB_ROOT . 'profile/' . urlencode($name), GWF_HTML::display($name));
     }
     $db->free($result);
     return substr($back, 2);
 }
Beispiel #3
0
 private static function installForumDefaults(Module_Forum $module)
 {
     $back = '';
     $module->cachePostcount();
     # Install Root Board
     $back .= self::installRoot($module);
     # Install Moderator group
     if (false === GWF_Group::getByName('moderator')) {
         $moderator = new GWF_Group(array('group_name' => 'moderator'));
         if (false === $moderator->insert()) {
             return GWF_HTML::err('ERR_DATABASE', __FILE__, __LINE__);
         }
     }
     $back = '';
     if ($module->cfgLangBoards()) {
         $back = self::installLangBoards($module);
     }
     # Make Admins and Staff become Moderator
     return $back . self::installAdminToMod($module) . self::installAttachments($module);
 }
Beispiel #4
0
 public function execute()
 {
     if (false === ($mod_c = GWF_Module::loadModuleDB('Comments', true, true))) {
         return GWF_HTML::err('ERR_MODULE_MISSING', array('Comments'));
     }
     if (false === ($news = GWF_News::getByID(Common::getGetString('newsid')))) {
         return $this->module->error('err_news');
     }
     $key = $news->getCommentsKey();
     $gid = GWF_Group::getByName(GWF_Group::MODERATOR)->getID();
     if (false === ($comments = GWF_Comments::getOrCreateComments($key, 0, $gid))) {
         return $this->module->error('err_news');
     }
     $_REQUEST['cmts_id'] = $comments->getID();
     $back = '';
     if (isset($_POST['reply'])) {
         return $this->onReply($mod_c, $news, $comments);
     }
     return $back . $this->templateComments($mod_c, $news, $comments);
 }
Beispiel #5
0
 public static function createAdmin($username, $password, $email, &$output)
 {
     if (false === ($user = GWF_User::getByName($username))) {
         $user = new GWF_User(array('user_name' => $username, 'user_email' => $email, 'user_password' => GWF_Password::hashPasswordS($password), 'user_regdate' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'user_regip' => GWF_IP6::getIP(GWF_IP_EXACT), 'user_lastactivity' => time()));
         if (false === $user->insert()) {
             return false;
         }
     }
     $userid = $user->getID();
     if (false === GWF_UserGroup::addToGroup($userid, GWF_Group::getByName(GWF_Group::ADMIN)->getID())) {
         return false;
     }
     if (false === GWF_UserGroup::addToGroup($userid, GWF_Group::getByName(GWF_Group::STAFF)->getID())) {
         return false;
     }
     $output .= GWF_HTML::message('Install Wizard', sprintf('Added new admin user: %s - Password: [censored]', $username));
     return true;
 }
Beispiel #6
0
 private static function sendMails(Module_Audit $module, GWF_AuditLog $log, $mode = 1)
 {
     if (!$log->isScript()) {
         return true;
     }
     $gid1 = GWF_Group::getByName('auditor')->getID();
     if ($log->isRoot()) {
         $gid2 = GWF_Group::getByName('sysmin')->getID();
         $where = "(ug_groupid={$gid1} OR ug_groupid={$gid2})";
     } elseif ($mode === 1) {
         $gid3 = GWF_Group::getByName('live')->getID();
         $where = "(ug_groupid={$gid3})";
     } else {
         $where = "(ug_groupid={$gid1})";
     }
     $users = GDO::table('GWF_UserGroup');
     if (false === ($result = $users->select('DISTINCT(ug_userid),user.*', $where, '', array('user')))) {
         echo GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         return false;
     }
     while (false !== ($user = $users->fetch($result, 'GWF_User'))) {
         switch ($mode) {
             case 1:
                 self::sendMailGo($module, $user, $log);
                 break;
             case 2:
                 self::sendMailDone($module, $user, $log);
                 break;
         }
     }
     $users->free($result);
     if ($mode == 2) {
         self::sendMailDoneUser($module, $log);
     }
     return true;
 }
Beispiel #7
0
		</div>
		<h3><?php 
        echo GWF_HTML::display($news['newst_title']);
        ?>
</h3>
		<div class="cb"></div>
	</div>
	<?php 
        #if ($is_staff) { echo '<div class="gwf_newsbox_translate">'.$news->getTranslateSelect().'</div>'; }
        ?>
	<?php 
        $more = '';
        if ($module->cfgAllowComments()) {
            if (false !== ($comments = GWF_Module::loadModuleDB('Comments', true, true, true))) {
                $comments instanceof Module_Comments;
                $gid = GWF_Group::getByName(GWF_Group::MODERATOR)->getID();
                if (false !== ($c = GWF_Comments::getOrCreateComments('_NEWS_ID_' . $news['news_id'], 0, $gid))) {
                }
                $c instanceof GWF_Comments;
                //			$more .= '<br/>'.$c->displayMore($tVars['href_comments_more']);
                //			$more .= '<br/>'.$c->displayTopComments();
                //			$more .= '<br/>'.$c->displayReplyForm($tVars['href_comments_reply']);
                $more .= '<br/>' . $c->displayMore();
                $more .= '<br/>' . $c->displayTopComments();
                $more .= '<br/>' . $c->displayReplyForm();
            }
        }
        ?>

	<article class="gwf_newsbox_message"><?php 
        echo GWF_Message::display($news['newst_message']) . $more;