public function adminNotify()
 {
     if ($this->cookie->check("id_user") and $this->cookie->id_user == 1) {
         //no notificamos a administrador de su propio comentario.
         return;
     }
     $id = $this->registry->lastCommentID;
     $Comment = new comment();
     $comment = $Comment->find($id);
     $comment['content'] = utils::nl2br($comment['content']);
     if (!defined('GESHI_VERSION')) {
         $comment['content'] = $this->comment_source_code_beautifier($comment['content'], 'addTagPRE');
     } else {
         $comment['content'] = $this->comment_source_code_beautifier($comment['content']);
     }
     $User = new user();
     $user = $User->find(1);
     $Post = new post();
     $post = $Post->find($comment['ID_post']);
     $commentsWaiting = $Comment->countCommentsByPost(null, 'waiting');
     $mailStr = "\n\t\t\t<table width=\"100%\">\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<small>\n\t\t\t\t\t\t<strong>From IP</strong>: {$comment['IP']}<br />\n\t\t\t\t\t\t<strong>URL</strong>: <a href=\"{$comment['url']}\">{$comment['url']}</a><br />\n\t\t\t\t\t\t<strong>Email</strong>: <a href=\"mailto:{$comment['email']}\">{$comment['email']}</a><br />\n\t\t\t\t\t\t<strong>DateTime</strong>: {$comment['created']}<br />\n\t\t\t\t\t</small>\n\t\t\t\t\t<hr>\n\t\t\t\t\t<strong>Author</strong>: {$comment['author']}<br />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr><td><strong>Content</strong></td></tr>\n\t\t\t<tr><td bgcolor=\"#f7f7f7\">\n\t\t\t\t{$comment['content']}\n\t\t\t\t<hr />\n\t\t\t</td></tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<p>\n\t\t\t\t\t\tModerate comment: <a href=\"{$this->registry->path}comments/edit/{$comment['ID']}\">{$this->registry->path}comments/edit/{$comment['ID']}</a><br />\n\t\t\t\t\t\tView entry: <a href=\"{$this->registry->path}{$post['urlfriendly']}\">{$this->registry->path}{$post['urlfriendly']}</a>\n\t\t\t\t\t</p>\n\t\t\n\t\t\t\t\t<p>\n\t\t\t\t\t\tThere are {$commentsWaiting} comments waiting for approbal. <br />\n\t\t\t\t\t\tPlease moderate comments: <a href=\"{$this->registry->path}comments/waiting\">{$this->registry->path}comments</a>\n\t\t\t\t\t</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t</table>\n\t\t";
     $conf = $this->registry->conf;
     $subject = "[{$conf['blog_name']}] Nuevo Comentario en: {$post['title']}";
     $this->enviaMail($user['email'], $subject, $mailStr, $user['email']);
 }
Example #2
0
 public function add()
 {
     global $db;
     $recipient = new user();
     if ($recipient->get('name', $this->data['recipient']) == 'done') {
         $sender = new user();
         if ($sender->get('name', $this->data['sender']) == 'done') {
             if (!$sender->isBlocked($recipient->data['id'])) {
                 $this->data['id'] = misc::newId('messages');
                 $sent = strftime('%Y-%m-%d %H:%M:%S', time());
                 $db->query('insert into messages (id, sender, recipient, subject, body, sent, viewed) values ("' . $this->data['id'] . '", "' . $sender->data['id'] . '", "' . $recipient->data['id'] . '", "' . $this->data['subject'] . '", "' . $this->data['body'] . '", "' . $sent . '", "' . $this->data['viewed'] . '")');
                 if ($db->affected_rows() > -1) {
                     $status = 'done';
                 } else {
                     $status = 'error';
                 }
             } else {
                 $status = 'blocked';
             }
         } else {
             $status = 'noSender';
         }
     } else {
         $status = 'noRecipient';
     }
     return $status;
 }
Example #3
0
 private function load_user()
 {
     include_once ROOT_PATH . 'lib/user/user.class.php';
     $user = new user();
     $uinfo = $user->verify_credentials();
     $this->user = $uinfo;
 }
function openqrm_dhcpd_resource($cmd, $resource_fields)
{
    global $event;
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_SERVER_IP_ADDRESS;
    global $OPENQRM_EXEC_PORT;
    $resource_id = $resource_fields["resource_id"];
    $resource_ip = $resource_fields["resource_ip"];
    $resource_mac = $resource_fields["resource_mac"];
    if (isset($resource_fields["resource_subnet"])) {
        $resource_subnet = $resource_fields["resource_subnet"];
    } else {
        $resource_subnet = "0.0.0.0";
    }
    $openqrm_admin_user = new user("openqrm");
    $openqrm_admin_user->set_user();
    $openqrm_server = new openqrm_server();
    $event->log("openqrm_new_resource", $_SERVER['REQUEST_TIME'], 5, "openqrm-dhcpd-resource-hook.php", "Handling {$cmd} event {$resource_id}/{$resource_ip}/{$resource_subnet}/{$resource_mac}", "", "", 0, 0, $resource_id);
    switch ($cmd) {
        case "add":
            $openqrm_server->send_command($OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-manager add -d " . $resource_id . " -m " . $resource_mac . " -i " . $resource_ip . " -s " . $resource_subnet . " -u " . $openqrm_admin_user->name . " -p " . $openqrm_admin_user->password . " --openqrm-cmd-mode background");
            break;
        case "remove":
            $openqrm_server->send_command("{$OPENQRM_SERVER_BASE_DIR}/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-manager remove -d " . $resource_id . " -m " . $resource_mac . " -i " . $resource_ip . " -s " . $resource_subnet . " -u " . $openqrm_admin_user->name . " -p " . $openqrm_admin_user->password . " --openqrm-cmd-mode background");
            break;
    }
}
Example #5
0
 /**
  * Layout Page Logic
  * @return 
  * @param $db Object
  */
 function __construct(database $db, user $user)
 {
     $this->db =& $db;
     $this->user =& $user;
     $this->sub_page = Kit::GetParam('sp', _GET, _WORD, 'view');
     $this->layoutid = Kit::GetParam('layoutid', _REQUEST, _INT);
     // If we have modify selected then we need to get some info
     if ($this->layoutid != '') {
         // get the permissions
         Debug::LogEntry('audit', 'Loading permissions for layoutid ' . $this->layoutid);
         $this->auth = $user->LayoutAuth($this->layoutid, true);
         if (!$this->auth->edit) {
             trigger_error(__("You do not have permissions to edit this layout"), E_USER_ERROR);
         }
         $this->sub_page = "edit";
         $sql = " SELECT layout, description, userid, retired, xml FROM layout ";
         $sql .= sprintf(" WHERE layoutID = %d ", $this->layoutid);
         if (!($results = $db->query($sql))) {
             trigger_error($db->error());
             trigger_error(__("Cannot retrieve the Information relating to this layout. The layout may be corrupt."), E_USER_ERROR);
         }
         if ($db->num_rows($results) == 0) {
             $this->has_permissions = false;
         }
         while ($aRow = $db->get_row($results)) {
             $this->layout = Kit::ValidateParam($aRow[0], _STRING);
             $this->description = Kit::ValidateParam($aRow[1], _STRING);
             $this->retired = Kit::ValidateParam($aRow[3], _INT);
             $this->xml = $aRow[4];
         }
     }
 }
 /**
  * Test custom userset theme assignment.
  */
 public function test_customusersetthemectx()
 {
     $this->load_csv_data();
     // ELIS user with the associated moodle user.
     $user = new user(103);
     $muser = $user->get_moodleuser();
     // Userset with a custom theme.
     $userset = new userset(1);
     $userset->field__elis_userset_theme = 'formal_white';
     $userset->field__elis_userset_themepriority = 1;
     $userset->save();
     // Assign the user to the user set.
     $usersetassign = new clusterassignment();
     $usersetassign->userid = $user->id;
     $usersetassign->clusterid = $userset->id;
     $usersetassign->save();
     // Pretend to be that user.
     $this->setUser($muser->id);
     // Initialize page.
     $page = new moodle_page();
     $page->initialise_theme_and_output();
     // Assert we have our theme.
     $this->assertEquals('formal_white', $page->theme->name);
     $this->setUser(null);
 }
Example #7
0
 public static function create_session($username, $password, $view)
 {
     $username = str_replace("['\"]", "", $username);
     $password = str_replace("['\"]", "", $password);
     $view = str_replace("['\"]", "", $view);
     $user = new user();
     $keys = array("username", "password");
     $values = array($username, md5($password));
     $user1 = $user->get_with_parameter($keys, $values);
     //error_log(var_export($user1));
     //error_log("view: $view");
     if ($user1 != null) {
         if ($view * 1 === 1 && $user1->has_group(session::GROUP_DASHBOARD) === true || $view * 1 === 2 && $user1->has_group(session::GROUP_METADATA) === true) {
             $session = new session();
             $session->session_id = uniqid();
             $session->user_id = $user1->id;
             $session->activ = 1;
             $d1 = new DateTime();
             $d1->add(new DateInterval("PT30S"));
             $session->duration_time = $d1->format("Y-m-d H:i:s");
             $session->insert();
             return $session;
         }
     }
     return NULL;
 }
Example #8
0
 public function duelRankInfo(user $user)
 {
     $points = $user->getDuelPoints();
     if ('0' == $points) {
         $level = 0;
     }
     if ('0' < $points && $points <= '1000') {
         $level = 1;
     }
     //incognito
     if ('1000' < $points && $points <= '2000') {
         $level = 2;
     }
     if ('2000' < $points && $points <= '3000') {
         $level = 3;
     }
     if ('3000' < $points) {
         $level = 4;
     }
     //now we are going to determine the place of the user.
     $repository = $this->em->getRepository('BFUserBundle:User');
     $globalRank = $repository->globalDuelRanking();
     $countryRank = $repository->countryDuelRanking($user->getCountry());
     $stateRank = $repository->stateDuelRanking($user->getState());
     $globalRank = array_search($user, $globalRank) + 1;
     $countryRank = array_search($user, $countryRank) + 1;
     $stateRank = array_search($user, $stateRank) + 1;
     //making an object to return all these informations
     $rankInfo = array('level' => $level);
     return $rankInfo;
 }
Example #9
0
 public function show()
 {
     $user_id = $this->user['id'];
     include_once ROOT_PATH . 'lib/user/user.class.php';
     $info = new user();
     $user_info = $info->getUserById($user_id, "all");
     $user_info = $user_info[0];
     $id = $user_info['id'];
     $hot_station = $this->mVideo->get_station(0, 0, 0, 10);
     if (is_array($hot_station)) {
         unset($hot_station[count($hot_station) - 1]);
     }
     $hot_video = $this->mVideo->get_video_info(0, 0, 6, '', 2);
     $stationInfo = $this->mVideo->get_user_station();
     $this->page_title = $this->lang['pageTitle'];
     $this->settings['nav_menu'][3] = array("name" => "频道设置", "url" => SNS_VIDEO . SCRIPTNAME, "last" => 1);
     $gScriptName = SCRIPTNAME;
     hg_add_head_element('js-c', "\r\n\t\t\tvar re_back = 'my_station.php';\r\n\t\t\tvar re_back_login = '******';\r\n\t\t");
     hg_add_head_element('js', RESOURCE_DIR . 'scripts/' . 'my.js');
     $this->tpl->addVar('head_line', $this->settings['nav_menu']);
     $this->tpl->addVar('id', $id);
     $this->tpl->addVar('user_id', $user_id);
     $this->tpl->addVar('user_info', $user_info);
     $this->tpl->addVar('hot_station', $hot_station);
     $this->tpl->addVar('hot_video', $hot_video);
     $this->tpl->addVar('stationInfo', $stationInfo);
     $this->tpl->addVar('gScriptName', $gScriptName);
     $this->tpl->addHeaderCode(hg_add_head_element('echo'));
     $this->tpl->setTemplateTitle($this->page_title);
     $this->tpl->outTemplate('my_station');
 }
Example #10
0
 protected function displayContent()
 {
     // nl2br converts a new line character to an HTML break tag
     $html = '<p>' . nl2br($this->pageInfo['content']) . '</p>';
     if (!isset($_SESSION['userID'])) {
         return false;
     }
     //instantiate the form
     include 'classes/formsClass.php';
     $form = new form($this->model);
     //instantiate the class user
     include 'classes/userClass.php';
     $user = new user($this->model);
     //instantiate the class centre
     include 'classes/centreClass.php';
     $centre = new centre($this->model);
     $html .= $user->displayUserPage();
     if (!isset($_POST['submitRate'])) {
         $html .= '<div><br/><br/>';
         $html .= $centre->displayCentres();
         $html .= '</div>';
     } else {
         $result = $centre->addRate();
         if (!$result) {
             $html .= '<h4 class="redhead">You have successfully <br/>ranked the centre!</h4>';
             //count function
             //$html .= $centre -> displayNewRanking();
             //display the arrays in the
         } else {
             $html .= '<h4>Sorry, something went wrong please contact us <a href="index.php?page=contact">here</a></h4>';
         }
     }
     return $html;
 }
Example #11
0
function create_kvm_vm($host_resource_id, $name, $mac, $memory, $cpu, $swap, $additional_nic_str, $vm_type, $vncpassword)
{
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_SERVER_IP_ADDRESS;
    global $OPENQRM_EXEC_PORT;
    global $RESOURCE_INFO_TABLE;
    global $event;
    $event->log("create_kvm_vm_local", $_SERVER['REQUEST_TIME'], 5, "kvm-cloud-hook", "Creating KVM VM {$name} on Host resource {$host_resource_id}", "", "", 0, 0, 0);
    // start the vm on the host
    $host_resource = new resource();
    $host_resource->get_instance_by_id($host_resource_id);
    // we need to have an openQRM server object too since some of the
    // virtualization commands are sent from openQRM directly
    $openqrm = new openqrm_server();
    $openqrm_admin_user = new user("openqrm");
    $openqrm_admin_user->set_user();
    $vncpassword_parameter = "";
    if ($vncpassword != '') {
        $vncpassword_parameter = " -v " . $vncpassword;
    }
    // send command to create vm
    $vm_create_cmd = "{$OPENQRM_SERVER_BASE_DIR}/openqrm/plugins/kvm/bin/openqrm-kvm-vm create -n " . $name . " -y " . $vm_type . " -m " . $mac . " -r " . $memory . " -c " . $cpu . " -b local " . $additional_nic_str . " " . $vncpassword_parameter . " -u " . $openqrm_admin_user->name . " -p " . $openqrm_admin_user->password;
    $host_resource->send_command($host_resource->ip, $vm_create_cmd);
    $event->log("create_kvm_vm_local", $_SERVER['REQUEST_TIME'], 5, "kvm-cloud-hook", "Running {$vm_create_cmd}", "", "", 0, 0, 0);
}
function IMPORT_MEMBERS()
{
    $me = $_SERVER["SERVER_NAME"];
    $error = array();
    $members = unserialize(base64_decode($_POST["MEMBERS"]));
    writelogs("Analyze " . count($members) . " members for ou " . $_POST["OU"], __FUNCTION__, __FILE__, __LINE__);
    while (list($uid, $array) = each($members)) {
        writelogs("Analyze {$uid} for ou " . $_POST["OU"], __FUNCTION__, __FILE__, __LINE__);
        $user = new user($uid);
        if ($user->UserExists) {
            $user->password = $array["password"];
            if ($user->add_user()) {
                $success[] = "{$me}::IMPORT_MEMBERS:: Success updating {$uid} in LDAP database";
            } else {
                $error[] = "Failed updating {$uid} in LDAP database\n {$user->ldap_error}";
            }
            continue;
        }
        while (list($key, $value) = each($array)) {
            $user->{$key} = $value;
        }
        if ($user->add_user()) {
            $success[] = "{$me}::IMPORT_MEMBERS:: Success adding {$uid} in LDAP database";
        } else {
            $error[] = "Failed adding {$uid} in LDAP database\n {$user->ldap_error}";
        }
    }
    if (count($error) > 0) {
        echo "<ERROR>" . @implode("\n", $error) . "</ERROR>";
    }
    if (count($success) > 0) {
        echo "<SUCCESS>" . @implode("\n", $success) . "</SUCCESS>";
    }
}
 public function login()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('username', 'username', 'required|trim|min_length[3]');
     $this->form_validation->set_rules('password', 'password', 'required|trim|min_length[3]');
     if ($this->form_validation->run() == false) {
         $this->load->view('loginview');
     } else {
         $user = new user();
         $user->set_username($this->input->post('username'));
         $user->set_password($this->input->post('password'));
         $mannualauth = new user_mannual_auth($user);
         if ($return = $mannualauth->authenticate()) {
             switch ($return) {
                 case 'ACCOUNT_INVALID':
                     echo $return;
                     break;
                 case 'PASSWORD_INCORRECT':
                     echo $return;
                     break;
                 case 'USER_NOT_FOUND':
                     echo $return;
                     break;
                 default:
                     $mannualauth->role();
                     $this->session->set_userdata('user', serialize($user));
                     redirect('home/dashboard');
                     break;
             }
         } else {
             echo "Error:some problem occured in creation";
         }
     }
 }
Example #14
0
 public function loginAction()
 {
     $view = (include "../view/loginform.php");
     return $view;
     session_start();
     require_once '../model/loginModel.php';
     $formLogin = true;
     $error = array();
     $user = new user();
     if (empty($_POST)) {
         $result = $user->loginUser($pdo);
         if (isset($_POST['pseudo'])) {
             $error['pseudo'] = 'Veuillez indiquer votre pseudo';
             $formLogin = false;
         }
         if (!isset($_POST['password']) || strlen($_POST['password']) < 6) {
             $error['password'] = '******';
             $formLogin = false;
         }
         $_POST['password'] = trim(htmlentities(sha1($_POST['password'])));
         if ($result['password'] != $_POST['password']) {
             $error['passcheck'] = 'mot de passe est incorrect';
             $formLogin = false;
         }
         if ($formLogin) {
             http_response_code(400);
             echo json_encode(array('success' => false, "errors" => $errors));
         } else {
             $_SESSION['pseudo'] = $info['pseudo'];
             $_SESSION['id'] = $info['id'];
             $result = $login->loginUser($pdo);
             echo json_encode(array('success' => true, "user" => $_POST));
         }
     }
 }
 private function process()
 {
     $this->commonProcess();
     $config = services::getService('config');
     $lang = services::getService('lang');
     $params = services::getService('pageParams');
     $mail = services::getService('mail');
     $geo = services::getService('geoinfo');
     $categories = services::getService('cats');
     if ($params->getParam('add_to_adressbook')) {
         $addr = new adressbook();
         $addr->sender_id = $this->user->id;
         $addr->recipient_id = $params->getParam('showmember');
         if (!$addr->find()) {
             $addr->insert();
             $this->addMsg('msg_adressbook_add_success');
         } else {
             $this->addMsg('msg_adressbook_add_allready');
         }
     }
     // build userlist
     // assotiativ array with object and detail-flag
     $smember = new user();
     $smember->id = $params->getParam('showmember');
     $smember->find(true);
     $member = array("obj" => $smember);
     $this->member = $member;
     $this->member['obj']->getPhoto();
     $this->geodist = $geo->getDistance($this->user, $this->member["obj"]);
 }
Example #16
0
 public function getSectorLink($x, $y, &$i)
 {
     if (isset($this->data[$i]) && $this->data[$i]['x'] == $x && $this->data[$i]['y'] == $y) {
         if ($this->data[$i]['type'] != 2) {
             $output = 'href="javascript: fetch(\'getGrid.php\', \'x=' . $x . '&y=' . $y . '\')" onMouseOver="setSectorData(labels[' . $this->data[$i]['type'] . '], \'-\', \'-\')" onMouseOut="setSectorData(\'-\', \'-\', \'-\')"';
         } else {
             $node = new node();
             $node->get('id', $this->data[$i]['id']);
             $user = new user();
             $user->get('id', $node->data['user']);
             $alliancename = '-';
             if ($user->data['alliance']) {
                 $alliance = new alliance();
                 $alliance->get('user', $user->data['id']);
                 $alliancename = $alliance->data['name'];
             }
             $output = 'href="javascript: fetch(\'getGrid.php\', \'x=' . $x . '&y=' . $y . '\')" onMouseOver="setSectorData(\'' . $node->data['name'] . '\', \'' . $user->data['name'] . '\', \'' . $alliancename . '\')" onMouseOut="setSectorData(\'-\', \'-\', \'-\')"';
         }
         if ($i < count($this->data) - 1) {
             $i++;
         }
     } else {
         $output = 'href="javascript: fetch(\'getGrid.php\', \'x=' . $x . '&y=' . $y . '\')"';
     }
     return $output;
 }
Example #17
0
function popup()
{
    $users = new usersMenus();
    $ct = new user($_GET["uid"]);
    $tpl = new templates();
    $title = $ct->DisplayName;
    $GRPS = $ct->GetGroups($_GET["uid"], 1);
    while (list($num, $GroupName) = each($ct->GroupsOf)) {
        $jsGRP = "Loadjs('domains.edit.group.php?js=yes&group-id={$num}',true)";
        $XTRG[] = "<tr>\n\t\t\t\t\t<td style='width:16px'><img src='img/wingroup.png'></td>\n\t\t\t\t\t<td style='font-size:16px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$jsGRP}\" style='text-decoration:underline'>{$GroupName}</a></td>\n\t\t\t\t</tr>";
    }
    $editjs = MEMBER_JS($_GET["uid"], 1, 1);
    $bouton = button("{edit_member}", $editjs, 18, 185);
    if ($users->cyrus_imapd_installed) {
        include_once dirname(__FILE__) . "/ressources/class.cyrus.inc";
        $cyr = new cyrus();
        $RealMailBox = $cyr->IfMailBoxExists($_GET["uid"]);
        $button2 = "<div style='margin-top:10px'>" . button("{mailbox}", "Loadjs('domain.edit.user.cyrus-mailbox.php?js=yes&uid={$_GET["uid"]}')", 18, 185) . "</div>";
        if (!$RealMailBox) {
            if (preg_match("#Authentication failed#i", $cyr->cyrus_infos)) {
                $error = "<p class=text-error>{authentication_failed_cyrus}</p>";
            } else {
                $error = "<p class=text-error>{user_no_mailbox} !!</p>";
                $button2 = "<div style='margin-top:10px'>" . button("{create_mailbox2}", "Loadjs('domains.edit.user.php?create-mailbox-wizard=yes&uid={$_GET["uid"]}&MailBoxMaxSize=0')", 18, 185) . "</div>";
            }
        }
    }
    $picture_link = "img/impersonate-photo.png";
    $html = "\n\t{$error}\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='width:190px;vertical-align:top'>\n\t\t<center style='margin-top:15px'>\n\t\t<img style='border-radius: 50% 50% 50% 50%;\n    \t\tbox-shadow: 0 0 5px silver;height: 180px;margin: 0 32px;width: 180px;' src='{$picture_link}'></a>\n    <center style='font-size: 24px;line-height: 1.2;word-wrap: break-word;margin-top:30px;margin-bottom:30px'>\n    {$title}</center>\n\n    {$bouton}{$button2}\n    </center>\t\n\t</td>\n\t\t<td style='width:80%;vertical-aglin:top'>\n\t\t\t<table style='width:100%'>\n\t\t\t\t\t</tr>\t\t\t\n\t\t\t\t<tr style='height:70px'>\n\t\t\t\t<td valign=middle style='font-size:26px' class=legend><div>{Contact_Information}:</div>\n\t\t\t\t<i style='font-size:16px'>{$description}</i></td>\n\t\t\t</tr>\n\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{member}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$ct->givenName} {$ct->sn}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{account}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$ct->uid}</strong></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{email}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$ct->mail}</strong></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{telephoneNumber}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$ct->telephoneNumber}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{mobile}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$ct->mobile}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\t\t<tr style='height:70px'>\n\t\t\t\t<td valign=middle style='font-size:26px' class=legend>" . count($GRPS) . " {groups}:</td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td><table style='width:100%'>" . @implode("", $XTRG) . "</table></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t</table>\n\t<p>&nbsp;</p>\n\t</div>\n\t\t\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
function SaveInfos()
{
    $ct = new user($_GET["uid"]);
    $ct->EnableBackupAccount = $_GET["EnableBackupAccount"];
    $ct->RsyncBackupTargetPath = $_GET["RsyncBackupTargetPath"];
    $ct->save_EnableBackupAccount();
}
Example #19
0
 /**
  * Test for correct assignment of course permissions
  */
 public function test_coursepermissions()
 {
     global $DB, $CFG, $USER;
     accesslib_clear_all_caches(true);
     set_config('siteguest', '');
     set_config('siteadmins', '');
     $this->assertFalse($this->has_program_create_capability());
     $this->assertFalse($this->has_associate_and_manage_capability());
     $this->assertFalse($this->has_program_view_capability());
     $syscontext = context_system::instance();
     $assigninguser = new user(array('idnumber' => 'testuserid', 'username' => 'testuser', 'firstname' => 'testuser', 'lastname' => 'testuser', 'email' => '*****@*****.**', 'country' => 'CA'));
     $assigninguser->save();
     $roleid = create_role('userrole', 'userrole', 'userrole');
     $usr = $DB->get_record('user', array('username' => 'testuser'));
     $this->setUser($usr);
     $USER = $usr;
     assign_capability('local/elisprogram:associate', CAP_ALLOW, $roleid, $syscontext->id);
     assign_capability('local/elisprogram:manage', CAP_ALLOW, $roleid, $syscontext->id);
     assign_capability('local/elisprogram:program_create', CAP_ALLOW, $roleid, $syscontext->id);
     assign_capability('local/elisprogram:program_enrol', CAP_ALLOW, $roleid, $syscontext->id);
     assign_capability('local/elisprogram:program_view', CAP_ALLOW, $roleid, $syscontext->id);
     role_assign($roleid, $usr->id, $syscontext->id);
     $this->assertTrue($this->has_program_create_capability());
     $this->assertTrue($this->has_associate_and_manage_capability());
     $this->assertTrue($this->has_program_view_capability());
     $this->setUser(null);
 }
 static function reconcileAllPaymentUids()
 {
     $txn = new paypal_transaction();
     $extraWhere = "bp_biobounce_uid ='0'";
     while ($txn->loadNext($extraWhere)) {
         $found = false;
         $email = $txn->get_variable('bp_paypal_email');
         $paypalid = $txn->get_variable('bp_paypal_payer_id');
         $txnFind = new paypal_transaction();
         $extraWhere2 = "bp_biobounce_uid<>'0' AND bp_paypal_payer_id='" . $paypalid . "'";
         if ($txnFind->load($extraWhere2)) {
             $bioId = $txnFind->get_variable('bp_biobounce_uid');
             $found = true;
             //echo "\n\nFOUND THE USER ID BASED ON PREVIOUSLY BEING SET:PAYPALID=" . $paypalid;
         } else {
             $usr = new user();
             $usr->set_variable('users_email', $email);
             if ($usr->load()) {
                 $bioId = $usr->get_variable('users_id');
                 $found = true;
                 //echo "\nFOUND THE USER ID BASED ON SAME EMAIL ADDRESS:ADDRESS=" . $email;
             }
         }
         if ($found) {
             $txnId = $txn->get_variable('bp_id');
             //echo "\nUPDATING TRANSACTION NUMBER=" . $txnId . " to use UID=" . $bioId;
             $txn->set_variable('bp_biobounce_uid', $bioId);
             $txn->update();
         }
     }
 }
Example #21
0
/**
 * Initialisation de la session utilisateur
 */
function startSession()
{
    global $config;
    if (!isset($_SESSION) || $_SESSION === NULL) {
        session_start();
    }
    if (isset($_GET['login']) && (isset($_GET['password']) || isset($_GET['passwordmd5']))) {
        $user = new user();
        $res = $user->getFromLogin();
        if ($res !== FALSE) {
            $_SESSION[$config['sessionName']]['user'] = $res;
            if (isset($_GET['remember-me']) && $res !== FALSE) {
                $params = session_get_cookie_params();
                setcookie('login', $_GET['login'], $config['cookieTime'], $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
                setcookie('passwordmd5', $res['password'], $config['cookieTime'], $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
            }
            $menu = $user->getUserMenu();
            if (is_array($menu)) {
                $_SESSION[$config['sessionName']]['menu'] = $menu;
            }
        } else {
            $_SESSION[$config['sessionName']] = FALSE;
        }
    }
}
function Save()
{
    $ct = new user($_POST["uid"]);
    if (!$ct->SaveUserPhones($_POST["phone"], $_POST["mobile"])) {
        echo $ct->error;
    }
}
Example #23
0
 public function getPosts($status = null, $limitQuery = null)
 {
     $P = new post();
     $posts = array();
     if (is_null($status) === true) {
         $posts = $P->findAll("ID,id_user,urlfriendly,title,IF(POSITION('<!--more-->' IN content)>0,MID(content,1,POSITION('<!--more-->' IN content)-1),content) as content, created", 'ID DESC', $limitQuery, null);
     } else {
         if (is_array($status) === false) {
             $posts = $P->findAll("ID,id_user,urlfriendly,title,IF(POSITION('<!--more-->' IN content)>0,MID(content,1,POSITION('<!--more-->' IN content)-1),content) as content, created", 'ID DESC', $limitQuery, "WHERE status='{$status}'");
         } else {
             $status_sql = "";
             foreach ($status as $st) {
                 $status_sql .= "status ='{$st}' OR ";
             }
             $status_sql = substr($status_sql, 0, -3);
             $posts = $P->findAll("ID,id_user,urlfriendly,title,IF(POSITION('<!--more-->' IN content)>0,MID(content,1,POSITION('<!--more-->' IN content)-1),content) as content, created", 'ID DESC', $limitQuery, "WHERE ({$status_sql})");
         }
     }
     $C = new comment();
     foreach ($posts as $k => $p) {
         $posts[$k]['title'] = htmlspecialchars($posts[$k]['title']);
         $posts[$k]['tags'] = $this->getTags($posts[$k]['ID']);
         $posts[$k]['comments_count'] = $C->countCommentsByPost($posts[$k]['ID'], "publish");
         $U = new user();
         if ($posts[$k]['id_user'] < 2) {
             $posts[$k]['autor'] = $U->find(1);
         } else {
             $posts[$k]['autor'] = $U->find($posts[$k]['id_user']);
         }
     }
     return $posts;
 }
 function redirectRole()
 {
     $userName = $this->input->post('userName');
     $password = $this->input->post('password');
     $this->load->model('user');
     $user = new user();
     $results = $user->searchUserByUsename($userName);
     if ($results[0]->userid == 1) {
         $this->load->model('Vacancy');
         $vacancy = new Vacancy();
         $array = $vacancy->getVacancyByUser($results[0]->userid);
         $data["vacancies"] = $array;
         $this->load->view('mainView', $data);
     } else {
         if ($results[0]->userid == 2) {
             $this->load->model('Vacancy');
             $vacancy = new Vacancy();
             $array = $vacancy->getVacancyByUser($results[0]->userid);
             $data["vacancies"] = $array;
             $this->load->view('employerView', $data);
         } else {
             if ($results[0]->userid == 3) {
                 $this->load->model('Event');
                 $event = new Event();
                 $array = $event->getAllEventByUser($results[0]->userid);
                 $data["events"] = $array;
                 $this->load->view('organizerview', $data);
             }
         }
     }
 }
Example #25
0
 public function login($msg = null)
 {
     if ($this->session->check("logged") == true) {
         $this->redirect("admin");
     }
     if ($msg == "nosession") {
         $this->session->flash("La URL solicitada necesita autentificacion.");
     } elseif ($msg == "fail") {
         $this->session->flash("Lo siento, la informacion ingresada es incorrecta.");
     } elseif ($msg == "logout") {
         $this->session->flash("Haz terminado la sesion correctamente.");
     }
     if ($this->data) {
         $U = new user();
         if ($id_user = $U->validateLogin($this->data)) {
             $user = $U->find($id_user);
             $this->session->user = $user;
             $this->session->logged = true;
             $this->redirect("admin/");
         } else {
             $this->redirect("admin/login/fail/");
         }
     } else {
         $this->view->setLayout("admin");
         $this->title_for_layout("Login - Codice CMS");
         $this->render();
     }
 }
 public function _index()
 {
     $id = $_SESSION['USERID'];
     $image = new image();
     $image->model->lockMutiQuery();
     $recommender = recommender::getInstance();
     //$recommender->set_rating();
     $recommenduser = $recommender->get_user_similar($id);
     $usr = new user();
     foreach ($recommenduser as $user) {
         $username = $usr->getuserbyid($user['member_id']);
         $recmduser .= '<div style="width:180px;float:left;"><div style="float:left"><a href="/user/' . $user['member_id'] . '" title="' . $username . '"><img src="/upload/avatar_small/' . $user['member_id'] . '_small.jpg"/></a></div><a href="/user/' . $user['member_id'] . '" title="' . $username . '"><h4 style="color:#09F;">' . $username . '</h4></a>喜好相似度:' . $user['sim'] . '%</div>';
     }
     $rec = $recommender->get_item_recommend($id);
     foreach ($rec as $re) {
         $image->model->Get_By_ImageId($re['product_id']);
     }
     $image->model->MultiQuery();
     $imgs = $image->model->getresult();
     $favor = new favourite();
     foreach ($imgs as $img) {
         $url = rawurlencode($img->imgurl);
         $desc = $img->Description;
         $like = $favor->islikeimg($_SESSION['USERID'], $r2->ImageId);
         // $recimg.='<img class="imginfo" src="/medium/'.rawurlencode($img->imgurl).'"/>';
         $recimg .= "<img class='imginfo' src='/medium/" . $url . "' data-url='/files/" . $url . "' data-id='" . $img->ImageId . "' title='" . $desc . "' data-desc='" . $desc . "' data-like='" . $like . "' data-like-num='" . $img->Original . "' data-tags='" . $img->feature . "'data-author='" . $img->user->NickName . "' >";
     }
     $this->values = array('recommenduser' => $recmduser, "title" => "ACGPIC向你推荐:", "recommendimg" => $recimg);
     $this->RenderTemplate('index');
 }
function USER_JUNK_LEARNING_SAVE()
{
    $uid = $_GET["uid"];
    $users = new user($uid);
    $users->EnableUserSpamLearning = $_GET["EnableUserSpamLearning"];
    $users->SaveJunkLearning();
}
Example #28
0
function getConversationList()
{
    if (isset($_SESSION['userid'])) {
        $users = array();
        $userid;
        $dbhandle = db_connect();
        $stmt = $dbhandle->stmt_init();
        //We must search both people who messaged you AND people you messaged
        //Ensure no duplicates
        $stmt->prepare("SELECT Distinct UserID FROM(\n\t\t\t\t\t\t(SELECT SenderID AS UserID, Time FROM Messages WHERE ReceiverID = ?)\n\t\t\t\t\t\tUNION ALL\n\t\t\t\t\t\t(SELECT ReceiverID AS UserID, Time FROM Messages WHERE SenderID = ?)\n\t\t\t\t\t\tORDER BY Time desc\n\t\t\t\t\t\t)t ");
        $stmt->bind_param("ii", $_SESSION['userid'], $_SESSION['userid']);
        $stmt->execute();
        $stmt->store_result();
        $stmt->bind_result($userid);
        //Add each resulting user to the array to return
        while ($stmt->fetch()) {
            $user = new user();
            $user->getFromDB($userid);
            array_push($users, $user);
        }
        $stmt->close();
        $dbhandle->close();
        return $users;
    }
}
 /**
  * Test student save works when $USER object not set
  */
 public function test_student_save_nouserobject()
 {
     global $DB, $USER;
     // Create Moodle course category.
     $crscat = create_course_category((object) array('name' => 'Test Course category', 'idnumber' => 'MCC-1'));
     // Create Moodle course.
     $crsdata = array('category' => $crscat->id, 'fullname' => 'MC-TEST-ELIS-8484', 'shortname' => 'MC-TEST-ELIS-8484', 'idnumber' => 'MC-TEST-ELIS-8484');
     $mdlcrs = new stdClass();
     $mdlcrs->id = $DB->insert_record('course', (object) $crsdata);
     $cddata = array('name' => 'CD-ELIS-8484', 'code' => 'CD-ELIS-8484', 'idnumber' => 'CD-ELIS-8484', 'syllabus' => 'syllabus');
     $cd = new course($cddata);
     $cd->save();
     $ci = new pmclass(array('idnumber' => 'CI-ELIS-8484', 'courseid' => $cd->id, 'moodlecourseid' => $mdlcrs->id, 'autocreate' => 0));
     $ci->save();
     $testuser = new user(array('idnumber' => 'testuserelis8484', 'username' => 'testuserelis8484', 'firstname' => 'Test', 'lastname' => 'User-ELIS8484', 'email' => '*****@*****.**', 'city' => 'Waterloo', 'country' => 'CA'));
     $testuser->save();
     $USER = null;
     $sturec = new stdClass();
     $sturec->userid = $testuser->id;
     $sturec->classid = $ci->id;
     $sturec->grade = 0;
     $sturec->enrolmenttime = time();
     $student = new student($sturec);
     $student->save();
     $this->assertFalse(empty($student));
     if (!empty($student)) {
         $this->assertFalse(empty($student->id));
     }
 }
Example #30
0
function PhotoUploaded()
{
    $tmp_file = $_FILES['photo']['tmp_name'];
    $content_dir = dirname(__FILE__) . "/ressources/conf/upload";
    if (!is_dir($content_dir)) {
        @mkdir($content_dir);
    }
    if (!@is_uploaded_file($tmp_file)) {
        writelogs("PHOTO: error_unable_to_upload_file", __FUNCTION__, __FILE__, __LINE__);
        $GLOBALS["Photo_error"] = '{error_unable_to_upload_file} ' . $tmp_file;
        return;
    }
    $name_file = $_FILES['photo']['name'];
    if (file_exists($content_dir . "/" . $name_file)) {
        @unlink($content_dir . "/" . $name_file);
    }
    if (!move_uploaded_file($tmp_file, $content_dir . "/" . $name_file)) {
        $GLOBALS["Photo_error"] = "{error_unable_to_move_file} : " . $content_dir . "/" . $name_file;
        writelogs("PHOTO: {error_unable_to_move_file} : " . $content_dir . "/" . $name_file, __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    $file = $content_dir . "/" . $name_file;
    writelogs("PHOTO: {$file}", __FUNCTION__, __FILE__, __LINE__);
    if (isset($_POST["uid"])) {
        $_GET["uid"] = $_POST["uid"];
        $user = new user($_POST["uid"]);
        $jpegPhoto_datas = file_get_contents($file);
        $user->add_user();
        writelogs("PHOTO: Edit: " . strlen($jpegPhoto_datas) . " bytes", __FUNCTION__, __FILE__, __LINE__);
        if (!$user->SaveUserPhoto($jpegPhoto_datas)) {
            $GLOBALS["Photo_error"] = $user->ldap_error;
            return;
        }
        if (is_file($user->thumbnail_path)) {
            unlink($user->thumbnail_path);
        }
        return null;
    }
    if (isset($_POST["employeeNumber"])) {
        $_GET["employeeNumber"] = $_POST["employeeNumber"];
        $user = new contacts($_SESSION["uid"], $_POST["employeeNumber"]);
        $user->jpegPhoto_datas = file_get_contents($file);
        if ($_SESSION["uid"] != -100) {
            $ldap = new clladp();
            $user2 = new user($_SESSION["uid"]);
            $dn = "cn={$user->sn} {$user->givenName},ou={$user2->uid},ou=People,dc={$user2->ou},dc=NAB,{$ldap->suffix}";
            if ($dn == $user->dn) {
                $user->Save();
            } else {
                $tpl = new templates();
                echo $tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS}');
            }
        }
        if (is_file($user->thumbnail_path)) {
            unlink($user->thumbnail_path);
        }
        return null;
    }
}