function initializeModule($request_method, $request_data)
 {
     if (!empty($this->shared_data['group_info'])) {
         $this->gid = $this->shared_data['group_info']->collection_id;
         $this->view_type = "all";
         if ($this->shared_data['group_info']->group_type == "typedgroup") {
             PA::$config->useTypedGroups = true;
             require_once 'api/Entity/TypedGroupEntity.php';
             $this->entity = TypedGroupEntity::load_for_group((int) $this->gid);
             $this->entity_type = $this->entity->entity_type;
             PA::$group_noun = $this->entity->entity_type;
             // echo "<pre>".print_r($this->entity, 1)."</pre>";exit;
         }
     }
     $this->network_info = PA::$network_info;
     global $paging;
     $this->Paging["page"] = $paging["page"];
     $this->Paging["show"] = $paging["show"];
     $this->page_user = NULL;
     if (PA::$page_uid && PA::$page_uid != PA::$login_uid) {
         $user = new User();
         $user->load(PA::$page_uid);
         $this->page_user = $user->get_name();
     }
 }
 /**
  * activate an existing record in database
  * @param $encoded_key_string string unique identifier of record to be archived
  * @return bool indicates if record has been archived
  */
 function activate($encoded_key_string)
 {
     $this->_log->trace("activating record from UserDatabaseTable (encoded_key_string=" . $encoded_key_string . ")");
     # call parent archive()
     if (parent::activate($encoded_key_string, $this->_user->get_name()) == FALSE) {
         return FALSE;
     }
     $this->_log->trace("activated record from UserDatabaseTable");
     return TRUE;
 }
 /**
  * update an existing note in database
  * @param $note_id int unique identifier of a specific ListTableNote object
  * @param $note string the updated note
  * @return bool indicates if ListTableNote has been updated
  */
 function update($note_id, $note)
 {
     $this->_log->trace("updating ListTableNote (note_id={$note_id})");
     # create encoded_key_string
     $encoded_key_string = parent::_encode_key_string(DB_ID_FIELD_NAME . "='{$note_id}'");
     # create name_value_array
     $name_values_array = array();
     $name_values_array[LISTTABLENOTE_NOTE_FIELD_NAME] = $note;
     if (parent::update($encoded_key_string, $this->_user->get_name(), $name_values_array) == FALSE) {
         return FALSE;
     }
     $this->_log->trace("updated ListTableNote");
     return TRUE;
 }
 /**
  * proces an attachment (either do nothing, insert an attachment or delete an attachment)
  * @param $record_id int unique identifier of a ListTable object
  * @param $attachment_str string string representing attachment details
  * @return int number indicates the id of the new attachment or 0 when no record was added
  */
 function insert($record_id, $attachment_id, $attachment_str)
 {
     $this->_log->trace("inserting ListTableAttachment (record_id={$record_id}, attachment_id={$attachment_id}, attachments_str={$attachment_str})");
     $return_value = TRUE;
     $attachment_array = explode('|', $attachment_str);
     $full_tmp_name = "uploads/" . $attachment_array[0];
     $type = $attachment_array[1];
     $size = $attachment_array[2];
     $name = $attachment_array[3];
     $name_values_array = array();
     $name_values_array[LISTTABLEATTACHMENT_RECORD_ID_FIELD_NAME] = $record_id;
     $name_values_array[LISTTABLEATTACHMENT_TYPE_FIELD_NAME] = $type;
     $name_values_array[LISTTABLEATTACHMENT_SIZE_FIELD_NAME] = $size;
     $name_values_array[LISTTABLEATTACHMENT_NAME_FIELD_NAME] = $name;
     if (file_exists($full_tmp_name) == FALSE) {
         $this->_handle_error("could not find file to attachment (file name=" . $full_tmp_name . ")", "ERROR_UPLOAD_FILE_NOT_FOUND");
         return 0;
     }
     $file_handler = fopen($full_tmp_name, "r");
     if ($file_handler == FALSE) {
         $this->_handle_error("could not open file to attachment (file name=" . $full_tmp_name . ")", "ERROR_UPLOAD_COULD_NOT_OPEN");
         return 0;
     }
     $read_file_str = fread($file_handler, filesize($full_tmp_name));
     fclose($file_handler);
     unlink($full_tmp_name);
     # add slashes to attachment
     $name_values_array[LISTTABLEATTACHMENT_ATTACHMENT_FIELD_NAME] = addslashes($read_file_str);
     # call parent insert()
     $new_attachment_id = parent::insert($name_values_array, $this->_user->get_name());
     if ($new_attachment_id == 0) {
         return 0;
     }
     $this->_log->trace("processed ListTableAttachment");
     return $new_attachment_id;
 }
Example #5
0
function create_user($name, $email, $password)
{
    if (is_null(get_user_by_name($name))) {
        $user = new User();
        $user->set_name($name)->set_email($email)->set_password($password);
        $mysqli = new mysqli(get_db_host(), get_db_user(), get_db_password(), get_db_database());
        $stmt = $mysqli->prepare("INSERT INTO user(name, email, password_hash) VALUES (?, ?, ?)");
        $stmt->bind_param("sss", $user->get_name(), $user->get_email(), $user->get_password_hash());
        $stmt->execute();
        $stmt->close();
    }
}
Example #6
0
 function akismet_check()
 {
     global $base_url, $akismet_key;
     if (!@$akismet_key) {
         return;
     }
     $ak = new Akismet($akismet_key);
     $params = array("user_ip" => $this->ip_addr, "user_agent" => $this->user_agent, "referrer" => $this->referrer, "permalink" => "{$base_url}/content.php?cid=" . $this->content_id, "comment_type" => "comment", "comment_author" => $this->name, "comment_author_email" => $this->email, "comment_author_url" => $this->homepage, "comment_content" => $this->comment);
     if ($this->user_id > 0) {
         $user = new User();
         $user->load((int) $this->user_id);
         $params['comment_author'] = $user->get_name();
         $params['comment_author_email'] = $user->email;
         $params['comment_author_url'] = "{$base_url}/user.php?uid={$this->user_id}";
     }
     $akismet_decision = $ak->check_spam($base_url, $params);
     switch ($akismet_decision) {
         case 'true':
             $this->akismet_spam = 1;
             break;
         case 'false':
             $this->akismet_spam = 0;
             break;
         default:
             // akismet couldn't make up its mind - probably we didn't give it enough data.
             return;
     }
     $sql = "";
     if ($this->akismet_spam) {
         $this->spam_state = SPAM_STATE_AKISMET;
         $this->is_active = 0;
         $sql .= ", spam_state={$this->spam_state}, is_active={$this->is_active}";
     }
     Dal::query("UPDATE comments SET akismet_spam=? {$sql} WHERE comment_id=?", array($this->akismet_spam, $this->comment_id));
 }
Example #7
0
 function index()
 {
     $deleted = array();
     //用email建立user1
     //$user1 = $this->user->create($this->url, 'name', $this->user_name);
     $user1 = $this->user->create_user($this->url, $this->user_email);
     //檢查user1的name
     $this->unit->run($user1->get_name(), 'puddingchen.35', '檢查user1的name');
     $deleted[] = $user1->get_id();
     //檢查$user1的domain
     $domain1 = $user1->get_domain();
     $this->unit->run($domain1->get_host(), $this->host, '檢查$user1的domain');
     //測試密碼是否如期一樣地編碼
     $this->unit->run($user1->_crypt_password($this->password), $this->crypt_password, '測試密碼是否如期一樣地編碼');
     //設定user1的密碼
     $user1->set_password($this->password);
     $user1->update();
     $user_another = $this->user->create_user($this->url, $this->user_email2);
     $this->unit->run_false($user1->get_id(), $user_another->get_id(), '建立user_another,看看是否是不同人');
     //find user2,用name跟password來找
     $user2 = $this->user->find_user($this->url, $this->user_email, $this->password);
     //檢查user2的name
     $this->unit->run($user2->get_name(), $this->user_name, 'find user2,用name跟password來找 檢查user2的name');
     //用錯誤的密碼去找找看
     $user21 = $this->user->find_user($this->url, $this->user_name, 'error_password');
     $this->unit->run($user21, NULL, '用錯誤的密碼去找找看');
     //用email建立user3
     $user3 = $this->user->create_user($this->url, $this->user_email);
     $deleted[] = $user3->get_id();
     //檢查user3的name
     $this->unit->run($user3->get_name(), 'puddingchen.35', '用email建立user3 檢查user3的name');
     //測試search吧
     $users = $this->user->search($this->url, $this->keyword);
     $this->unit->run(count($users) > 0, TRUE, '測試Search,應該要找到東西才是');
     $this->unit->run($users[0]->get_name(), $this->user_name, '測試Search,看第一個是不是剛剛建立的');
     $users = $this->user->search($this->url, $this->not_keyword);
     $this->unit->run(count($users), 0, '測試錯誤的Search,應該找不到東西才是');
     //刪除user1
     $user1_id = $user1->get_id();
     $user1->delete();
     //檢查user1的name
     $this->unit->run($user1->get_name(), NULL, '刪除user1 檢查user1的name');
     $this->db->where('user_id', $user1_id);
     $this->db->where('deleted', 'FALSE');
     $count = $this->db->count_all_results('user');
     $this->unit->run($count, 0, '用資料庫來測試看看');
     //恢復user1
     $user1 = new User($user1_id);
     $user1->restore();
     $this->unit->run($user1->get_name(), $this->user_name, '恢復user1 檢查user1的name');
     $this->db->where('user_id', $user1_id);
     $this->db->where('deleted', 'FALSE');
     $count = $this->db->count_all_results('user');
     $this->unit->run($count, 1, '恢復user1, 用資料庫來測試看看');
     $user1->delete();
     //用user2去find看看
     $user2 = $this->user->find_user($this->url, $this->user_name);
     $this->unit->run($user2, NULL, '刪除user1 用user2去find看看');
     //刪除user3
     $user3->delete();
     //檢查user3的email
     $this->unit->run($user3->get_email(), NULL, '刪除user3 檢查user3的email');
     $user1 = $this->user->create_user($this->url, $this->user_email);
     $count1 = $this->db->where('deleted', 'TRUE')->count_all_results('user');
     $this->unit->run($count1, 1, '刪除之後,資料是否還在?');
     $count2 = $this->db->where('deleted', 'FALSE')->count_all_results('user');
     $this->unit->run($count1, 1, '刪除之後又新增,是否有新增的資料?');
     $count3 = $this->db->count_all_results('user');
     $this->unit->run($count1 + $count2, $count3, '刪除與新增的資料相加,是否等於全部資料表的筆數?');
     //        $this->unit->run($test_result,
     //                $expected_result,
     //                $test_name);
     //        $this->load->database();
     //        $domain_count = $this->db->count_all_results('domain', array('host'=> 'http://www.plurk.com/'));
     //        $this->unit->run($domain_count < 2
     //                , TRUE
     //                , '確認沒有多餘的Domain');
     //
     //        //單元測試之後不留下垃圾!
     //        foreach ($deleted AS $d)
     //        {
     //            $this->db->delete(array('domain2user', 'user'), array('user_id'=> $d));
     //        }
     unit_test_report($this);
 }
     $p_picture = '';
 }
 if ($p_terms < 1) {
     $success = false;
     array_push($errors, "You should agree with the Terms and Conditions.");
 }
 if ($success) {
     $ipaddr = $_SERVER['REMOTE_ADDR'];
     if (UserBanned::exists(0, array(), "(email='{$p_email}' OR ipaddr='{$ipaddr}')")) {
         $last = 666666;
     } else {
         $postedon = date("Y-m-d H:i:s", time());
         $expiry = date("Y-m-d", time() + $p_expiry * 24 * 60 * 60);
         $code = md5(uniqid(rand(), true));
         if (User::is_logged_in()) {
             $p_name = User::get_name();
             $p_email = User::get_email();
         }
         $last = Ad::create(array('user_id' => User::get_id(), 'name' => $p_name, 'email' => $p_email, 'telephone' => $p_telephone, 'title' => $p_title, 'description' => $p_description, 'picture' => $p_picture, 'category' => $p_category, 'price' => $p_price, 'city' => $p_city, 'region' => $p_region, 'expiry' => $expiry, 'webpage' => $p_webpage, 'code' => $code, 'ipaddr' => $ipaddr, 'postedon' => $postedon, 'lastmodified' => $postedon));
         if (User::is_logged_in()) {
             Ad::activate($last);
         } else {
             if (!($user_exists = User::exists(0, array('email' => $p_email)))) {
                 $p_em = explode('@', $p_email);
                 $username = substr($p_em[0], 0, 6);
                 $active = 0;
                 $createdon = date("Y-m-d H:i:s", time());
                 $password = substr($code, 0, 6);
                 $userid = User::create(array('email' => $p_email, 'username' => $username, 'password' => $password, 'name' => $p_name, 'active' => $active, 'createdon' => $createdon, 'ipaddr' => $ipaddr, 'code' => $code));
                 $registration_message = StaticContent::get_content('user-registration-email');
                 eval("\$registration_message = \"{$registration_message}\";");
    mysqli_query($con, "update user
                            set id = '".$user->get_id()."',
                            screen_name = '".$user->get_screen_name()."',
                            name = '".$user->get_name()."',
                            profile_image_url = '".$user->get_profile_image_url()."',
                            profile_background_image_url = '".$user->get_profile_background_image_url()."',
                            profile_sidebar_fill_color = '".$user->get_profile_sidebar_fill_color()."',
                            profile_background_color = '".$user->get_profile_background_color()."',
                            profile_link_color = '".$user->get_profile_link_color()."'
                        where id = '".$user->get_id()."'");
} else {
    $user = new User($connection->get("users/show",array("screen_name"=>$screen_name,"includes_entities"=>false)));
    mysqli_query($con, "insert into user values (
                            '".$user->get_id()."',
                            '".$user->get_screen_name()."',
                            '".$user->get_name()."',
                            '".$user->get_profile_image_url()."',
                            '".$user->get_profile_background_image_url()."',
                            '".$user->get_profile_sidebar_fill_color()."',
                            '".$user->get_profile_background_color()."',
                            '".$user->get_profile_link_color()."')");
}

$tweets = $connection->get("statuses/user_timeline",array("screen_name"=>$screen_name,"count"=>10,"exclude_replies"=>true));

mysqli_query($con, "delete from tweet where user_id='' or user_id = '".$user->get_id()."'");

if(count($tweets)!=0 && is_array($tweets)) {
	foreach ($tweets as $tweet) {
	    $user->set_tweets(new Tweet($tweet->id_str, $tweet->text, $tweet->user->screen_name, $tweet->user->profile_image_url, $tweet->created_at));
	    mysqli_query($con, "insert into tweet values (
Example #10
0
	 h1{
	 font-family:'Georgia', Times New Roman, Times, serif;
	 }
div#im{
 float:left;
}

div#sub {
float:left;
}
	--></style> 
	<div id="container">
	<div id="header"><a href="index.php?q=logout">LOGOUT</a></div>
	<div id="main-body">
	<?php 
$user->get_name($uid);
?>

         <div id="im">
        <?php 
echo "<img src='{$uri}'  style='width:90px'/>" . " ";
?>
        <input type="file" name="img"  title="<?php 
echo $uri;
?>
">  </div>

        <div id="sub">
       <input type="submit" name="sub" value="Store" /> <br>
       User ID:   <input type="text" name="name" value="<?php 
echo $uid;
Example #11
0
if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) {
    header('Location: clearsession.php');
}
/* Get user access tokens out of the session. */
$access_token = $_SESSION['access_token'];
/* Create a TwitterOauth object with consumer/user tokens. */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
/* If method is set change API call made. Test is called by default. */
$user = new User($connection->get('account/verify_credentials'));
$con = mysqli_connect($host, $username, $password, $dbName);
if (mysqli_connect_errno($con)) {
    header('Location: DBError.html');
}
$rs = mysqli_query($con, "select id from user where id='" . $user->get_id() . "'");
if ($rs = mysqli_fetch_array($rs)) {
    mysqli_query($con, "update user\r\n                            set id = '" . $user->get_id() . "',\r\n                            screen_name = '" . $user->get_screen_name() . "',\r\n                            name = '" . $user->get_name() . "',\r\n                            profile_image_url = '" . $user->get_profile_image_url() . "',\r\n                            profile_background_image_url = '" . $user->get_profile_background_image_url() . "',\r\n                            profile_sidebar_fill_color = '" . $user->get_profile_sidebar_fill_color() . "',\r\n                            profile_background_color = '" . $user->get_profile_background_color() . "',\r\n                            profile_link_color = '" . $user->get_profile_link_color() . "'\r\n                        where id = '" . $user->get_id() . "'");
} else {
    mysqli_query($con, "insert into user values (\r\n                            '" . $user->get_id() . "',\r\n                            '" . $user->get_screen_name() . "',\r\n                            '" . $user->get_name() . "',\r\n                            '" . $user->get_profile_image_url() . "',\r\n                            '" . $user->get_profile_background_image_url() . "',\r\n                            '" . $user->get_profile_sidebar_fill_color() . "',\r\n                            '" . $user->get_profile_background_color() . "',\r\n                            '" . $user->get_profile_link_color() . "')");
}
mysqli_close($con);
$_SESSION['user'] = $user->get_id();
?>
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        case 'RecentPostModule':
            if (@$collection->type == GROUP_COLLECTION_TYPE) {
                $obj->type = 'group';
                $obj->gid = $collection->collection_id;
            } else {
                $obj->mode = PUB;
                $obj->type = 'permalink';
            }
            break;
        case 'ImagesModule':
            $obj->page = $media_gallery;
            $obj->group_details = $group_details;
            break;
    }
}
$page = new PageRenderer("setup_module", PAGE_PERMALINK, sprintf("%s - %s - %s", strip_tags($content->title), $author->get_name(), PA::$network_info->name), "container_three_column.tpl", $header, PUB, HOMEPAGE, PA::$network_info, '', $setting_data);
uihelper_error_msg($error_message);
$page->html_body_attributes = 'class="no_second_tier"';
if (!$is_group_content) {
    uihelper_set_user_heading($page, TRUE, $content->author_id);
} else {
    uihelper_get_group_style((int) $gid);
}
$page->add_header_html(js_includes('common.js'));
// To Do need to remove inline styling
$inline_style = '.no_second_tier #bg_blog_post { margin-top: 3px; }';
$append_css = "<style>" . $inline_style . "</style>";
$page->add_header_html($append_css);
$page->add_header_html(js_includes('rating.js'));
// for calendar sidebar Module
$css_path = PA::$theme_url . '/calendar.css';
Example #13
0
        $mochilas -= $ui->get_available_today('mochila');
        $audifonos -= $ui->get_available_today('audifonos');
        $items = array(2, 2, 2, 3, 3, 3, 4, 4);
        if ($mochilas > 0) {
            array_push($items, 6);
            array_push($items, 6);
        }
        if ($audifonos > 0) {
            array_push($items, 7);
        }
        shuffle($items);
        $selected = rand(0, count($items) - 1);
        $iselected = $items[$selected];
        $ui->assign_to($id, $iselected);
        $data = $item->get_data($iselected);
        $data->user = $user->get_name($id);
        response($data);
        break;
}
function response($data)
{
    $result = array('code' => 200, 'data' => $data, 'error' => null);
    echo json_encode($result);
    exit;
}
function fail($error)
{
    $result = array('code' => 500, 'data' => null, 'error' => $error);
    echo json_encode($result);
    exit;
}
Example #14
0
*/
include_once 'lib/User.class.php';
/**
* Template class
*/
include_once 'lib/Template.class.php';
/**
* UserInfoDB class
*/
include_once 'lib/db/UserInfoDB.class.php';
/**
* Templates for output
*/
include_once 'templates/userinfo.template.php';
$user = new User($_GET['user']);
$t = new Template(translate('User Info') . ' ' . $user->get_name());
$t->printHTMLHeader();
// Print HTML header
// Make sure this is the admin
if (!Auth::isAdmin()) {
    CmnFns::do_error_box(translate('This is only accessable to the administrator') . '<br />' . '<a href="ctrlpnl.php">' . translate('Back to My Control Panel') . '</a>');
}
if (!$user->is_valid()) {
    // Make sure member ID is valid
    CmnFns::do_error_box(translate('Memberid is not available.', array($user->get_id())));
}
$db = new UserInfoDB();
$prev = $db->get_prev_userid($user);
// Prev memberid
$next = $db->get_next_userid($user);
// Next memberid
Example #15
0
            if (!count($data_profile)) {
                return 'skip';
            }
            if ($data_profile[0]->field_value == BLOG_SETTING_STATUS_NODISPLAY || $data_profile[0]->field_value == PERSONAL_BLOG_SETTING_STATUS) {
                return 'skip';
            }
            $obj->profile_feeds = $current_feed_data;
            $obj->feed_id = empty($profile_files) ? NULL : $profile_feeds[0]['feed_id'];
            break;
        case 'ActivitiesModule':
            $obj->page_type = 'user_personal';
            break;
    }
    $obj->mode = PRI;
}
$page_title = sprintf(__('%s - My Page - %s'), $login_user->get_name(), $network_info->name);
$page = new PageRenderer("setup_module", PAGE_USER_PRIVATE, $page_title, "container_three_column.tpl", "header_user.tpl", PRI, HOMEPAGE, $network_info, $onload, $setting_data);
if ($error == TRUE || $save_error == TRUE || !empty($_GET['msg_id'])) {
    $msg = !empty($_GET['msg_id']) ? $_GET['msg_id'] : $msg;
    uihelper_error_msg($msg);
}
$page->add_header_html($parameter);
$css_path = $current_theme_path . '/calendar.css';
$page->add_header_css($css_path);
$page->add_header_html(js_includes('calendar.js'));
$css_path = $current_theme_path . '/user_skin.css';
$page->add_header_css($css_path);
$rss_data = '<link rel="alternate" type="application/rss+xml" title="RSS feed" href="' . $base_url . '/feed.php?uid=' . $uid . '" />';
$page->add_header_html($rss_data);
uihelper_set_user_heading($page);
echo $page->render();
 /**
  * get html for action bar
  * @param $list_title string title of list
  * @param $action string highlight given action in the action bar (highlight none when action is empty)
  * @param $result Result result object
  * @return string returned html
  */
 function get_action_bar($list_title, $action)
 {
     global $mobile;
     $this->_log->trace("get action bar (list_title=" . $list_title . ", action=" . $action . ")");
     $html_str = "";
     $html_str .= "\n            <div class=\"corner top_left_normal\"></div>\n";
     $html_str .= "            <div class=\"corner top_right_normal\"></div>\n";
     $html_str .= "            <div id=\"action_bar\" align=\"left\" valign=\"top\">\n";
     $html_str .= "                ";
     # set a different title when this is the user settings page
     if ($this->configuration[HTML_TABLE_PAGE_TYPE] == PAGE_TYPE_USER_SETTINGS) {
         $html_str .= "<strong>" . $this->configuration[HTML_TABLE_RECORD_NAME] . " " . $this->_user->get_name() . "</strong>";
     } else {
         if ($this->configuration[HTML_TABLE_PAGE_TYPE] != PAGE_TYPE_PORTAL) {
             if ($action == "edit") {
                 $html_str .= "<strong>" . translate("LABEL_EDIT_RECORD") . $this->configuration[HTML_TABLE_RECORD_NAME] . "</strong>";
             } else {
                 if ($action == "insert") {
                     $html_str .= "<strong>" . translate("LABEL_ADD_RECORD") . $this->configuration[HTML_TABLE_RECORD_NAME] . "</strong>";
                 } else {
                     if ($action == "import") {
                         $html_str .= "<strong>" . translate("LABEL_IMPORT_RECORDS") . "</strong>";
                     } else {
                         if ($this->configuration[HTML_TABLE_PAGE_TYPE] != PAGE_TYPE_USERLISTTABLEPERMISSIONS) {
                             $html_str .= "<span id=\"action_bar_button_insert\">";
                             # use different function name when page type is list or user admin because we use more types of permissions
                             if ($this->configuration[HTML_TABLE_PAGE_TYPE] == PAGE_TYPE_LIST || $this->configuration[HTML_TABLE_PAGE_TYPE] == PAGE_TYPE_USER_ADMIN) {
                                 $html_str .= get_href(get_onclick("action_get_insert_" . $this->configuration[HTML_TABLE_JS_NAME_PREFIX] . "record", $this->permissions_list_title, "action_bar_button_insert", "above", "(%27" . $list_title . "%27, %27%27)"), translate("BUTTON_ADD_RECORD") . $this->configuration[HTML_TABLE_RECORD_NAME], "icon_add");
                             } else {
                                 $html_str .= get_href(get_onclick("action_get_" . $this->configuration[HTML_TABLE_JS_NAME_PREFIX] . "record", $this->permissions_list_title, "action_bar_button_insert", "above", "(%27" . $list_title . "%27, %27%27)"), translate("BUTTON_ADD_RECORD") . $this->configuration[HTML_TABLE_RECORD_NAME], "icon_add");
                             }
                             $html_str .= "</span>&nbsp;&nbsp;&nbsp;&nbsp;";
                         }
                     }
                 }
             }
         }
     }
     # only display the import and print buttons when no action is active and only when this is a list page
     if ($action == "" && $this->configuration[HTML_TABLE_PAGE_TYPE] == PAGE_TYPE_LIST) {
         # show the print button
         $html_str .= "<span id=\"action_bar_button_print\">";
         $html_str .= get_href(get_onclick(ACTION_GET_LIST_PRINT_PAGE, $this->permissions_list_title, "", "", "window.open(%27index.php?action=" . ACTION_GET_LIST_PRINT_PAGE . "&list=" . $list_title . "%27)"), translate("BUTTON_PRINT_LIST"), "icon_print");
         $html_str .= "</span>&nbsp;&nbsp;&nbsp;&nbsp;";
         # show the import button
         $html_str .= "<span id=\"action_bar_button_import\">";
         $html_str .= get_href(get_onclick(ACTION_GET_LIST_IMPORT, $this->permissions_list_title, "action_bar_button_import", "above", "(%27" . $list_title . "%27)"), translate("BUTTON_IMPORT_RECORDS"), "icon_unarchive");
         $html_str .= "</span>&nbsp;&nbsp;&nbsp;&nbsp;";
         # show the export button
         $html_str .= "<span id=\"action_bar_button_export\">";
         $html_str .= get_href(get_onclick_confirm(ACTION_EXPORT_LIST_RECORDS, $this->permissions_list_title, "action_bar_button_export", "above", "handleFunction(%22" . ACTION_EXPORT_LIST_RECORDS . "%22, %22" . $list_title . "%22)", translate("LABEL_EXPORT_CONFIRM")), translate("BUTTON_EXPORT_RECORDS"), "icon_archive");
         $html_str .= "</span>";
     } else {
         $html_str .= "&nbsp;";
     }
     $html_str .= "\n            </div> <!-- action_bar -->\n";
     if ($action == "") {
         $html_str .= "            <div class=\"corner bottom_left_normal\"></div>\n";
         $html_str .= "            <div class=\"corner bottom_right_normal\"></div>\n";
     }
     $this->_log->trace("got action bar");
     return $html_str;
 }
Example #17
0
        <link rel="stylesheet" href="css/main.css">
    </head>
    <body>
        <!--[if lt IE 7]>
        <p class="chromeframe">You are using an <strong>outdated</strong> browser.
        Please <a href="http://browsehappy.com/">upgrade your browser</a> or
        <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
        <![endif]-->
 
        <div class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container">
                    <a href="home.php" class="brand">TweetUdit</a>
                    <ul class="nav">
                        <li class="divider-vertical"></li>
                        <li id="liName" class="navbar-text"><?php echo $user->get_name();?></li>
                        <li id="liScreenName" class="navbar-text">&nbsp;<strong><em><a href="home.php">(@<?php echo $user->get_screen_name();?>)</a></em></strong></li>
                    </ul>
                    <div class="nav dropdown  pull-right">
                        <a class="navbar-text dropdown-toggle" id="dLabel" role="button" data-toggle="dropdown" href="#">
                            <i class="icon-wrench"></i><span>User Actions</span>
                        </a>
                        <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
                            <li><a tabindex="-1" href="manageFav.php"><i class="icon-star"></i> Manage Favorites</a></li>
                            <li><a tabindex="-1" href="clearsession.php"><i class="icon-remove-circle"></i> Logout</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
echo User::get_email();
?>
" />
					<br />
				</div>
				<div class="input-block">
					<label for='username'>Username</label>
					<input name='username' type='text' disabled='disabled'  value="<?php 
echo User::get_username();
?>
" />
				</div>
				<div class="input-block">
					<label for='name'>Name</label>
					<input name='name' type='text' value="<?php 
echo isset($p_name) ? $p_name : User::get_name();
?>
" />
				</div>
			</div>
			
			<br />
			
			<div class="fleft">					
				<div class="input-block">							
					<label for='telephone'>Telephone</label>
					<input name='telephone' type='text' value="<?php 
echo isset($p_telephone) ? $p_telephone : User::get_prop('telephone');
?>
" />
				</div>
Example #19
0
      */
     $group_name = Helpers::require_variable('group', 'a group name');
     $target_user_name = Helpers::require_variable('user', 'a user to remove');
     $user_name = Helpers::require_variable('auth_u', 'a username');
     $user_pass = Helpers::require_variable('auth_p', 'user authentication');
     try {
         // Authenticate user making request
         $admin_user = new User(array("name" => $user_name, "pass" => $user_pass));
         if (!$admin_user->authenticate()) {
             throw new Exception("Authentication failed.");
         }
         $user = new User(array("name" => $target_user_name, "admin" => true));
         // Verify user exists
         $user->read();
         if (!$user->is_authenticated()) {
             throw new Exception($user->get_name() . " is not a valid user.");
         }
         $group = new Group(array("name" => $group_name));
         // Assert group's existence
         $group->read();
         if (!$group->is_admin($admin_user)) {
             throw new Exception("You must be an admin to remove members.");
         }
         $group->remove_reader($user);
         $attempt = new Attempt('success', 'Removed member ' . $user->get_name() . ' from ' . $group->get_name() . '.');
     } catch (Exception $e) {
         $attempt = new Attempt('error', $e->getMessage());
     }
     // END of remove_reader
 } else {
     if ($action == "leave_group") {
Example #20
0
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: user, password');
//use files
require_once 'classes/user.php';
require_once 'classes/generatetoken.php';
//read headers
$headers = getallheaders();
//check if headers were received
if (isset($headers['user']) & isset($headers['password'])) {
    try {
        //create object
        $u = new User($headers['user'], $headers['password']);
        //display json
        echo '{ "status" : 0,
							"user" : "' . $u->get_id() . '",
							"name" : "' . $u->get_name() . '",
							"token" : "' . generate_token($u->get_id()) . '"
						}';
    } catch (RecordNotFoundException $ex) {
        echo '{ "status" : 1, "errorMessage" : "' . $ex->get_message() . '" }';
    }
} else {
    echo '{ "status" : 2, "errorMessage" : "Invalid Headers" }';
}
?>





<div class="form-panel">

	<fieldset>
		
		<legend>Post an Ad</legend>
		
		<form name="form_ad_placement" id="form_ad_placement" method="post" enctype='multipart/form-data' accept-charset="utf-8">
				
			<div class="fleft">

				<div class="input-block">
					<label for='name' class="required">Name</label>
					<input name='name' type='text' value='<?if(isset($p_name)) print $p_name; else if(User::is_logged_in()) print User::get_name()?>' <?if(User::is_logged_in()):?>readonly='readonly'<?endif?> />
				</div>
				
				<div class="input-block">
					<label for='email' class="required">Email</label>
					<input name='email' type='text' value='<?if(isset($p_email)) print $p_email; else if(User::is_logged_in()) print User::get_email()?>' <?if(User::is_logged_in()):?>readonly='readonly'<?endif?> />
				</div>

				<div class="input-block">
					<label for='telephone'>Telephone</label>
					<input name='telephone' type='text' value='<?if(isset($p_telephone)) print $p_telephone; else if(User::is_logged_in()) print User::get_prop('telephone')?>' />
				</div>
									
			</div>				

			<br />

			<div class="fleft">
				
Example #22
0
 public function is_reader(User $user)
 {
     $security_doc = $this->get_security_doc();
     return in_array($user->get_name(), $security_doc['members']['names']);
 }
Example #23
0
/**
* Send a notification email that the password has been reset
* @param string $memberid id of member
* @param string $password new password for user
*/
function send_pwdreset_email($memberid, $password)
{
    global $conf;
    $adminemail = $conf['app']['adminEmail'];
    $appTitle = $conf['app']['title'];
    $user = new User($memberid);
    $subject = $appTitle . ' ' . translate('Password Reset');
    $msg = $user->get_fname() . ",\r\n" . translate_email('password_reset', $appTitle, $password, $appTitle, CmnFns::getScriptURL(), $adminemail);
    $mailer = new PHPMailer();
    $mailer->AddAddress($user->get_email(), $user->get_name());
    $mailer->From = $adminemail;
    $mailer->FromName = $conf['app']['title'];
    $mailer->Subject = $subject;
    $mailer->Body = $msg;
    $mailer->Send();
}
Example #24
0
            background-color: #' . $user->get_profile_background_color() . ';
        }
        footer {
            background-color: #fefefe;
            margin-left: 20px;
            margin-right: 20px;
        }
        hr {
            margin-top: 10px;
            margin-bottom: 5px;
        }
    </style>
    <body>
        <div class="tweet-box">
            <h4 class="navbar-text">TweetUdit</h4>
            <span id="liName" class="navbar-text">' . $user->get_name() . '</span>
            <span id="liScreenName" class="navbar-text">&nbsp;<strong><em>(@' . $user->get_screen_name() . ')</em></strong></span>
            <img class="img-polaroid" src="' . $user->get_profile_image_url() . '">
        </div>

        <div class="clearfix">&nbsp;</div>
        <div class="clearfix">&nbsp;</div>
        <div class="clearfix">&nbsp;</div>

        <div class="container">
            <div class="container-fluid row">
                <div id="wall" class="container-fluid">
                    <h4 class="offset tweet-box">My Home Timeline</h4>';
foreach ($user->get_tweets_object() as $tweet) {
    $html = $html . '
                    <div class="container-fluid tweet-box item">
Example #25
0
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
session_start();
require_once ('../User.php');
require_once ('../DBConfig.php');

if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) {
    header('Location: ../clearsession.php');
}

$id = $_SESSION['user'];

$con = mysqli_connect($host,$username,$password,$dbName);
if(mysqli_connect_errno($con)) {
    header('Location: ../DBError.html');
}

$rs = mysqli_query($con,"select * from user where id='".$id."'");

if($rs =  mysqli_fetch_array($rs)) {
    $user = new User($rs);
} else {
    header('Location: ../DBError.html');
}
mysqli_close($con);

echo json_encode(array("name"=>$user->get_name()));