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();
     }
 }
 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);
 }
 function safe_updates()
 {
     global $network_info;
     PA::$network_info = $network_info = Network::get_mothership_info();
     PA::$extra = unserialize(PA::$network_info->extra);
     $this->create_announce_tables();
     $this->add_all_users_to_mother_network();
     // run project specific updates and init settings
     if (!empty(PA::$config->project_safe_updates)) {
         // see if the settings file exists
         $file_path = PA::$core_dir . "/web/extra/" . PA::$config->project_safe_updates . "_safe_updates.php";
         if (file_exists($file_path)) {
             include $file_path;
         }
     }
 }
 function __construct()
 {
     parent::__construct();
     $this->title = "Join " . PA::$site_name;
     $this->html_block_id = "RegisterModule";
     $this->states = array("-2" => '-Select-', "-1" => 'Other');
     $this->states = $this->states + array_values(PA::getStatesList());
     $this->countries = array("-1" => '-Select-');
     $this->countries = $this->countries + array_values(PA::getCountryList());
     /*    
         $this->states    = array_values(PA::getStatesList());
         $this->countries = array_values(PA::getCountryList());
         
         array_unshift($this->states, 'Other');
         array_unshift($this->states, '-Select-');
         array_unshift($this->countries, '-Select-');
     */
 }
function pageLoadGroup($group)
{
    $access = $group->access_type;
    $skip_group_modules = FALSE;
    $is_admin = FALSE;
    if ($group->access_type == $group->ACCESS_PRIVATE) {
        if (PA::$login_uid) {
            //if private group
            if (GROUP::member_exists($group->collection_id, PA::$login_uid)) {
                $skip_group_modules = FALSE;
            } else {
                // haha no way for non member of group
                $skip_group_modules = TRUE;
            }
        } else {
            //haha no way for anonymous user
            $skip_group_modules = TRUE;
        }
        $access_type = 'Private';
    } else {
        $access_type = 'Public';
    }
    if ($group->reg_type == $group->REG_OPEN) {
        $access_type .= ' Open';
    } else {
        $access_type .= ' Moderated';
    }
    if (Group::is_admin((int) $group->collection_id, (int) PA::$login_uid)) {
        $is_admin = TRUE;
    }
    $members = $group->get_members($cnt = FALSE, 5, 1, 'created', 'DESC', FALSE);
    $group_details = array();
    $group_details['collection_id'] = $group->collection_id;
    $group_details['type'] = $group->type;
    $group_details['author_id'] = $group->author_id;
    $user = new User();
    $user->load((int) $group->author_id);
    $login_name = $user->login_name;
    $first_name = $user->first_name;
    $last_name = $user->last_name;
    $group_details['author_name'] = $login_name;
    $group_details['author_picture'] = $user->picture;
    $group_details['title'] = $group->title;
    $group_details['description'] = $group->description;
    $group_details['is_active'] = $group->is_active;
    $group_details['picture'] = $group->picture;
    $group_details['desktop_picture'] = @$group->desktop_picture;
    $group_details['created'] = PA::datetime($group->created, 'long', 'short');
    // date("F d, Y h:i A", $group->created);
    $group_details['changed'] = $group->changed;
    $group_details['category_id'] = $group->category_id;
    $cat_obj = new Category();
    $cat_obj->set_category_id($group->category_id);
    $cat_obj->load();
    $cat_name = stripslashes($cat_obj->name);
    $cat_description = stripslashes($cat_obj->description);
    $group_details['category_name'] = $cat_name;
    $group_details['category_description'] = $cat_description;
    $group_details['members'] = Group::get_member_count($group->collection_id);
    $group_details['access_type'] = $access_type;
    $group_details['is_admin'] = $is_admin;
    //////////////////get details of group EOF
    if (is_array($members)) {
        $count = count($members);
        foreach ($members as $member) {
            $count_relations = Relation::get_relations($member['user_id'], APPROVED, PA::$network_info->network_id);
            $user = new User();
            $user->load((int) $member['user_id']);
            $login_name = $user->login_name;
            $user_picture = $user->picture;
            $users_data[] = array('user_id' => $member['user_id'], 'picture' => $user_picture, 'login_name' => $login_name, 'no_of_relations' => count($count_relations));
        }
        $final_array = array('users_data' => $users_data, 'total_users' => $count);
    }
    $users = $final_array;
    $is_member = Group::member_exists((int) $group->collection_id, (int) PA::$login_uid) ? TRUE : FALSE;
    $group_details['is_member'] = $is_member;
    $group_details['skip_group_modules'] = $skip_group_modules;
    $group_details['users'] = $users;
    return $group_details;
}
*/
?>
<h2><?= __("Event") ?>: <? echo _out($ed['event_title']); ?></h2>
      <div class="field_event" style="height:90px;">
        <b><?=__("Event Banner")?></b><br />
<?php if (!empty($ed['banner'])) { ?>
          <?php echo uihelper_resize_mk_img($ed['banner'], 430, 80,
          NULL, 'alt="Current Event Banner"', RESIZE_FIT); ?>
<? } ?>
      </div>
    <div class="field_event">
    <b><?= __("Starts") ?></b>:
    <?=PA::datetime($ed['start_time'])?>
    </div>
    <div class="field_event">
    <b><?= __("Ends") ?></b>: <?=PA::datetime($ed['end_time'])?>
    </div>

    
    <div class="field_event">
    <b><?= __("Venue") ?>:</b>:<br />
    <? echo _out($ed['event_venue']); ?>
    </div>
    <div class="field_event">
    <b><?= __("Description") ?>:</b>:<br />
    <? echo _out($ed['event_description']); ?>
    </div>
<? if ($may_edit) { ?>
<div class="button_position">

    <input type="submit" name="edit" value="<?= __("Edit") ?>">
 function register($params, $network_info = NULL)
 {
     $core_id = null;
     $picture = null;
     $picture_dimensions = null;
     $avatar = null;
     $avatar_dimensions = null;
     $avatar_small = null;
     $avatar_small_dimensions = null;
     $this->newuser = new User();
     // set API call variable
     $this->newuser->api_call = $this->api_call;
     // filter input parameters (this is the same as filter_all_post())
     $params = Validation::get_input_filter(FALSE)->process($params);
     $this->error = false;
     $mother_network_info = Network::get_mothership_info();
     $mother_extra = unserialize($mother_network_info->extra);
     if (@$mother_extra['captcha_required'] == NET_YES) {
         // added by Z.Hron - if captcha is required
         //Providing the capcha check
         if (md5(strtoupper($_POST['txtNumber'])) != $_SESSION['image_random_value']) {
             $_SESSION['image_is_logged_in'] = true;
             $_SESSION['image_random_value'] = '';
             $error_login = true;
             $this->error = true;
             $this->msg .= "\nPlease enter correct code";
         }
     }
     if (!$this->error) {
         $login_name = trim($params['login_name']);
         $first_name = trim($params['first_name']);
         $last_name = trim(@$params['last_name']);
         // not mandatory
         $email = trim($params['email']);
         $password = trim($params['password']);
         $confirm_password = trim($params['confirm_password']);
         if ($this->api_call == true) {
             $core_id = $params['core_id'];
             // TODO: validate URL
             $picture = trim($params['profile_picture_url']);
             $picture_dimensions = $params['profile_picture_dimensions'];
             $avatar = trim($params['profile_avatar_url']);
             $avatar_dimensions = $params['profile_avatar_dimensions'];
             $avatar_small = trim($params['profile_avatar_small_url']);
             $avatar_small_dimensions = $params['profile_avatar_small_dimensions'];
         }
         $date_created = !empty($params['date_created']) ? $params['date_created'] : null;
         $_years = PA::getYearsList();
         $dob_day = !empty($params['dob_day']) ? trim($params['dob_day']) : null;
         // General data (why? should be personal)
         $dob_month = !empty($params['dob_month']) ? trim($params['dob_month']) : null;
         // General data (why? should be personal)
         $dob_year = !empty($params['dob_year']) ? $_years[(int) trim($params['dob_year'])] : null;
         // General data (why? should be personal)
         $homeAddress1 = !empty($params['homeAddress1']) ? trim($params['homeAddress1']) : null;
         // General data
         $homeAddress2 = !empty($params['homeAddress2']) ? trim($params['homeAddress2']) : null;
         // General data
         $city = !empty($params['city']) ? trim($params['city']) : null;
         // General data
         $state = null;
         if ($params['state'] == -1) {
             // State/Province: Other selected
             $state = !empty($params['stateOther']) ? trim($params['stateOther']) : null;
             // General data
         } else {
             if ($params['state'] > 0) {
                 // one of US States selected
                 $state = !empty($params['state']) ? $this->states[(int) $params['state']] : null;
                 // General data
             }
         }
         $country = $params['country'] > 0 ? $this->countries[(int) $params['country']] : null;
         // General data
         $postal_code = !empty($params['postal_code']) ? trim($params['postal_code']) : null;
         // General data
         $phone = !empty($params['phone']) ? trim($params['phone']) : null;
         // General data
         $validate_array = array('login_name' => 'Login name', 'first_name' => 'First name', 'password' => 'Password', 'confirm_password' => 'Confirm password', 'email' => 'Email');
         $this->msg = '';
         $this->error = FALSE;
         foreach ($validate_array as $key => $value) {
             if (empty($params[$key])) {
                 $this->msg .= "\n" . $value . " is mandatory";
                 $this->error = TRUE;
                 header(HttpStatusCodes::httpHeaderFor(HttpStatusCodes::HTTP_PRECONDITION_FAILED));
             }
         }
         if (strlen($this->msg) > 0) {
             $this->msg = "\n" . "Fields marked with * must not be left empty" . $this->msg;
         }
     }
     //$error_login = FALSE;
     if (!$this->error) {
         if (empty($login_name)) {
             $error_login = TRUE;
             $this->error = TRUE;
         }
         if (is_numeric($login_name)) {
             // Here we check the login name  is numeric or not
             if (strlen($this->msg) > 0) {
                 $this->msg .= "\n";
             }
             $this->msg .= "Login name must not be numeric";
             $error_login = TRUE;
             $this->error = TRUE;
         }
         if (is_numeric($first_name)) {
             // Here we check the first  name  is numeric or not
             if (strlen($this->msg) > 0) {
                 $this->msg .= "\n";
             }
             $this->msg .= "First name must not be numeric";
             $error_login = TRUE;
             $this->error = TRUE;
         }
         if (is_numeric($last_name)) {
             // Here we check the last name  is numeric or not
             if (strlen($this->msg) > 0) {
                 $this->msg .= "\n";
             }
             $this->msg .= "Last name must not be numeric";
             $error_login = TRUE;
             $this->error = TRUE;
         }
         if ($this->error == TRUE) {
             header(HttpStatusCodes::httpHeaderFor(HttpStatusCodes::HTTP_PRECONDITION_FAILED));
         }
     }
     // if error occur than no need to check these errors
     if (!$this->error) {
         if (!Validation::validate_email($email)) {
             $email_invalid = TRUE;
             $this->array_of_errors['error_email'] = $email_invalid;
             $this->error = TRUE;
             $this->msg .= __('E-mail address is not valid.');
             header(HttpStatusCodes::httpHeaderFor(HttpStatusCodes::HTTP_PRECONDITION_FAILED));
         }
         // Calculating Allowed Domains
         if (file_exists(PA::$project_dir . "/config/domain_names.txt")) {
             $domain_names_file = PA::$project_dir . "/config/domain_names.txt";
         } elseif (file_exists(PA::$core_dir . "/config/domain_names.txt")) {
             $domain_names_file = PA::$core_dir . "/config/domain_names.txt";
         } else {
             throw new Exception("Allowed Domains configuration file \"/config/domain_names.txt\" not found");
         }
         $allowed_domains = preg_split("/\\s+/", file_get_contents($domain_names_file));
         // Calcutating user domain
         $user_email = explode('@', $email);
         $user_domain = strtolower($user_email[1]);
         $found = 0;
         foreach ($allowed_domains as $i => $d) {
             if (!preg_match('/\\W/', $d)) {
                 continue;
             }
             // make proper regex
             $rx = preg_replace('/\\*/', '[^\\.]*', $d);
             if (preg_match("/{$rx}/", $user_domain)) {
                 $found++;
             }
         }
         if (!$found) {
             // show error
             $email_invalid = TRUE;
             $this->array_of_errors['error_email'] = $email_invalid;
             $this->error = TRUE;
             $this->msg .= __('The domain of your E-mail address is not in the list of allowed domains.');
             header(HttpStatusCodes::httpHeaderFor(HttpStatusCodes::HTTP_PRECONDITION_FAILED));
         }
         if ($password != $confirm_password) {
             $this->msg .= "\nPassword and Confirm Password do not match.";
             $error_password_conf = TRUE;
             $this->error = TRUE;
         }
         if ($this->api_call == true) {
             // dont check maximum password length if this is an API call
             // this is so that the API call can accept an encrypted password
         } else {
             // this is not an API request, so check password length normally
             if (strlen($password) > PA::$password_max_length) {
                 $this->msg .= sprintf(__("\nThe password must be less than %d characters."), PA::$password_max_length);
                 $error_password_l = TRUE;
                 $this->error = TRUE;
                 header(HttpStatusCodes::httpHeaderFor(HttpStatusCodes::HTTP_PRECONDITION_FAILED));
             }
         }
         if (strlen($password) < PA::$password_min_length) {
             $this->msg .= sprintf(__("\nThe password must be longer than %d characters."), PA::$password_min_length);
             $error_password_g = TRUE;
             $this->error = TRUE;
             header(HttpStatusCodes::httpHeaderFor(HttpStatusCodes::HTTP_PRECONDITION_FAILED));
         }
     }
     if (!$this->error) {
         if (User::user_exist($login_name)) {
             $this->msg = "Login name {$login_name} is already taken";
             $error_login = TRUE;
             $this->error = TRUE;
             header(HttpStatusCodes::httpHeaderFor(HttpStatusCodes::HTTP_CONFLICT));
         } elseif (User::user_existed($login_name)) {
             $this->msg = "Login name {$login_name} has been used in the past; it belongs to a deleted user.";
             $error_login = $this->error = TRUE;
             header(HttpStatusCodes::httpHeaderFor(HttpStatusCodes::HTTP_CONFLICT));
         }
         $this->array_of_errors = array("error_login" => @$error_login, "error_first_name" => @$error_first_name, "error_email" => @$error_email, "error_password_conf" => @$error_password_conf, "error_password_l" => @$error_password_l, "error_password_g" => @$error_password_g);
     }
     if ($this->error != TRUE) {
         $this->newuser->login_name = $login_name;
         //TODO: change to md5
         $this->newuser->password = $password;
         $this->newuser->first_name = $first_name;
         $this->newuser->last_name = $last_name;
         $this->newuser->email = $email;
         if ($date_created) {
             // for users inserted via import accounts script!
             $this->newuser->created = $date_created;
         }
         if ($this->api_call == true) {
             $this->newuser->core_id = $core_id;
             if ($picture != null && $picture != '') {
                 $this->newuser->picture = $picture;
                 $this->newuser->picture_dimensions = $picture_dimensions;
             } else {
                 $this->newuser->picture_dimensions = User::image_dimensions_to_array(0, 0);
             }
             if ($avatar != null && $avatar != '') {
                 $this->newuser->avatar = $avatar;
                 $this->newuser->avatar_dimensions = $avatar_dimensions;
             } else {
                 $this->newuser->avatar_dimensions = User::image_dimensions_to_array(0, 0);
             }
             if ($avatar_small != null && $avatar_small != '') {
                 $this->newuser->avatar_small = $avatar_small;
                 $this->newuser->avatar_small_dimensions = $avatar_small_dimensions;
             } else {
                 $this->newuser->avatar_small_dimensions = User::image_dimensions_to_array(0, 0);
             }
         } else {
             $this->newuser->picture = Storage::validateFileId(@$params['user_filename']);
         }
     }
     if ($this->error != TRUE) {
         try {
             $save_error = FALSE;
             $extra = unserialize($network_info->extra);
             if ($mother_extra['email_validation'] == NET_NO || $this->api_call == true) {
                 // if email validation not required
                 $this->newuser->is_active = ACTIVE;
             } else {
                 $this->newuser->is_active = UNVERIFIED;
             }
             $this->newuser->save();
             if ($this->newuser->picture) {
                 Storage::link($this->newuser->picture, array("role" => "avatar", "user" => $this->newuser->user_id));
             }
             /* The following code should now be obsolete as this is done in User->save() */
             // saving data in user profile data also -- for searching making more easier
             $data_array = array(array('uid' => $this->newuser->user_id, 'name' => 'first_name', 'value' => $this->newuser->first_name, 'type' => BASIC, 'perm' => 1), array('uid' => $this->newuser->user_id, 'name' => 'last_name', 'value' => $this->newuser->last_name, 'type' => BASIC, 'perm' => 1));
             $this->newuser->save_user_profile($data_array, BASIC);
             // saving default notification for user from network notification setting
             $user_notification = array();
             $profile = array();
             $user_notification = $extra['notify_members'];
             $user_notification['msg_waiting_blink'] = $extra['msg_waiting_blink'];
             $profile['settings']['name'] = 'settings';
             $profile['settings']['value'] = serialize($user_notification);
             $this->newuser->save_profile_section($profile, 'notifications');
             // default notification for user ends
             $desktop_images = User_Registration::get_default_desktopimage($this->newuser->user_id, $network_info);
             // code for adding default desktop image for user
             if ($desktop_images == "") {
                 $desktop_images = array('bay.jpg', 'everglade.jpg', 'bay_boat.jpg', 'delhi.jpg');
                 $rand_key = array_rand($desktop_images);
                 $desk_img = $desktop_images[$rand_key];
             } else {
                 $desk_img = $desktop_images;
             }
             $data_array = array(0 => array('uid' => $this->newuser->user_id, 'name' => 'user_caption_image', 'value' => $desk_img, 'type' => GENERAL, 'perm' => NONE), 1 => array('uid' => $this->newuser->user_id, 'name' => 'dob_day', 'value' => $dob_day, 'type' => GENERAL, 'perm' => NONE), 2 => array('uid' => $this->newuser->user_id, 'name' => 'dob_month', 'value' => $dob_month, 'type' => GENERAL, 'perm' => NONE), 3 => array('uid' => $this->newuser->user_id, 'name' => 'dob_year', 'value' => $dob_year, 'type' => GENERAL, 'perm' => NONE), 4 => array('uid' => $this->newuser->user_id, 'name' => 'dob', 'value' => $dob_year . '-' . $dob_month . '-' . $dob_day, 'type' => GENERAL, 'perm' => NONE), 5 => array('uid' => $this->newuser->user_id, 'name' => 'homeAddress1', 'value' => $homeAddress1, 'type' => GENERAL, 'perm' => NONE), 6 => array('uid' => $this->newuser->user_id, 'name' => 'homeAddress2', 'value' => $homeAddress2, 'type' => GENERAL, 'perm' => NONE), 7 => array('uid' => $this->newuser->user_id, 'name' => 'city', 'value' => $city, 'type' => GENERAL, 'perm' => NONE), 8 => array('uid' => $this->newuser->user_id, 'name' => 'state', 'value' => $state, 'type' => GENERAL, 'perm' => NONE), 9 => array('uid' => $this->newuser->user_id, 'name' => 'country', 'value' => $country, 'type' => GENERAL, 'perm' => NONE), 10 => array('uid' => $this->newuser->user_id, 'name' => 'postal_code', 'value' => $postal_code, 'type' => GENERAL, 'perm' => NONE), 11 => array('uid' => $this->newuser->user_id, 'name' => 'phone', 'value' => $phone, 'type' => GENERAL, 'perm' => NONE));
             //}
             $this->newuser->save_user_profile($data_array, GENERAL);
             if ($mother_extra['email_validation'] == NET_NO || $this->api_call == true) {
                 //if email validation is not required
                 // creating message basic folders
                 Message::create_basic_folders($this->newuser->user_id);
                 // adding default relation
                 if ($this->newuser->user_id != SUPER_USER_ID) {
                     User_Registration::add_default_relation($this->newuser->user_id, $network_info);
                 }
                 // adding default media as well as album
                 User_Registration::add_default_media($this->newuser->user_id, '', $network_info);
                 User_Registration::add_default_media($this->newuser->user_id, '_audio', $network_info);
                 User_Registration::add_default_media($this->newuser->user_id, '_video', $network_info);
                 User_Registration::add_default_blog($this->newuser->user_id);
                 //adding default link categories & links
                 User_Registration::add_default_links($this->newuser->user_id);
                 // adding header image
                 User_Registration::add_default_header($this->newuser->user_id);
                 // Making user member of a network if he is registering to PA from a network
                 if (!empty($network_info) && $network_info->type != PRIVATE_NETWORK_TYPE) {
                     $user_type = null;
                     $register_by_admin = false;
                     if ($this->api_call == true) {
                         // since this is an API call, default this member as a
                         // NETWORK_MEMBER since they already registered
                         $user_type = NETWORK_MEMBER;
                         // since this is an API call, act like it is registration by admin
                         $register_by_admin = true;
                     }
                     Network::join($network_info->network_id, $this->newuser->user_id, $user_type, $register_by_admin);
                     if ($this->api_call == false) {
                         // only send notification of network if this is NOT an API call
                         PANotify::send("network_join", $network_info, $this->newuser, array());
                     }
                 }
             }
         } catch (CNException $e) {
             $this->msg = $e->message;
             if ($e->code == USER_EMAIL_NOT_UNIQUE) {
                 $this->msg = "Email Address has already been taken, please enter other email address.";
             }
             $save_error = TRUE;
             if ($e->message == "The email address is invalid.") {
                 $email_invalid = TRUE;
                 $this->array_of_errors['error_email'] = $email_invalid;
             }
         }
     }
     if ($this->error == TRUE || $save_error == TRUE) {
         $this->msg = "Sorry! your registration failed. " . $this->msg;
         return FALSE;
     }
     // success!
     // give Login User permissions to new user is moved to  Network::join() now!
     /*
      $this->newuser->set_user_role(array(LOGINUSER_ROLE));
     */
     return TRUE;
 }
echo $fid;
?>
" />
   <input type="hidden" name="form_data[network_id]" id="form_data_network_id" value="<?php 
echo !empty($item['network_id']) ? $item['network_id'] : PA::$network_info->network_id;
?>
" />
   <input type="hidden" name="form_data[family_id]" id="form_data_family_id" value="<?php 
echo !empty($item['family_id']) ? $item['family_id'] : $fid;
?>
" />
   <input type="hidden" name="form_data[created]" id="form_data_created" value="<?php 
echo !empty($item['created']) ? PA::date($item['created'], 'short') : PA::date(time(), 'short');
?>
" />
   <input type="hidden" name="form_data[updated]" id="form_data_updated" value="<?php 
echo PA::date(time(), 'short');
?>
" />
   <input type="hidden" name="faction" id="faction" value="savePoints" />
   <div class="field" style="height:32px">
    <div id="buttonbar" style="float: right;">
      <br />
      <input type="button" name="back_btn" id="back_btn" value="Back" onclick="javascript:history.back()" />
      <input type="submit" name="submit" id="submit_form" value="Save" />
    </div>
   </div>
 </fieldset>
 </form>
</div>
 public function importEmailMessagesOld()
 {
     global $email_messages;
     $e_messages = array();
     foreach ($email_messages as $type_id => $data) {
         $msg_type = $data['type'];
         $description = $data['description'];
         $subject = $data['subject'];
         $message_file = $data['message'];
         $EmailMessageFile = PA::resolveRelativePath("web/config/email_msg_text/{$message_file}");
         if (!$EmailMessageFile) {
             throw new Exception("NetworkConfig::importEmailMessagesOld() - Message template file: " . "'web/config/email_msg_text/{$message_file}' missing!");
         }
         $fh = fopen($EmailMessageFile, 'r');
         if (!is_resource($fh)) {
             throw new Exception("NetworkConfig::importEmailMessagesOld() - Unable to read message template file: '{$EmailMessageFile}'!");
         }
         $message_body = null;
         if (filesize($EmailMessageFile)) {
             $message_body = fread($fh, filesize($EmailMessageFile));
             fclose($fh);
         }
         $configurable_variables = serialize($data['configurable_variables']);
         $e_messages[$msg_type] = array('subject' => $subject, 'message' => $message_body, 'description' => $description, 'configurable_variables' => $configurable_variables);
     }
     //    echo "<pre>" . print_r($e_messages, 1) . "</pre>";
     return $e_messages;
 }
			} else {
				$value = '';
			}
		break;
		case 'stateselect':
			$value = @$statesList[$attval];
		break;
		case 'countryselect':
			$value = @$countryList[$attval];
		break;
		case 'dateselect':
			$day = @$atts[$field['name'].'_day']['value'];
			$month = @$atts[$field['name'].'_month']['value'];
			$year = @$atts[$field['name'].'_year']['value'];
			if ($year && $month && $day) {
				$value = PA::date(mktime(0,0,0, $month, $day, $year));
			}
		break;
		default:
			$value = $attval;
		break;
	}
	if (empty($value)) continue; // display only fields that have value
	?>
	<tr><td><?=$label?></td><td><?=$value?></td></tr>
	<?php
}
?>
</table>

      </div>
		<br style="clear:both" />
  <?php 
    foreach ($mod->profilefields as $i => $field) {
        switch ($field['type']) {
            case 'stateselect':
                $mod->dynFields->select($field['label'], $field['name'], PA::getStatesList());
                break;
            case 'industryselect':
                $mod->dynFields->select($field['label'], $field['name'], PA::$config->industries);
                break;
            case 'religionselect':
                $mod->dynFields->select($field['label'], $field['name'], PA::$config->religions);
                break;
            case 'countryselect':
                $mod->dynFields->select($field['label'], $field['name'], PA::getCountryList());
                break;
            case 'urltextfield':
                $mod->dynFields->textfield($field['label'], $field['name']);
                break;
            case 'textfield':
                $mod->dynFields->textfield($field['label'], $field['name']);
                break;
            case 'image':
                $mod->dynFields->image($field['label'], $field['name']);
                break;
            case 'dateselect':
                $mod->dynFields->dateselect($field['label'], $field['name']);
                break;
            default:
                echo print_r($field);
/**
 * gives the date format for invitations.
 * @param int timestamp.
 */
function invitation_date($timestamp)
{
    //  return date("F d, Y H:i:s", $timestamp);
    return PA::datetime($timestamp, 'long', 'short');
}
            <?php 
        echo "<a href=\"" . PA::$url . PA_ROUTE_USER_PUBLIC . '/' . "{$ranked_user->user_id}\">" . uihelper_resize_mk_user_img($ranked_user->picture, 35, 35, "alt=\"{$ranked_user->display_name}\"") . "</a>";
        ?>
          </td>
          <td class="ranking_name">
            <a href="<?php 
        echo PA::$url . PA_ROUTE_USER_PUBLIC . '/' . $ranked_user->user_id;
        ?>
"><?php 
        echo $ranked_user->display_name;
        ?>
</a>
          </td>
          <td class="ranking_date">
            <?php 
        echo !empty($ranked_user->last_activity) ? PA::datetime($ranked_user->last_activity, 'long', 'short') : __("unknown");
        ?>
          </td>
          <td class="ranking_points">
            <?php 
        echo $ranked_user->ranking_points;
        ?>
          </td>
          <td class="ranking_stars">
            <img src="<?php 
        echo PA::$theme_url . '/images/' . $ranked_user->ranking_stars . '_star.gif';
        ?>
" alt="star" />
          </td>
	</tr>
	<tr class="activities_ranking_row activities_ranking_<?php 
 function __construct($cb, $page_id, $title, $page_template = "homepage_pa.tpl", $header_template = "header.tpl", $default_mode = PRI, $default_block_type = HOMEPAGE, $network_info_ = NULL, $onload = NULL, $setting_data = NULL)
 {
     global $app, $page;
     if (PA::$profiler) {
         PA::$profiler->startTimer('PageRenderer_init');
     }
     // we may want to know the page_tpe elsewhere too
     PA::$config->page_type = $page_id;
     // NOTE: PA::$config->page_type var = $page_id and should be removed!
     $this->page_id = $page_id;
     $this->debugging = isset($_GET['debug']);
     $this->page_template = $page_template;
     $this->top_navigation_template = 'top_navigation_bar.tpl';
     //TO DO: Remove this hardcoded text afterwards
     $this->header_template = $header_template;
     //settings for current network
     $this->network_info = $network_info_ ? $network_info_ : PA::$network_info;
     //FIXME: does this have to be a parameter?  can't we just always use the global PA::$network_info?
     $this->module_arrays = array();
     // the function hide_message_window is added here
     // so whenever html page is loaded the message window's ok button gets focus
     // here if previouly some function is defined as
     // onload = "ajax_call_method(ajax_titles, $uid, ajax_urls);"
     // now it will look like
     // onload = "ajax_call_method(ajax_titles, $uid, ajax_urls); hide_message_window();"
     $this->onload = "{$onload} hide_message_window('confirm_btn');";
     $this->page_title = $title;
     $this->html_body_attributes = "";
     // default settings for the tiers
     $this->main_tier = @$_GET['tier_one'];
     $this->second_tier = @$_GET['tier_two'];
     $this->third_tier = @$_GET['tier_three'];
     $navigation = new Navigation();
     $this->navigation_links = $navigation->get_links();
     $this->message_count = null;
     if (!isset(PA::$login_uid)) {
         PA::$login_uid = @$_SESSION['user']['id'];
     }
     if (PA::$login_uid) {
         $this->message_count = Message::get_new_msg_count(PA::$login_uid);
     }
     if (!isset($dynamic_page)) {
         $dynamic_page = new DynamicPage($this->page_id);
         if (!is_object($dynamic_page) or !$dynamic_page->docLoaded) {
             throw new Exception("Page XML config file for page ID: {$page_id} - not found!");
         }
         $dynamic_page->initialize();
     }
     if (false !== strpos($dynamic_page->page_type, 'group') && (!empty($_REQUEST['gid']) || !empty($_REQUEST['ccid']))) {
         // page is a group page - get group module settings
         $_gr_id = !empty($_REQUEST['gid']) ? $_REQUEST['gid'] : $_REQUEST['ccid'];
         $this->setting_data = ModuleSetting::load_setting($this->page_id, $_gr_id, 'group');
         $this->page_template = $this->setting_data['page_template'];
         if (empty($this->setting_data['access_permission'])) {
             // no permissions required to access page
             $access_permission = true;
         } else {
             $access_permission = PermissionsHandler::can_group_user(PA::$login_uid, $_gr_id, array('permissions' => $this->setting_data['access_permission']));
         }
     } else {
         if (false !== strpos($dynamic_page->page_type, 'user') && !empty(PA::$login_uid)) {
             // page is an user page - get user module settings
             //          echo "POSTING TO USER PAGE"; die();
             $this->setting_data = ModuleSetting::load_setting($this->page_id, PA::$login_uid, 'user');
             $this->page_template = $this->setting_data['page_template'];
             if (empty($this->setting_data['access_permission'])) {
                 // no permissions required to access page
                 $access_permission = true;
             } else {
                 $access_permission = PermissionsHandler::can_user(PA::$login_uid, array('permissions' => $this->setting_data['access_permission']));
             }
         } else {
             // page is a network page - get network module settings
             $this->setting_data = ModuleSetting::load_setting($this->page_id, PA::$network_info->network_id, 'network');
             $this->page_template = $this->setting_data['page_template'];
             if (empty($this->setting_data['access_permission'])) {
                 // no permissions required to access page
                 $access_permission = true;
             } else {
                 $access_permission = PermissionsHandler::can_network_user(PA::$login_uid, PA::$network_info->network_id, array('permissions' => $this->setting_data['access_permission']));
             }
         }
     }
     $this->page = new Template(CURRENT_THEME_FSPATH . "/" . $this->page_template);
     $this->page->set('current_theme_path', PA::$theme_url);
     $this->page->set('current_theme_rel_path', PA::$theme_rel);
     // Loading the templates variables for the Outer templates files
     $this->page->set('outer_class', get_class_name(PA::$config->page_type));
     $this->top_navigation_bar = new Template(CURRENT_THEME_FSPATH . "/" . $this->top_navigation_template);
     $this->top_navigation_bar->set('current_theme_path', PA::$theme_url);
     $this->top_navigation_bar->set('current_theme_rel_path', PA::$theme_rel);
     $this->top_navigation_bar->set('navigation_links', $this->navigation_links);
     $this->setHeader($this->header_template);
     $this->footer = new Template(CURRENT_THEME_FSPATH . "/footer.tpl");
     $this->footer->set('current_theme_path', PA::$theme_url);
     $this->footer->set('page_name', $title);
     $page = $this;
     $this->preInitialize($this->setting_data);
     $this->initNew($cb, $default_mode, $default_block_type, $this->setting_data);
     if (!$access_permission) {
         $configure = unserialize(ModuleData::get('configure'));
         if (PA::logged_in()) {
             $redir_url = PA::$url . PA_ROUTE_USER_PRIVATE;
         } else {
             if (!isset($configure['show_splash_page']) || $configure['show_splash_page'] == INACTIVE) {
                 $redir_url = PA::$url . '/' . FILE_LOGIN;
             } else {
                 $redir_url = PA::$url;
             }
         }
         $er_msg = urlencode("Sorry! you are not authorized to to access this page.");
         $this->showDialog($er_msg, $type = 'error', $redir_url, 10);
     }
     if (PA::$profiler) {
         PA::$profiler->stopTimer('PageRenderer_init');
     }
 }
 /**
  * loads array of all content, that are supposed to be moderated
  * for network operator control, network content management
  * @access public
  * @param array params
  * @param array conditions
  * @return array content
  */
 public static function load_all_content_for_moderation($params = NULL, $conditions = NULL)
 {
     Logger::log("Enter: Content::load_all_content_for_moderation() | Args:  \$params = {$params}, \$conditions = {$conditions}");
     $sql = "SELECT CT.name AS content_name, C.content_id, C.collection_id, C.title, C.body, C.type, C.author_id, C.changed, C.created, C.is_active FROM {contents} AS C, {content_types} AS CT WHERE 1 AND  CT.type_id = C.type";
     if (is_array($conditions)) {
         foreach ($conditions as $field_name => $field_value) {
             if (substr($field_name, 0, 1) == '!') {
                 $sql = $sql . ' AND ' . substr($field_name, 1) . ' != ' . $field_value;
             } else {
                 $sql = $sql . ' AND ' . $field_name . ' = ' . $field_value;
             }
         }
     }
     //paging variables if set
     $sort_by = isset($params['sort_by']) ? $params['sort_by'] : 'created';
     $direction = isset($params['direction']) ? $params['direction'] : 'DESC';
     $order_by = ' ORDER BY ' . $sort_by . ' ' . $direction;
     if (isset($params['page']) && isset($params['show']) && !isset($params['cnt'])) {
         $start = ($params['page'] - 1) * $params['show'];
         $limit = ' LIMIT ' . $start . ',' . $params['show'];
     } else {
         $limit = "";
     }
     $sql = $sql . $order_by . $limit;
     $res = Dal::query($sql);
     if ($params['cnt']) {
         if ($res->numRows() > 0) {
             return $res->numRows();
         }
     }
     $content_data = array();
     // preparing array, that is to be returned
     if ($res->numRows()) {
         $i = 0;
         while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
             try {
                 $author = new User();
                 $author->load((int) $row['author_id']);
                 if ($row['collection_id'] != -1) {
                     $var = new ContentCollection();
                     $var->load((int) $row['collection_id']);
                     $collection['title'] = $var->title;
                     $collection['type'] = $var->type;
                 } else {
                     $collection = array();
                 }
                 $content_data[$i] = array('content_id' => $row['content_id'], 'title' => $row['title'], 'body' => $row['body'], 'author_id' => $row['author_id'], 'type' => $row['content_name'], 'changed' => $row['changed'], 'created' => PA::datetime($row['created'], 'long', 'long'), 'author_name' => $author->display_name, 'content_type_id' => $row['type'], 'parent_info' => $collection, 'is_active' => $row['is_active'], 'type_name' => isset($row['name']) ? $row['name'] : '');
                 $i++;
             } catch (PAException $e) {
                 //
             }
         }
     }
     Logger::log("Exit: Content::load_all_content_for_moderation()");
     return $content_data;
 }
 $group_details['collection_id'] = $group->collection_id;
 $group_details['type'] = $group->type;
 $group_details['author_id'] = $group->author_id;
 $user = new User();
 $user->load((int) $group->author_id);
 $first_name = $user->first_name;
 $last_name = $user->last_name;
 $login_name = $user->login_name;
 $group_details['author_name'] = $login_name;
 $group_details['author_picture'] = $user->picture;
 $group_details['title'] = $group->title;
 $group_details['description'] = $group->description;
 $group_details['is_active'] = $group->is_active;
 $group_details['picture'] = $group->picture;
 $group_details['desktop_picture'] = @$group->desktop_picture;
 $group_details['created'] = PA::datetime($group->created, 'long', 'short');
 //date("F d, Y h:i A", $group->created);
 $group_details['changed'] = $group->changed;
 $group_details['category_id'] = $group->category_id;
 $cat_obj = new Category();
 $cat_obj->set_category_id($group->category_id);
 $cat_obj->load();
 $cat_name = stripslashes($cat_obj->name);
 $cat_description = stripslashes($cat_obj->description);
 $group_details['category_name'] = $cat_name;
 $group_details['category_description'] = $cat_description;
 $group_details['members'] = Group::get_member_count($gid);
 $group_details['access_type'] = $access_type;
 $group_details['is_admin'] = $is_admin;
 //////////////////get details of group EOF
 if (is_array($members)) {
 function handle_request()
 {
     $json = new Services_JSON();
     try {
         global $_PA, $HTTP_RAW_POST_DATA;
         if (!@$_PA->enable_widgetization_server) {
             $this->fail("Widget server is not enabled; you must set \$_PA->enable_widgetization_server = TRUE in local_config.php.");
         }
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
             $this->fail("This URL handles POST requests only");
         }
         if ($_SERVER['CONTENT_TYPE'] != 'application/x-javascript') {
             $this->fail("Content-Type of application/x-javascript required");
         }
         // Parse input
         $request = $json->decode($HTTP_RAW_POST_DATA);
         if ($request == NULL) {
             $this->fail("Null request");
         }
         if (@$_PA->log_widget_requests) {
             Logger::log("WidgetServer::handle_request(): request={$HTTP_RAW_POST_DATA}", LOGGER_ACTION);
         }
         $this->global = $request->global;
         // This should probably be in config.inc.  For the moment
         // we figure out the network based on the URL, as with the
         // rest of the system.
         PA::$network_info = get_network_info();
         $lang = "english";
         if (!empty($this->global->language)) {
             switch ($this->global->language) {
                 case 'en':
                     break;
                 case 'fr':
                     $lang = "french";
                     break;
                 default:
                     $this->fail("Unknown language: {$this->global}->language");
             }
         }
         PA::load_language($lang);
         // Create items as required
         if (!empty($this->global->items)) {
             foreach ($this->global->items as $item) {
                 $item_params = array();
                 foreach ($item as $k => $v) {
                     $item_params[$k] = $v;
                 }
                 Item::sync($item_params);
                 // create or update row in 'items' database table
             }
         }
         // Set up globals - network, user etc
         if (!empty($this->global->user)) {
             $user_info = array("user_id" => $this->global->user->id, "login_name" => $this->global->user->login, "email" => $this->global->user->email, "first_name" => $this->global->user->first_name, "last_name" => $this->global->user->last_name, "url" => $this->global->user->url, "thumbnail_url" => $this->global->user->thumbnail_url);
             // load (and sync!) or create a shadow user for the current remote user
             PA::$login_user = new ShadowUser($this->global->user->namespace);
             if (!PA::$login_user->load($user_info)) {
                 // we haven't seen this remote user before - create account
                 PA::$login_user = ShadowUser::create($this->global->user->namespace, $user_info, PA::$network_info);
                 //FIXME: need to define what remote urls mean.  in this case "url" should be used instead of /users/$login_name when generating internal urls, so it should go in a global profile block rather than something specific to the remote site.
                 PA::$login_user->set_profile_field($this->global->user->namespace, "url", $this->global->user->url);
             }
             PA::$login_uid = PA::$login_user->user_id;
         }
         // Render modules
         $modules = array();
         foreach ($request->modules as $req_module) {
             $module = array();
             $module['id'] = $req_module->id;
             $module['name'] = $name = $req_module->name;
             $params = array();
             foreach ($req_module->params as $k => $v) {
                 $params[$k] = $v;
             }
             // clean up URLs that may have the port 80 specified
             // this would lead to cross server AJAX problems in safari etc
             // although we are actually on the same server
             // domain.tld:80/file/ and domain.tld/file/
             foreach (array('get_url', 'ajax_url', 'post_url') as $i => $url) {
                 $req_module->{$url} = preg_replace('|:80/*|', '/', $req_module->{$url});
             }
             // dispatch module
             ob_start();
             $module['html'] = $this->render_module($req_module->method, $req_module->name, $req_module->args, $params, $req_module->get_url, $req_module->ajax_url, $req_module->post_url, $req_module->param_prefix);
             // prefix for input parameters and textareas
             $errors = ob_get_contents();
             ob_end_clean();
             if (!empty($errors)) {
                 $module['errors'] = $errors;
             }
             $modules[] = $module;
         }
         $response = array('modules' => $modules);
         header("Content-Type: application/x-javascript");
         echo $json->encode($response);
     } catch (WidgetException $e) {
         echo $json->encode(array("error" => $e->getMessage()));
     }
 }
 if (!empty($_POST['network_content_moderation'])) {
     $network_basic_controls['network_content_moderation'] = NET_YES;
 }
 $network_basic_controls['default_language'] = $_POST['default_language'];
 $data = array('name' => $form_data['name'], 'tagline' => $form_data['tagline'], 'category_id' => $form_data['category'], 'description' => $form_data['desc'], 'type' => $form_data['type'], 'extra' => serialize($network_basic_controls), 'network_id' => PA::$network_info->network_id, 'changed' => time());
 //add icon image
 if (is_array(@$data_icon_image) && !empty($data_icon_image['inner_logo_image'])) {
     $data = array_merge($data, $data_icon_image);
     $form_data['inner_logo_image'] = $data_icon_image['inner_logo_image'];
 }
 //try following line
 $network = new Network();
 $network->set_params($data);
 try {
     $nid = $network->save();
     PA::$network_info = get_network_info();
     //refreshing the network_info after saving it.
     $error_msg = 'Network Information Successfully Updated';
     if (!empty($_REQUEST['config_action']) && $_REQUEST['config_action'] == 'store_as_defaults') {
         $export_config = new NetworkConfig();
         $export_config->buildNetworkSettings($network);
         $export_config->storeSettingsLocal();
         $error_msg = 'Network default configuration file "' . $export_config->settings_file . '" successfully updated.';
     }
     if (!empty($new_inner_logo_image)) {
         Storage::link($new_inner_logo_image, array("role" => "avatar"));
     }
     //set $form_data['reciprocated_relationship']if reciprocated relationship is saved
     $form_data['reciprocated_relationship'] = $network_basic_controls['reciprocated_relationship'];
     $form_data['email_validation'] = $network_basic_controls['email_validation'];
     $form_data['captcha_required'] = $network_basic_controls['captcha_required'];
  public function dateselect($label, $fieldname, $section, $seq=NULL, $show_access_list=true) {
     
    $_months = array_values(PA::getMonthsList());
    array_unshift($_months, " ");
    $monthnames = $_months;
    $years = PA::getYearsList();

    $f = @$this->user->{$section}[$fieldname];
    if ($seq) {
      $f = $f[$seq]; // we have a collection here
      $fieldname = $fieldname."[$seq]"; // to properly pass in HTML
    }
    $v = @$f['value'];
    $vyear = $vmonth = $vday = 0;
    if ($v) {
      list($vyear, $vmonth, $vday) = explode('-', $v);
    }
  ?>
      <div class="field_medium">
        <h4><label for="<?=$fieldname.'[value]'?>"><?=$label?></label></h4>
        <div class="center">
          <select name="<?=$fieldname.'_day[value]'?>" id="<?=$fieldname.'_day[value]'?>" class="select-txt">
            <option value=""></option>
          <?php
          for ($i=1; $i<=31; $i++) {
              if($i == (int)$vday) {
                $selected = " selected=\"selected\" ";
              } else {
                $selected = "";
              }
            ?>
            <option <?=$selected;?> value="<?=$i?>"><?=$i?></option>
          <?php } ?>
        </select>
        <select name="<?=$fieldname.'_month[value]'?>" id="<?=$fieldname.'_month[value]'?>" class="select-txt">
          <?php
          for ($i=1; $i<=12; $i++) {
              if($i == (int)$vmonth) {
                $selected = " selected=\"selected\" ";
              } else {
                $selected = "";
              }
            ?>
            <option <?=$selected;?> value="<?=$i?>"><?=$monthnames[$i]?></option>
          <?php } ?>
        </select>
        <select name="<?=$fieldname.'_year[value]'?>" id="<?=$fieldname.'_year[value]'?>" class="select-txt">
            <option value=""></option>
          <?php
          foreach ($years as $k=>$year) {
              if($year == (int)$vyear) {
                $selected = " selected=\"selected\" ";
              } else {
                $selected = "";
              }
            ?>
            <option <?=$selected?> value="<?=$year?>"><?=$year?></option>
          <?php } ?>
        </select>

        </div>
        <?php
          if ($show_access_list) {
        ?>
        <div>
        <?php
          print uihelper_get_user_access_list($fieldname."[perm]", $f["perm"]);
        ?>
        </div>
        <?php
          }
        ?>
        <br />
      </div>
  <?
  }
示例#20
0
        <div class="points_descr"><?php 
        echo $item['description'];
        ?>
</div>
      </div>
      <div class="points_details">
        <table>
          <tr><td class="categ"><?php 
        echo abbreviate_text($item['category'], 8, 3);
        ?>
</td></tr>
          <tr><td><b><?php 
        echo __("Date: ");
        ?>
</b><?php 
        echo PA::date($item['created'], 'short');
        ?>
</td></tr>
          <tr><td><?php 
        echo abbreviate_text($item['place'], 20, 13);
        ?>
</td></tr>
        </table>
      </div>
      <div class="points_user">
        <?php 
        echo uihelper_resize_mk_img($item['user']->picture, 64, 64, 'images/default.png', 'style=""');
        ?>
        <a href="<?php 
        echo PA::$url . PA_ROUTE_USER_PUBLIC . "/{$item['user']->user_id}";
        ?>
include_once "web/includes/page.php";
require_once "api/ModuleData/ModuleData.php";
require_once "web/dologin.php";
$configure = unserialize(ModuleData::get('configure'));
if (!isset($configure['show_splash_page']) || $configure['show_splash_page'] == INACTIVE) {
    $location = PA_ROUTE_HOME_PAGE;
    header("Location: {$location}");
    exit;
}
$module_name = 'SplashPage';
$configurable_sections = array('info_boxes', 'network_of_moment', 'video_tours', 'register_today', 'server_announcement', 'survey');
foreach ($configurable_sections as $key => $section) {
    ${$section} = unserialize(ModuleData::get($section));
}
// Display welcome Message if logged in, otherwise show login prompt
if (PA::logged_in() || !isset($configure['show_splash_page']) || $configure['show_splash_page'] == INACTIVE) {
    $uname = $user->get_name();
    $message = "Welcome, {$uname}! <a href='logout.php'>Logout</a>";
} else {
    $message = ' <form action="dologin.php?action=login" method="post" style="margin: 0px;">
         <input type="hidden" name="InvID" value=""/>
         <input type="hidden" name="GInvID" value=""/>
         Username<input type="text" name="username"/>
         Password<input type="password" name="password"/>
         <input type="submit" value="login"/>
         or
         <a href="register.php">REGISTER</a></form>';
}
$parameter = js_includes("all");
$mothership_info = mothership_info();
?>
    echo uihelper_resize_mk_img($post->user->picture, 35, 35, "images/default.png", 'alt="Picture of the forum owner."');
    ?>
    </a>
   </div>
   <div>
    <a href="<?php 
    echo $forums_url . "&thread_id={$thread_id}&post_id={$post_id}#p_{$post_id}";
    ?>
"><?php 
    echo $post->get_title(24);
    ?>
</a><br />
    by: <a href="<?php 
    echo PA::$url . PA_ROUTE_USER_PUBLIC . '/' . $post->user->user_id;
    ?>
"><?php 
    echo $post->user->login_name;
    ?>
</a>
    <p class="post_date"><?php 
    echo PA::datetime(strtotime($post->get_created_at()), 'long', 'short');
    ?>
</p>
   </div>
  </div>
  <?php 
}
?>
 </div>
</div>
 function some_joins_a_network($array_of_data)
 {
     $extra = unserialize(PA::$network_info->extra);
     $destination = $extra['notify_owner']['some_joins_a_network']['value'];
     if ($destination == NET_NONE) {
         //if no notification
         return;
     }
     $uid = $array_of_data['params']['uid'];
     $login = User::get_login_name_from_id($uid);
     /*
         $current_url = PA::$url .'/' .FILE_USER_BLOG .'?uid='.$uid;
         $url_perms = array('current_url' => $current_url,
                                   'login' => $login
                                 );
         $url = get_url(FILE_USER_BLOG, $url_perms);
     */
     $url = PA::$url . PA_ROUTE_USER_PUBLIC . '/' . $login;
     $user = new User();
     $user->load((int) $uid);
     $joinee_name = $user->login_name;
     $this->network_owner_name = $array_of_data['owner_name'];
     PA::$network_info = get_network_info();
     $member_count = PA::$network_info->member_count;
     $this->mail_type = 'network_join';
     $member_moderation_url = PA::$url . '/' . FILE_NETWORK_MANAGE_USER;
     $this->mail_sub_msg_array = array('joinee' => $joinee_name, 'network_name' => PA::$network_info->name, 'network_owner_name' => $this->network_owner_name, 'member_count' => $member_count, 'joinee_id' => $uid, 'joinee_url' => $url, 'config_site_name' => PA::$site_name, 'network_url' => PA::$url, 'member_moderation_url' => $member_moderation_url);
     $this->from = $uid;
     $this->switch_destination($destination);
 }
 public function generate_group_links()
 {
     $group_info = NULL;
     // Retrive the group details
     $group_data = ContentCollection::load_collection($this->gid, NULL);
     $group_info['members'] = Group::get_member_count($this->gid);
     // Loading the Group owner
     $user = new User();
     $user->load((int) $group_data->author_id);
     $group_info->created = PA::datetime($group->created, 'long', 'short');
     //date("F d, Y h:i A", $group_data->created);
     $group_info->author_picture = $user->picture;
     $group_info->author_name = $user->login_name;
     $group_info->author_id = $group_data->author_id;
     $group_info->category_name = $group_data->category_name;
     $group_info->access_type = $group_data->reg_type == $group_data->REG_OPEN ? ' Open' : ' Moderated';
     unset($user);
     unset($group_data);
     return $group_info;
 }
 public function getCurrentUser()
 {
     global $page_uid, $page_user, $login_uid, $login_name, $login_user;
     require_once "api/User/User.php";
     session_start();
     PA::$login_uid = NULL;
     PA::$login_user = NULL;
     $login_uid = NULL;
     $login_name = NULL;
     $login_user = NULL;
     $this->CurrUser = isset($_SESSION['user']) ? $_SESSION['user'] : null;
     // Check if an authToken variable in GET and use it if available
     $authToken = isset($_GET['authToken']) ? $_GET['authToken'] : null;
     if ($authToken) {
         try {
             $user = new User();
             $user = $this->getUserFromAuthToken($authToken);
             if ($user && $user->user_id) {
                 // User is valid so log_in the user
                 // 	Since we know that AuthToken was passed into the URL, we can assume this
                 // 	user was redirected here from a partner web site. We need to log in the user
                 // 	as if they logged in through the normal PeopleAggregator login form:
                 // (ie. set all session variables just as if dologin.php was called).
                 $referer = "external site";
                 if (isset($_SERVER['HTTP_REFERER'])) {
                     $referer = $_SERVER['HTTP_REFERER'];
                 }
                 $pal = new PA_Login();
                 $pal->log_in($user->user_id, false, $referer);
                 // Set authToken as a session variable so that it can be accessed anywhere
                 $_SESSION['authToken'] = $authToken;
             }
         } catch (Exception $e) {
             if (!in_array($e->getCode(), array(USER_NOT_FOUND, USER_ALREADY_DELETED, USER_TOKEN_INVALID, USER_TOKEN_EXPIRED))) {
                 throw $e;
             }
             // The currently logged-in user has been deleted; invalidate the session.
             session_destroy();
             session_start();
             $login_uid = PA::$login_uid = $login_name = $login_user = PA::$login_user = NULL;
         }
     }
     if ($this->CurrUser) {
         try {
             $user = new User();
             $user->load((int) $this->CurrUser['id'], "user_id", TRUE);
         } catch (Exception $e) {
             if (!in_array($e->getCode(), array(USER_NOT_FOUND, USER_ALREADY_DELETED))) {
                 throw $e;
             }
             // The currently logged-in user has been deleted; invalidate the session.
             session_destroy();
             session_start();
             $login_uid = PA::$login_uid = $login_name = $login_user = PA::$login_user = NULL;
         }
     }
     if (isset($user) && $user) {
         // if the user variable is set
         if ($user->user_id) {
             $login_name = $this->CurrUser['name'];
             PA::$login_user = $login_user = $user;
             PA::$login_uid = $login_uid = $user->user_id;
         }
         if (PA::$login_uid) {
             PA::$login_user->update_user_time_spent();
             User::track_status(PA::$login_uid);
         }
     }
     // If a user is specified on the query string as an ID (uid=123) or
     // login name (login=phil), validate the id/name and load the user
     // object.
     if (!empty($_GET['uid'])) {
         $page_uid = PA::$page_uid = (int) $_GET['uid'];
         $page_user = PA::$page_user = new User();
         PA::$page_user->load(PA::$page_uid);
     } else {
         if (!empty($_GET['login'])) {
             $page_user = PA::$page_user = new User();
             if (is_numeric($_GET['login'])) {
                 PA::$page_user->load((int) $_GET['login']);
             } else {
                 PA::$page_user->load($_GET['login']);
             }
             $page_uid = PA::$page_uid = PA::$page_user->user_id;
         } else {
             $page_uid = PA::$page_uid = $page_user = PA::$page_user = NULL;
         }
     }
     // Copy PA::$page_* into PA::$* if present, otherwise use PA::$login_*.
     if (PA::$page_uid) {
         $uid = PA::$uid = PA::$page_uid;
         $user = PA::$user = PA::$page_user;
     } else {
         $uid = PA::$uid = PA::$login_uid;
         $user = PA::$user = PA::$login_user;
     }
     session_commit();
 }
示例#26
0
        ?>
                        <td><input type="checkbox" name="uid[]" value="<?php 
        echo $links[$i]['user_id'];
        ?>
" /></td>
                        <td><a href="<?php 
        echo $user_url;
        ?>
">
                                <?php 
        echo uihelper_resize_mk_user_img($links[$i]['picture'], 35, 35, 'alt="facewall"');
        ?>
                            </a>
                        </td>
                        <td><?php 
        echo PA::date($links[$i]['created'], 'short');
        ?>
</td>
                        <td><a href="<?php 
        echo $user_url;
        ?>
"><?php 
        echo $links[$i]['login_name'];
        ?>
</a></td>
                        <td><?php 
        echo wordwrap($links[$i]['first_name'] . ' ' . $links[$i]['last_name'], 20, "<br />\n", true);
        ?>
</td>
                        <td><?php 
        echo wordwrap($links[$i]['email'], 20, "<br />\n", true);
示例#27
0
// set TRUE to get info about each rendered template added into the output HTML
$debug_annotate_templates = FALSE;
// set TRUE to turn off template caching (good if you are frequently changing templates)
$debug_disable_template_caching = FALSE;
// set TRUE to show the Subversion version on the bottom of each page,
// along with the timing.  This requires some XML parsing, so it's
// best to leave it off on a live site.
$debug_show_svn_version = FALSE;
$comments_disabled = FALSE;
// --- SITE PERSONALIZATION ---
// site name
PA::$site_name = "PeopleAggregator";
// default sender email
$default_sender = "*****@*****.**";
// --- INTERNATIONALIZATION ---
PA::$language = 'english';
// work in progress: try 'japanese' to see the homepage in Japanese.
// --- MISC ---
// Set enable_network_spawning to FALSE to disable the creation of new
// networks, without disabling the network directory or any existing
// networks.
$_PA->enable_network_spawning = TRUE;
// Set enable_networks to FALSE to completely disable networks - don't
// allow them to be used at all, and disable spawning and the network
// directory.
$_PA->enable_networks = TRUE;
// Set to TRUE to force all networks to be private, regardless of
// their settings.  This will mean nobody has access to anything until
// they have created an account and logged in.
//TODO: To round this feature off, the following things would be useful:
// - an option to not auto-join users to the home network (to make the home net truly private).
function uihelper_generate_center_content_permalink($cid, $show = 0)
{
    global $app;
    $image_media_gallery = FALSE;
    $back_page = PA::$url . $app->current_route;
    $content = CNContent::load_content((int) $cid, (int) PA::$login_uid);
    // filter content fields for output
    $content->title = _out($content->title);
    $content->body = _out($content->body);
    if (strstr($back_page, PA_ROUTE_CONTENT) || strstr($back_page, PA_ROUTE_PERMALINK)) {
        if ($content->parent_collection_id > 0) {
            $collection = ContentCollection::load_collection((int) $content->parent_collection_id, PA::$login_uid);
            if ($collection->type == GROUP_COLLECTION_TYPE) {
                $back_page = PA::$url . PA_ROUTE_GROUP . "/gid=" . $content->parent_collection_id;
            } else {
                $back_page = PA::$url . PA_ROUTE_MEDIA_GALLEY_IMAGES . "/uid=" . $content->author_id;
            }
            // IF permalink content is a group content redirect to group homepage
        } else {
            //if coming from permalink page then redirect to user page
            $back_page = PA::$url . PA_ROUTE_USER_PRIVATE;
        }
    }
    $moderateduser = Group::is_admin((int) $content->parent_collection_id, (int) PA::$login_uid) ? 1 : 0;
    $back_page = urlencode($back_page);
    if (!$content->is_html) {
        $content->body = nl2br($content->body);
    }
    $media_gallery_content = NULL;
    $media_gallery_content = in_array(trim($content->type), array('Image', 'Audio', 'Video'));
    $editable = PA::$login_uid == $content->author_id || $moderateduser;
    $comments = Comment::get_comment_for_content($cid, '', 'ASC');
    $number_of_comments = count($comments);
    $content->no_of_comments = $number_of_comments;
    $trackback = CNContent::get_trackbacks_for_content($cid);
    $number_of_trackbacks = count($trackback);
    $content->no_of_trackbacks = $number_of_trackbacks;
    $content->trackback_url = PA::$url . "/pa_trackback.php?cid=" . $cid;
    $content_user = new User();
    $content_user->load((int) $content->author_id);
    $content->create_time = PA::date($content->changed, 'long');
    // date("l, F d, Y", $content->changed);
    $tags = Tag::load_tags_for_content($cid);
    if ($tags) {
        $t = array();
        for ($i = 0; $i < count($tags); $i++) {
            $name = _out($tags[$i]['name']);
            $uid = PA::$login_uid;
            $url = PA::$url . '/' . FILE_TAG_SEARCH . '?name_string=content_tag&keyword=' . $tags[$i]["name"];
            $t[] = "<a href={$url}>" . $name . "</a>";
        }
        $tag_string = "<b>Tags : </b>" . implode(", ", $t);
    } else {
        $tag_string = "";
    }
    $content->tag_entry = $tag_string;
    if (property_exists($content, 'sbname')) {
        if (substr($content->sbname, 0, 5) == 'event') {
            $content->type = 'SBEvent';
        } elseif (substr($content->sbname, 0, 6) == 'review') {
            $content->type = 'Review';
        } elseif (substr($content->sbname, 0, 11) == 'media/audio') {
            $content->type = 'Audio';
        } elseif (substr($content->sbname, 0, 11) == 'media/video') {
            $content->type = 'Video';
        } elseif (substr($content->sbname, 0, 11) == 'media/image') {
            $content->type = 'Image';
        } elseif (substr($content->sbname, 0, 14) == 'showcase/group') {
            $content->type = 'GroupShowCase';
        } elseif (substr($content->sbname, 0, 15) == 'showcase/person') {
            $content->type = 'PersonShowCase';
        }
    }
    // replace magic strings
    $content->replace_percent_strings(PA::$url);
    $type = $content->type;
    $type = $type . 'Permalink';
    // comments
    $comments_list_tpl = new Template(CURRENT_THEME_FSPATH . "/cncontent_comments.php");
    $comments_list_tpl->set('current_theme_path', PA::$theme_url);
    $comments_list_tpl->set('comments', $comments);
    $comments_list_tpl->set('author_id', $content->author_id);
    // Setting the variable for the abuse form ...
    $comments_list = $comments_list_tpl->fetch();
    //comment form
    $cnform_comment_tpl = new Template(CURRENT_THEME_FSPATH . "/cnform_comment.php");
    $cnform_comment_tpl->set('current_theme_path', PA::$theme_url);
    if (isset(PA::$login_uid)) {
        $user = new User();
        $user->load((int) PA::$login_uid);
        $login_name = $user->login_name;
        $cnform_comment_tpl->set('name', $login_name);
        $cnform_comment_tpl->set('login_name', $user->login_name);
    }
    $cnform_comment_tpl->set('cid', $cid);
    if ($content->parent_collection_id > 0) {
        $cnform_comment_tpl->set('ccid', $content->parent_collection_id);
    }
    // abuse form
    $cnform_abuse_tpl = new Template(CURRENT_THEME_FSPATH . "/cnform_abuse.php");
    /* Permalink and edit links for content */
    if ($content->parent_collection_id != -1) {
        $perma_link = PA::$url . PA_ROUTE_PERMALINK . "/cid=" . $content->content_id . '&ccid=' . $content->parent_collection_id;
    } else {
        $perma_link = PA::$url . PA_ROUTE_PERMALINK . "/cid=" . $content->content_id;
    }
    $params = array('permissions' => 'edit_content', 'uid' => PA::$login_uid, 'cid' => $content->content_id);
    if (PermissionsHandler::can_user(PA::$login_uid, $params)) {
        if ($media_gallery_content) {
            $edit_link = PA::$url . '/edit_media.php?cid=' . $content->content_id;
        } else {
            $edit_link = PA::$url . "/cncontent_blog.php?cid=" . $content->content_id;
        }
        $delete_link = PA::$url . PA_ROUTE_CONTENT . "?action=deleteContent&cid=" . $content->content_id . '&amp;back_page=' . $back_page;
        // handle Event separately
        if ($type == "EventPermalink") {
            $edit_link = PA::$url . '/calendar.php?cid=' . $content->content_id;
            $delete_link = $edit_link . "&delete=1" . '&amp;back_page=' . $back_page;
        }
    } else {
        $edit_link = $delete_link = NULL;
    }
    $user_link = PA::$url . PA_ROUTE_USER_PUBLIC . '/' . $content->author_id;
    /* Code for Approval and Denial links for a content */
    if ($moderateduser && $content->is_active == 2) {
        $approval_link = PA::$url . PA_ROUTE_PERMALINK . '/cid=' . $content->content_id . '&ccid=' . $content->parent_collection_id . '&apv=1';
        $denial_link = PA::$url . PA_ROUTE_PERMALINK . '/cid=' . $content->content_id . '&ccid=' . $content->parent_collection_id . '&dny=1';
    } else {
        $approval_link = $denial_link = NULL;
    }
    // Show comments form to logged in users, only if comments enabled.
    global $comments_disabled;
    // fix by Z.Hron; if group content - only members of group can comment it
    $can_user_comment = true;
    if (isset($_GET['gid']) && isset(PA::$login_uid)) {
        $can_user_comment = Group::member_exists((int) $_GET['gid'], PA::$login_uid);
    }
    if (!$comments_disabled && !empty(PA::$login_uid) && $can_user_comment) {
        $cnform_comment = $cnform_comment_tpl->fetch();
        $cnform_abuse = $cnform_abuse_tpl->fetch();
    } else {
        $cnform_comment = $cnform_abuse = NULL;
    }
    if (getShadowedPath(CURRENT_THEME_FSPATH . "/{$type}.php")) {
        $middle_content = new Template(getShadowedPath(CURRENT_THEME_FSPATH . "/{$type}.php"));
        $middle_content->set_object('contents', $content);
        $middle_content->set('editable', $editable);
        $middle_content->set('picture_name', $content_user->picture);
        //  to set picture name for diplaying in contets
        $middle_content->set('user_id', $content_user->user_id);
        $middle_content->set('user_name', $content_user->first_name . ' ' . $content_user->last_name);
        $middle_content->set('current_theme_path', PA::$theme_url);
        $middle_content->set('back_page', $back_page);
        $middle_content->set('comments', $comments_list);
        $middle_content->set('cnform_comment', $cnform_comment);
        $middle_content->set('cnform_abuse', $cnform_abuse);
        $middle_content->set('media_gallery_content', $media_gallery_content);
        if ($show == 1) {
            $middle_content->set('show', $show);
        }
        $middle_content->set('permalink', $perma_link);
        $middle_content->set('edit_link', $edit_link);
        $middle_content->set('approval_link', $approval_link);
        $middle_content->set('denial_link', $denial_link);
        $middle_content->set('delete_link', $delete_link);
        $middle_content->set('user_link', $user_link);
        $return_content = $middle_content->fetch();
    } else {
        $return_content = '<p>Content does not have a display template.</p><p>Create a ' . $type . '.php file to display this content type.</p>';
    }
    return $return_content;
}
function pa_log_script_execution_time($at_start = FALSE)
{
    global $pa_page_render_start;
    if (!isset(PA::$config->perf_log)) {
        return;
    }
    $post = array();
    foreach ($_POST as $k => $v) {
        $post[] = urlencode($k) . "=" . urlencode($v);
    }
    $status_map = array(0 => "NORMAL", 1 => "ABORTED", 2 => "TIMEOUT", 3 => "ABORTED+TIMEOUT");
    if ($at_start) {
        $msg = sprintf("%d\tstart\t%s\t%s\t%s\t%s\t%s\thttp://%s\t%s\t%s\t%s\t%s\n", posix_getpid(), PA::datetime(time(), 'long', 'short'), $_SERVER['REMOTE_ADDR'], @$_SERVER['HTTP_X_FORWARDED_FOR'], $status_map[connection_status()], $_SERVER['REQUEST_METHOD'], $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], $_SERVER['HTTP_USER_AGENT'], implode("&", $post), @$_SESSION['user']['id'], @$_SESSION['user']['name']);
    } else {
        $msg = sprintf("%d\t%.2f\n", posix_getpid(), microtime(TRUE) - $pa_page_render_start);
    }
    error_log($msg, 3, PA::$config->perf_log);
}
                 $stored_img = new StoredFile($image_file);
                 $img_src = $stored_img->getURL();
                 $img_path = parse_url($img_src);
                 $img_ext = pathinfo($img_path['path'], PATHINFO_EXTENSION);
             } else {
                 echo "invalid IMG url";
                 exit;
             }
         } catch (Exception $e) {
             $img = null;
         }
     }
 }
 if ($img_path['host'] == $_SERVER['SERVER_NAME']) {
     // image from local server
     $img_src = PA::resolveRelativePath('web' . $img_path['path']);
 }
 if ($img_ext == 'jpg' || $img_ext == 'jpeg') {
     $img = @imagecreatefromjpeg($img_src);
 } elseif ($img_ext == 'png') {
     $img = @imagecreatefrompng($img_src);
 } elseif ($img_ext == 'gif') {
     $img = @imagecreatefromgif($img_src);
 } else {
     exit;
 }
 if ($img) {
     $x_offset = $y_offset = 0;
     $img_width = imagesx($img);
     $img_height = imagesy($img);
     $x_scale = floatval($new_img_width) / floatval($img_width);