Example #1
0
 public function __construct($username, $realname = 'Real Name', $email = '*****@*****.**', $groups = array())
 {
     $this->assertNotReal();
     $this->username = $username;
     $this->password = '******';
     $this->user = User::newFromName($this->username);
     $this->user->load();
     // In an ideal world we'd have a new wiki (or mock data store) for every single test.
     // But for now, we just need to create or update the user with the desired properties.
     // we particularly need the new password, since we just generated it randomly.
     // In core MediaWiki, there is no functionality to delete users, so this is the best we can do.
     if (!$this->user->isLoggedIn()) {
         // create the user
         $this->user = User::createNew($this->username, array("email" => $email, "real_name" => $realname));
         if (!$this->user) {
             throw new MWException("Error creating TestUser " . $username);
         }
     }
     // Update the user to use the password and other details
     $change = $this->setPassword($this->password) || $this->setEmail($email) || $this->setRealName($realname);
     // Adjust groups by adding any missing ones and removing any extras
     $currentGroups = $this->user->getGroups();
     foreach (array_diff($groups, $currentGroups) as $group) {
         $this->user->addGroup($group);
     }
     foreach (array_diff($currentGroups, $groups) as $group) {
         $this->user->removeGroup($group);
     }
     if ($change) {
         $this->user->saveSettings();
     }
 }
Example #2
0
 function exist($login, $password, $force = false)
 {
     $userManager = new User();
     $newUser = false;
     if ($force) {
         $newUser = $userManager->load(array('login' => $login));
     } else {
         $newUser = $userManager->load(array('login' => $login, 'password' => sha1(md5($password))));
     }
     Plugin::callHook("action_pre_login", array(&$newUser));
     if (is_object($newUser)) {
         $newUser->loadRight();
     }
     return $newUser;
 }
  public function testUserCRUD() {
    $user = new User();
    try {
      $user->load('gaurav');
    }
    catch (PAException $e) {
      if ($e->getMessage() == "No such user") {
        $user = new User();
        $user->first_name = 'Gaurav';
        $user->last_name = 'Bhatnagar';
        $user->homepage = 'http://www.newdelhitimes.org';
        $user->login_name = 'gaurav';
        $user->password = md5('password1');
        $user->email = '*****@*****.**';
        $user->save();
      }
      else {
        throw $e;
      }
    }

    $newuser = new User();
    $newuser->load('gaurav');
    $this->assertTrue($newuser->first_name == 'Gaurav');
    $newuser->delete();
    $this->assertTrue($newuser->is_active == FALSE);
  }
 public function log_in($uid, $remember_me, $login_source)
 {
     $user_type = Network::get_user_type(PA::$network_info->network_id, $uid);
     if ($user_type == DISABLED_MEMBER) {
         throw new PAException(USER_ACCESS_DENIED, 'Your account has been temporarily disabled by the administrator.');
     }
     $logged_user = new User();
     // load user
     $logged_user->load((int) $uid);
     $logged_user->set_last_login();
     PA::$login_user = $logged_user;
     register_session($logged_user->login_name, $logged_user->user_id, $logged_user->role, $logged_user->first_name, $logged_user->last_name, $logged_user->email, $logged_user->picture);
     if ($remember_me) {
         // set login cookie
         if ($this->login_cookie->is_new()) {
             $this->login_cookie->new_session($uid);
         }
         $cookie_value = $this->login_cookie->get_cookie();
         $cookie_expiry = time() + LoginCookie::$cookie_lifetime;
         // update tracking info
         $this->login_cookie->update_tracking_info($_SERVER['HTTP_USER_AGENT'], $_SERVER['REMOTE_ADDR']);
     } else {
         // clear login cookie
         $cookie_value = "";
         $cookie_expiry = 0;
     }
     // remember series ID, so we can destroy session on logout
     $_SESSION['login_series'] = $this->login_cookie->get_series();
     // remember login source, so we know if it's safe to let user change password, etc
     $_SESSION['login_source'] = $login_source;
     // set new cookie for next login!  (or delete cookie, if not remembering login)
     setcookie(PA_Login::$cookie_name, $cookie_value, $cookie_expiry, PA::$local_url, "." . PA::$domain_suffix);
 }
 public function actionReset()
 {
     $this->layout = 'login';
     $model = new User();
     if ($model->load(Yii::$app->request->post())) {
         if ($_POST['User']) {
             $model->attributes = $_POST['User'];
             $valid = $model->validate();
             if ($valid) {
                 $model = User::find()->where(['email' => $_POST['User']['email']])->one();
                 $str = 'abcefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' . date('d');
                 $potong = str_shuffle($str);
                 $random = substr($potong, 3, 12);
                 $model->setPassword($random);
                 $content = '
                 <center><img src="http://i.imgur.com/p5lHZXS.png"/></center><br/>
                 <h4 align="center">Badan Pengawas Tenaga Nuklir  ' . date('Y') . '</h4>
                 <hr/>
                 <p>Yth ' . $model->username . ',<br/>  
                 Dengan ini kami sampaikan akun untuk masuk ke Sistem Aplikasi Perjalanan Dinas – BAPETEN, sebagai berikut:<br/> 
                 Username : '******' <br/>
                 Password :<b>' . $random . '</b><br/>
                 Mohon lakukan penggantian password Anda setelah melakukan login. <hr/>
                 <h5 align="center">Subbag Perjalanan Dinas Biro Umum BAPETEN  ' . date('Y') . '</h5><br/>';
                 Yii::$app->mailer->compose("@common/mail/layouts/html", ["content" => $content])->setTo($_POST['User']['email'])->setFrom([$_POST['User']['email'] => $model->username])->setSubject('Ubah Kata Sandi')->setTextBody($random)->send();
                 $model->save();
                 return $this->redirect(['/site/login']);
             }
         }
     }
     return $this->render('reset', ['model' => $model]);
 }
 public function delete_user($account_id, $id)
 {
     $response = $this->delete_json("/accounts/" . $account_id . "/users/" . $id);
     var_dump($response);
     $user = User::load($response);
     return $user;
 }
 public function addNotification($toUser, $message, $action, $type)
 {
     $userEmp = new User();
     $userEmp->load("employee = ?", array($toUser));
     if (!empty($userEmp->employee) && $userEmp->employee == $toUser) {
         $toUser = $userEmp->id;
     } else {
         return;
     }
     $noti = new Notification();
     $user = $this->baseService->getCurrentUser();
     $noti->fromUser = $user->id;
     $noti->fromEmployee = $user->employee;
     $noti->toUser = $toUser;
     $noti->message = $message;
     if (!empty($noti->fromEmployee)) {
         $employee = $this->baseService->getElement('Employee', $noti->fromEmployee, null, true);
         if (!empty($employee)) {
             $fs = new FileService();
             $employee = $fs->updateEmployeeImage($employee);
             $noti->image = $employee->image;
         }
     }
     if (empty($noti->image)) {
         $noti->image = BASE_URL . "images/user_male.png";
     }
     $noti->action = $action;
     $noti->type = $type;
     $noti->time = date('Y-m-d H:i:s');
     $noti->status = 'Unread';
     $ok = $noti->Save();
     if (!$ok) {
         error_log("Error adding notification: " . $noti->ErrorMsg());
     }
 }
Example #8
0
/**
 * wfSetWikiaNewtalk
 *
 * Hook, set new wikia shared message
 *
 * @author
 * @author Krzysztof Krzyżaniak <*****@*****.**> (changes)
 * @access public
 *
 * @param Article $article: edited article
 *
 * @return false: don't go to next hook
 */
function wfSetWikiaNewtalk(&$article)
{
    global $wgMemc, $wgWikiaNewtalkExpiry, $wgExternalSharedDB;
    $name = $article->mTitle->getDBkey();
    $other = User::newFromName($name);
    if (!$other instanceof User && User::isIP($name)) {
        // An anonymous user
        $other = new User();
        $other->setName($name);
    }
    if ($other instanceof User) {
        $other->setNewtalk(true);
        $other->load();
        $dbw = wfGetDB(DB_MASTER, array(), $wgExternalSharedDB);
        $dbw->begin();
        /**
         * first delete
         */
        $dbw->delete("shared_newtalks", array('sn_wiki' => wfWikiID(), 'sn_user_id' => $other->getID(), 'sn_user_ip' => $other->getName()), __METHOD__);
        /**
         * then insert
         */
        $dbw->insert("shared_newtalks", array('sn_wiki' => wfWikiID(), 'sn_user_id' => $other->getID(), 'sn_user_ip' => $other->getName()), __METHOD__);
        $dbw->commit();
        $key = 'wikia:shared_newtalk:' . $other->getID() . ':' . str_replace(' ', '_', $other->getName());
        $wgMemc->delete($key);
    }
    return false;
}
Example #9
0
	public function sendEmail($subject, $toEmail, $template, $params, $ccList = array(), $bccList = array()){

		$body = $template;

		foreach($params as $k=>$v){
			$body = str_replace("#_".$k."_#", $v, $body);
		}
		
		$fromEmail = APP_NAME." <".$this->settings->getSetting("Email: Email From").">";


		//Convert to an html email
		$emailBody = file_get_contents(APP_BASE_PATH.'/templates/email/emailBody.html');

		$emailBody = str_replace("#_emailBody_#", $body, $emailBody);
		$emailBody = str_replace("#_logourl_#",
				BASE_URL."images/logo.png"
				, $emailBody);

		$user = new User();
		$user->load("username = ?",array('admin'));

		if(empty($user->id)){
			$users = $user->Find("user_level = ?",array('Admin'));
			$user = $users[0];
		}

		$emailBody = str_replace("#_adminEmail_#", $user->email, $emailBody);
		$emailBody = str_replace("#_url_#", CLIENT_BASE_URL, $emailBody);

		$this->sendMail($subject, $emailBody, $toEmail, $fromEmail, $user->email, $ccList, $bccList);
	}
 function manage_links($links)
 {
     global $base_url, $login_uid, $page_uid;
     $cnt = count($links);
     if ($cnt == 0) {
         return $links;
     }
     $result = array();
     for ($i = 0; $i < $cnt; $i++) {
         $result[$i]['comment_id'] = $links[$i]['comment_id'];
         $result[$i]['user_id'] = $links[$i]['user_id'];
         $result[$i]['comment'] = $links[$i]['comment'];
         $result[$i]['created'] = $links[$i]['created'];
         $usr = new User();
         $usr->load((int) $links[$i]['user_id']);
         $result[$i]['user_name'] = $usr->login_name;
         $result[$i]['picture'] = $usr->picture;
         $result[$i]['first_name'] = $usr->first_name;
         $result[$i]['last_name'] = $usr->last_name;
         $temp_array = array($links[$i]['parent_id'], $links[$i]['user_id']);
         if (in_array($login_uid, $temp_array)) {
             $result[$i]['delete_link'] = $base_url . '/deletecomment.php?comment_id=' . $links[$i]['comment_id'];
         }
         $login = User::get_login_name_from_id($links[$i]['user_id']);
         $current_url = $base_url . '/' . FILE_USER_BLOG . '?uid=' . $links[$i]['user_id'];
         $url_perms = array('current_url' => $current_url, 'login' => $login);
         $url = get_url(FILE_USER_BLOG, $url_perms);
         $result[$i]['hyper_link'] = $url;
     }
     return $result;
 }
Example #11
0
 public static function get_test_user($uid = 1)
 {
     // get the first user, for testing
     $user = new User();
     $user->load($uid);
     return $user;
 }
 function load($remote_id_or_userinfo)
 {
     Logger::log("Enter: ShadowUser::load");
     $remote_id = NULL;
     $userinfo = NULL;
     if (is_array($remote_id_or_userinfo)) {
         $userinfo = $remote_id_or_userinfo;
         $remote_id = $remote_id_or_userinfo['user_id'];
     } else {
         $remote_id = $remote_id_or_userinfo;
     }
     $u = parent::quick_search_extended_profile('user_id', $remote_id, $this->namespace);
     try {
         parent::load($u->login_name);
         Logger::log("Exit: ShadowUser::load, success");
     } catch (PAException $e) {
         Logger::log("Exit: ShadowUser::load, fail");
         return NULL;
     }
     // if we have been passed userinfo
     // pass it on the check for needed sync
     if ($userinfo) {
         $this->sync($userinfo);
     }
     // load th display_login_name
     $this->display_login_name = $this->get_profile_field($this->namespace, 'display_login_name');
     return $this->user_id;
 }
Example #13
0
 function doUserFunction($message)
 {
     $message = explode(' ', $message);
     $push = true;
     // message will be in messages
     $private = 0;
     // is private?
     switch ($message[0]) {
         case '/to':
             $name = str_replace('/to', '', implode(' ', $message));
             $name = explode(':', $name);
             $name = trim($name[0]);
             if ($name) {
                 $private_user = new User($name);
                 try {
                     $private_user->load();
                     $private = $private_user->id;
                 } catch (Exception $e) {
                     // no user, sorry
                 }
                 $message = str_replace('/to', '', implode(' ', $message));
                 $message = str_replace($name . ':', '', $message);
                 $message = explode(' ', $message);
             }
             break;
     }
     $message = implode(' ', $message);
     // links
     $message = preg_replace('#(?<!\\])http://[^\\s\\[<]+#i', "<a href=\"\$0\" target=\"_blank\">\$0</a>", $message);
     return array($push, $message, $private);
 }
Example #14
0
 public static function mobiletoken_update(\ApiParam $params)
 {
     if ($params->mobile) {
         try {
             $user = User::user_show($params);
             $userId = $user->id;
             $userMobile = $user->mobile;
         } catch (\Exception $e) {
             $userId = '';
             $userMobile = '';
         }
     }
     if ($params->userId) {
         try {
             $user = new \User();
             $user->load($params->userId);
             $userId = $params->userId;
             $userMobile = $user->mobile;
         } catch (\Exception $e) {
             $userId = '';
             $userMobile = '';
         }
     }
     \NotificationToken::updateDevice($params->appType, $params->appVersion, $params->deviceUniqueIdentifier, $params->deviceToken, $userId, $userMobile);
     return true;
 }
Example #15
0
 public function getEmail($_username = '')
 {
     /*
      * We only want to override the function parameters if the call has come from
      * an ajax request, simply overwriting them as we were leads to a mix up in
      * values
      */
     if (isset($this->_data['username'])) {
         if (!empty($this->_data['username'])) {
             $_username = $this->_data['username'];
         }
     }
     // Used by Ajax to return the person's email address
     // If no person is supplied, or they have no email address
     // look for the company technical email address
     // if still no email address is found, use the logged in user details
     $user = new User();
     $user->load($_username);
     if ($user) {
         $email = $user->email;
         if (!is_null($user->person_id) && !is_null($user->persondetail->email->contactmethod)) {
             $email = $user->persondetail->email->contactmethod;
         }
     }
     if (isset($this->_data['ajax'])) {
         $this->view->set('value', $email);
         $this->setTemplateName('text_inner');
     } else {
         return $email;
     }
 }
Example #16
0
 function index()
 {
     $u = new User();
     $u->load();
     if (tableExists('users')) {
         echo 'table exists<br />';
     }
 }
 public function itShouldHaveAddedAHookForUserAuthentication()
 {
     global $addon;
     $this->spec($addon->hook("user_authentication"))->shouldNot->beNull();
     $user = new User();
     $user->load("*****@*****.**", "somepassword");
     $this->spec($user->userid > 0)->should->beTrue();
 }
Example #18
0
 public function addNotification($toEmployee, $message, $action, $type, $toUserId = null, $fromSystem = false, $sendEmail = false)
 {
     $userEmp = new User();
     if (!empty($toEmployee)) {
         $userEmp->load("employee = ?", array($toEmployee));
         if (!empty($userEmp->employee) && $userEmp->employee == $toEmployee) {
             $toUser = $userEmp->id;
         } else {
             return;
         }
     } else {
         if (!empty($toUserId)) {
             $toUser = $toUserId;
         }
     }
     $noti = new Notification();
     if ($fromSystem) {
         $noti->fromUser = 0;
         $noti->fromEmployee = 0;
         $noti->image = BASE_URL . "images/icehrm.png";
     } else {
         $user = $this->baseService->getCurrentUser();
         $noti->fromUser = $user->id;
         $noti->fromEmployee = $user->employee;
     }
     $noti->toUser = $toUser;
     $noti->message = $message;
     if (!empty($noti->fromEmployee) && $noti->fromEmployee != 0) {
         $employee = $this->baseService->getElement('Employee', $noti->fromEmployee, null, true);
         if (!empty($employee)) {
             $employee = FileService::getInstance()->updateProfileImage($employee);
             $noti->image = $employee->image;
         }
     }
     if (empty($noti->image)) {
         if ($employee->gender == 'Male') {
             $noti->image = BASE_URL . "images/user_male.png";
         } else {
             $noti->image = BASE_URL . "images/user_female.png";
         }
     }
     $noti->action = $action;
     $noti->type = $type;
     $noti->time = date('Y-m-d H:i:s');
     $noti->status = 'Unread';
     $ok = $noti->Save();
     if (!$ok) {
         error_log("Error adding notification: " . $noti->ErrorMsg());
     } else {
         if ($sendEmail) {
             $emailSender = BaseService::getInstance()->getEmailSender();
             if (!empty($emailSender)) {
                 $emailSender->sendEmailFromNotification($noti);
             }
         }
     }
 }
Example #19
0
 /**
  * Create an object or return existing one.
  *
  * <code>
  * $userId = 1;
  *
  * $currency   = Crowdfunding\User::getInstance(\JFactory::getDbo(), $userId);
  * </code>
  *
  * @param \JDatabaseDriver $db
  * @param int             $id
  *
  * @return null|self
  */
 public static function getInstance(\JDatabaseDriver $db, $id)
 {
     if (!isset(self::$instances[$id])) {
         $item = new User($db);
         $item->load($id);
         self::$instances[$id] = $item;
     }
     return self::$instances[$id];
 }
Example #20
0
function _page_header($site)
{
    require_once 'classes/User.class.php';
    // $GLOBALS['user'] = new user();
    $user = new User();
    $user->load();
    $html = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>\n<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'><head>\n<meta charset='utf-8' /> \n    <title>" . $site->title . "</title>\n      <link rel='stylesheet' href='/dist/build.css'>\n    <script type='text/javascript' src='/dist/build.js' /></script>\n</head>\n\n<body id='bod'>\n\n      <h1 onClick='location.href=\"/\";'/> </h1>\n\n";
    return $html;
}
 public function postCreationSetup($params)
 {
     global $wgErrorLog, $wgServer, $wgInternalServer, $wgStatsDBEnabled;
     $wgServer = rtrim($params['url'], '/');
     $wgInternalServer = $wgServer;
     $wgStatsDBEnabled = false;
     // disable any DW queries/hooks during wiki creation
     $wgErrorLog = false;
     if ($params['founderId']) {
         $this->info('loading founding user', ['founder_id' => $params['founderId']]);
         $this->founder = \User::newFromId($params['founderId']);
         $this->founder->load();
     }
     if (!$this->founder || $this->founder->isAnon()) {
         $this->warning('cannot load founding user', ['founder_id' => $params['founderId']]);
         if (!empty($params['founderName'])) {
             $this->founder = \User::newFromName($params['founderName']);
             $this->founder->load();
         }
     }
     if (!$this->founder || $this->founder->isAnon()) {
         global $wgExternalAuthType;
         if ($wgExternalAuthType) {
             $extUser = \ExternalUser::newFromName($params['founderName']);
             if (is_object($extUser)) {
                 $extUser->linkToLocal($extUser->getId());
             }
         }
     }
     $this->wikiName = isset($params['sitename']) ? $params['sitename'] : \WikiFactory::getVarValueByName('wgSitename', $params['city_id'], true);
     $this->wikiLang = isset($params['language']) ? $params['language'] : \WikiFactory::getVarValueByName('wgLanguageCode', $params['city_id']);
     $this->moveMainPage();
     $this->changeStarterContributions($params);
     $this->setWelcomeTalkPage();
     $this->populateCheckUserTables();
     $this->protectKeyPages();
     $this->sendRevisionToScribe();
     $hookParams = ['title' => $params['sitename'], 'url' => $params['url'], 'city_id' => $params['city_id']];
     if (empty($params['disableCompleteHook'])) {
         wfRunHooks('CreateWikiLocalJob-complete', array($hookParams));
     }
     return true;
 }
Example #22
0
 /**
  * Gets the user by id or current user
  *
  * @url GET /users/$id
  * @url GET /users/current
  */
 public function getUser($id = null)
 {
     if ($id) {
         $user = User::load($id);
         // possible user loading method
     } else {
         $user = $_SESSION['user'];
     }
     return $user;
 }
Example #23
0
 public function load()
 {
     $statement = new Database(SQL::select('data,lastTime,ip,user', 'sessions', 'id=:id'), array(':id' => $this->id));
     if ($fetch = $statement->fetchObject()) {
         $this->lastTime = $fetch->lastTime;
         $this->ip = $fetch->ip;
         $this->data = (array) json_decode($fetch->data);
         if (isset($this->user)) {
             $this->user->load($fetch->user);
         }
     }
 }
 function testGetPreferredVariantUserOption()
 {
     global $wgUser;
     $wgUser = new User();
     $wgUser->load();
     // from 'defaults'
     $wgUser->mId = 1;
     $wgUser->mDataLoaded = true;
     $wgUser->mOptionsLoaded = true;
     $wgUser->setGlobalPreference('variant', 'tg-latn');
     $this->assertEquals('tg-latn', $this->lc->getPreferredVariant());
 }
 function get_moderation_queue()
 {
     $Group = new Group();
     $Group->collection_id = $this->set_id;
     $Group->is_active = 1;
     $this->Paging["count"] = $Group->get_moderation_queue('user', $cnt = TRUE);
     $members = $Group->get_moderation_queue('user', $cnt = FALSE, $this->Paging["show"], $this->Paging["page"]);
     $User = new User();
     foreach ($members as $membersDetails) {
         $User->load((int) $membersDetails);
         $this->members_data[] = array('user_id' => $User->user_id, 'first_name' => $User->first_name, 'last_name' => $User->last_name, 'email' => $User->email, 'picture' => $User->picture, 'login_name' => $User->login_name);
     }
 }
Example #26
0
 public function __construct($username, $realname = 'Real Name', $email = '*****@*****.**', $groups = [])
 {
     $this->assertNotReal();
     $this->username = $username;
     $this->password = '******';
     $this->user = User::newFromName($this->username);
     $this->user->load();
     // In an ideal world we'd have a new wiki (or mock data store) for every single test.
     // But for now, we just need to create or update the user with the desired properties.
     // we particularly need the new password, since we just generated it randomly.
     // In core MediaWiki, there is no functionality to delete users, so this is the best we can do.
     if (!$this->user->isLoggedIn()) {
         // create the user
         $this->user = User::createNew($this->username, ["email" => $email, "real_name" => $realname]);
         if (!$this->user) {
             throw new MWException("Error creating TestUser " . $username);
         }
     }
     // Update the user to use the password and other details
     $this->setPassword($this->password);
     $change = $this->setEmail($email) || $this->setRealName($realname);
     // Adjust groups by adding any missing ones and removing any extras
     $currentGroups = $this->user->getGroups();
     foreach (array_diff($groups, $currentGroups) as $group) {
         $this->user->addGroup($group);
     }
     foreach (array_diff($currentGroups, $groups) as $group) {
         $this->user->removeGroup($group);
     }
     if ($change) {
         // Disable CAS check before saving. The User object may have been initialized from cached
         // information that may be out of whack with the database during testing. If tests were
         // perfectly isolated, this would not happen. But if it does happen, let's just ignore the
         // inconsistency, and just write the data we want - during testing, we are not worried
         // about data loss.
         $this->user->mTouched = '';
         $this->user->saveSettings();
     }
 }
Example #27
0
 /**
  *  Performs login to the user and password
  *
  *  @param string $user     Username
  *  @param string $password Password
  */
 public static function doLogin($username, $password)
 {
     $user = new User();
     $user->user = $username;
     $user->pass = $password;
     if ($user->load()->valid() === true) {
         $user->visits++;
         $user->lastvisit = date("Y-m-d H:i:s");
         $user->save();
         return true;
     }
     return false;
 }
 /**
   Get all the links of different group of given search String 
   **/
 private function get_links()
 {
     global $login_uid;
     $links = array();
     if (@$this->name_string) {
         $tag_var = new Tag();
         switch ($this->name_string) {
             case 'group_tag':
                 $this->Paging["count"] = $tag_var->get_associated_contentcollectionids($this->keyword, $cnt = TRUE);
                 $tag_list = $tag_var->get_associated_contentcollectionids($this->keyword, $cnt = FALSE, $this->Paging["show"], $this->Paging["page"]);
                 $cnt = count($tag_list);
                 if ($cnt > 0) {
                     for ($i = 0; $i < $cnt; $i++) {
                         $link[$i] = Group::load_group($tag_list[$i]['id']);
                     }
                     $links['group_info'] = objtoarray($link);
                 }
                 break;
             case 'network_tag':
                 // at present we are not using this
                 break;
             case 'user_tag':
                 $this->Paging["count"] = $tag_var->get_associated_userids($this->keyword, $cnt = TRUE);
                 $tag_list = $tag_var->get_associated_userids($this->keyword, $cnt = FALSE, $this->Paging["show"], $this->Paging["page"]);
                 $cnt = count($tag_list);
                 $link = array();
                 if ($cnt > 0) {
                     for ($i = 0; $i < $cnt; $i++) {
                         $usr = new User();
                         $usr->load((int) $tag_list[$i]['id']);
                         $link[$i] = $usr;
                     }
                 }
                 $links['user_info'] = objtoarray($link);
                 break;
             case 'content_tag':
                 $this->Paging["count"] = $tag_var->get_associated_content_ids($this->keyword, $cnt = TRUE);
                 $tag_list = $tag_var->get_associated_content_ids($this->keyword, $cnt = FALSE, $this->Paging["show"], $this->Paging["page"]);
                 $cnt = count($tag_list);
                 $link = array();
                 if ($cnt > 0) {
                     for ($i = 0; $i < $cnt; $i++) {
                         $link[$i] = Content::load_content($tag_list[$i]['id'], $login_uid);
                     }
                 }
                 $links['content_info'] = objtoarray($link);
                 break;
         }
     }
     return $links;
 }
 /**
     Get data for moderation option ie group moderation
    **/
 private function get_links()
 {
     $Group = new Group();
     $Group->collection_id = $this->set_id;
     $Group->is_active = 1;
     $this->Paging["count"] = $Group->get_members($cnt = TRUE, '', '', '', '', TRUE);
     $members = $Group->get_members($cnt = FALSE, $this->Paging["show"], $this->Paging["page"], '', '', TRUE);
     $User = new User();
     foreach ($members as $membersDetails) {
         $User->load((int) $membersDetails["user_id"]);
         $this->members_data[] = array('user_id' => $membersDetails["user_id"], 'first_name' => $User->first_name, 'last_name' => $User->last_name, 'email' => $User->email, 'created' => $membersDetails['join_date'], 'picture' => $User->picture, 'user_type' => $membersDetails["user_type"], 'login_name' => $User->login_name);
     }
     return;
 }
 public function header()
 {
     $user = User::load();
     $this->set('user', $user);
     $this->set('userLink', $this->getUrl('user'));
     $this->set('usersLink', $this->getUrl('users'));
     $this->set('brandLink', $this->getUrl('brand'));
     $this->set('brandsLink', $this->getUrl('brands'));
     $this->set('categoriesLink', $this->getUrl('categories'));
     $this->set('categoryLink', $this->getUrl('category'));
     $this->set('exportLink', $this->getUrl('export'));
     $this->set('disconnectLink', $this->getUrl('disconnect'));
     $this->render('administration/header');
 }