PHP Method User::getCurrentUser, codiad Code Examples

This page contains top rated real world PHP examples of method User::getCurrentUser from package codiad extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: CardFields.class.php Project: nterray/tuleap
0
 public function getFields(Tracker_Artifact $artifact)
 {
     $diplayed_fields = array();
     $tracker_id = $artifact->getTrackerId();
     foreach ($this->displayed_fields as $diplayed_field_name) {
         $field = $this->form_element_factory->getUsedFieldByNameForUser($tracker_id, $diplayed_field_name, $this->user_manager->getCurrentUser());
         if ($field) {
             $diplayed_fields[] = $field;
         }
     }
     return $diplayed_fields;
 }
Example #2
Show file File: IFrameRest.php Project: cnlangzi/wifidog-auth
0
 /**
  * Return the IFrame URL generated by parsing the data in the URL field.
  *
  * @return string HTML code for the administration interface
  */
 private function getGeneratedUrl()
 {
     $patterns = array('/\\{node_id\\}/', '/\\{user_id\\}/', '/\\{last_viewed\\}/');
     $current_node = Node::getCurrentNode();
     if ($current_node) {
         $node_id = $current_node->getId();
     } else {
         $node_id = '';
     }
     $current_user = User::getCurrentUser();
     if ($current_user) {
         $user_id = $current_user->getId();
     } else {
         $user_id = '';
     }
     $user_last_viewed_ts = $this->getLastDisplayTimestamp($current_user);
     if ($user_last_viewed_ts) {
         $user_last_viewed = date('c', $user_last_viewed_ts);
     } else {
         $user_last_viewed = null;
     }
     $replacements = array(urlencode($node_id), urlencode($user_id), urlencode($user_last_viewed));
     $url = $this->getUrl();
     $new_url = preg_replace($patterns, $replacements, $url);
     return $new_url;
 }
Example #3
Show file File: DrivingtourController.php Project: jkzleond/car_mate_local_favour
0
 /**
  * 获取自驾游详情
  * @param $id
  */
 public function getDetailAction($id)
 {
     $tour = Activity::getDrivingTourDetailById($id);
     $user = User::getCurrentUser();
     $is_user_join = Activity::isUserJoin($user['user_id'], $id);
     $tour['is_user_join'] = $is_user_join;
     $this->view->setVars(array('row' => $tour));
 }
Example #4
Show file File: ActivityController.php Project: jkzleond/car_mate_local_favour
0
 /**
  * 获取指定id的活动详情
  * @param $id
  */
 public function getDetailAction($id)
 {
     $activity = Activity::getActivityDetailById($id);
     $user = User::getCurrentUser();
     $is_user_join = Activity::isUserJoin($user['user_id'], $id);
     //更新浏览次数
     Activity::updateActivityViewNum($id);
     $activity['is_user_join'] = $is_user_join;
     $this->view->setVars(array('row' => $activity));
 }
Example #5
Show file File: UserController.php Project: jkzleond/car_mate_local_favour
0
 /**
  * 获取用户信息
  * @param string $user_id
  */
 public function getUserInfoAction($user_id = 'me')
 {
     $user = null;
     if ($user_id == 'me') {
         $user = User::getCurrentUser();
     } else {
         $user = User::getUserInfoById($user_id);
     }
     $this->view->setVar('row', $user);
 }
Example #6
Show file File: CollectionController.php Project: jkzleond/car_mate_local_favour
0
 /**
  * 获取收藏数据列表
  */
 public function getListAction()
 {
     $page_num = $this->request->get('page');
     $page_size = $this->request->get('rows');
     $criteria = array();
     $user = User::getCurrentUser();
     $criteria['user_id'] = $user['user_id'];
     $collection_list = Collection::getList($criteria, $page_num, $page_size);
     $collection_total = Collection::getCount($criteria);
     $this->view->setVars(array('total' => $collection_total, 'count' => count($collection_list), 'rows' => $collection_list));
 }
Example #7
Show file File: MessageController.php Project: erick305/testing
0
 public function actionToggleMatchNotifications()
 {
     if (User::isCurrentUserAdmin()) {
         $bit = intval($_GET['value']);
         $bit = $bit == 0 ? 1 : 0;
         $mod = new MatchNotification();
         $mod->status = $bit;
         $mod->date_modified = date('Y-m-d H:i:s');
         $userinfo = User::getCurrentUser();
         $mod->userid = $userinfo['id'];
         $mod->save();
         $userid = $mod->getUserId();
         $user = User::model()->find("id=:id", array(':id' => $userid));
         $state = $mod->isGlobalNotificationOn() ? '1' : '0';
         $data = array('userid' => $userid, 'status' => $state, 'last_modified' => $mod->getLastDate(), 'username' => $user['username']);
         echo CJSON::encode($data);
     }
 }
Example #8
Show file File: HyperLinkUtils.php Project: cnlangzi/wifidog-auth
0
 /** Replace all hyperlinks in the source string with their clickthrough-logged equivalents */
 public static function replaceHyperLinks(&$string, Content &$content)
 {
     $matches = self::findHyperLinks($string);
     //pretty_print_r($matches);
     if (!empty($matches[2])) {
         $node = Node::getCurrentNode();
         $user = User::getCurrentUser();
         $i = 0;
         foreach ($matches[2] as $link) {
             $new_link = self::getClickThroughLink($link, $content, $node, $user);
             $replacements[] = $matches[1][$i] . $new_link . $matches[3][$i];
             $i++;
         }
         //pretty_print_r($replacements);
         return str_replace($matches[0], $replacements, $string);
     } else {
         return $string;
     }
 }
Example #9
Show file File: Picture.php Project: soitun/wifidog-auth
0
 /**
  * Processes the input of the administration interface for Picture
  *
  * @return void
  */
 public function processAdminUI()
 {
     if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         parent::processAdminUI();
         if ($this->configEnableHyperlink) {
             $this->setHyperlinkUrl($_REQUEST["pictures_{$this->getId()}_hyperlink_url"]);
         }
         if ($this->configEnableEditWidthHeight) {
             $this->setWidth(intval($_REQUEST["pictures_{$this->getId()}_width"]));
             $this->setHeight(intval($_REQUEST["pictures_{$this->getId()}_height"]));
         }
     }
 }
Example #10
Show file File: RssAggregator.php Project: soitun/wifidog-auth
0
 /**
  * Processes the input of the administration interface for RssAggregator
  *
  * @return void
  */
 public function processAdminUI()
 {
     if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         parent::processAdminUI();
         /*
          * number_of_display_items
          */
         $name = "rss_aggregator_" . $this->id . "_display_num_items";
         $this->setDisplayNumItems($_REQUEST[$name]);
         /*
          * algorithm_strength
          */
         $name = "rss_aggregator_" . $this->id . "_algorithm_strength";
         $this->setAlgorithmStrength($_REQUEST[$name]);
         /*
          * feed_expansion
          */
         $name = "rss_aggregator_" . $this->id . "_feed_expansion";
         $this->setFeedExpansionMode($_REQUEST[$name]);
         /*
          * feed_ordering
          */
         $name = "rss_aggregator_" . $this->id . "_feed_ordering";
         $this->setFeedOrdering($_REQUEST[$name]);
         /*
          * display_empty_feeds
          */
         $name = "rss_aggregator_" . $this->id . "_display_empty_feeds";
         !empty($_REQUEST[$name]) ? $this->setDisplayEmptyFeed(true) : $this->setDisplayEmptyFeed(false);
         /*
          * max_item_age
          */
         $name = "rss_aggregator_" . $this->id . "_max_item_age";
         $this->setMaxItemAge($_REQUEST[$name]);
         foreach ($this->content_rss_aggregator_feeds_rows as $feed_row) {
             $this->processFeedAdminUI($feed_row);
             /*
              * Delete feeds
              */
             $name = "rss_aggregator_" . $this->id . "_feed_" . md5($feed_row['url']) . "_delete";
             if (isset($_REQUEST[$name])) {
                 $this->removeFeed($feed_row['url']);
             }
         }
         /*
          * Add new feed
          */
         $name = "rss_aggregator_{$this->id}_feed_add";
         if (!empty($_REQUEST[$name])) {
             $this->addFeed($_REQUEST[$name]);
         }
     }
 }
Example #11
Show file File: ClockinController.php Project: jkzleond/car_mate_local_favour
0
 /**
  * 获取签到信息
  * @param null $user_id
  */
 public function getClockInInfoAction($user_id = null)
 {
     $user = User::getCurrentUser();
     $clock_in = ClockIn::getClockIn($user['user_id']);
     $this->view->setVars(array('row' => $clock_in));
 }
Example #12
Show file File: UserMenu.php Project: rishabhthakur/instagress
0
 protected function renderContent()
 {
     $this->render('userMenu', array('isInstagramUser' => User::model()->isInstagram(Yii::app()->user->id), 'user' => User::getCurrentUser()));
 }
Example #13
Show file File: Content.php Project: soitun/wifidog-auth
0
 /**
  * @see GenericObject
  * @internal Persistent content will not be deleted
  */
 public function delete(&$errmsg)
 {
     $retval = false;
     if ($this->isPersistent()) {
         $errmsg = _("Content is persistent (you must make it non persistent before you can delete it)");
     } else {
         $db = AbstractDb::getObject();
         if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
             $sql = "DELETE FROM content WHERE content_id='{$this->id}'";
             $db->execSqlUpdate($sql, false);
             //Metadata mmust be deleted AFTER the main content.
             $errmsgTmp = null;
             $metadata = $this->getTitle();
             if ($metadata) {
                 $metadata->delete($errmsgTmp);
             }
             $errmsg .= $errmsgTmp;
             $errmsgTmp = null;
             $metadata = $this->getDescription();
             if ($metadata) {
                 $metadata->delete($errmsgTmp);
             }
             $errmsg .= $errmsgTmp;
             $errmsgTmp = null;
             $metadata = $this->getLongDescription();
             if ($metadata) {
                 $metadata->delete($errmsgTmp);
             }
             $errmsg .= $errmsgTmp;
             $errmsgTmp = null;
             $metadata = $this->getProjectInfo();
             if ($metadata) {
                 $metadata->delete($errmsgTmp);
             }
             $errmsg .= $errmsgTmp;
             $retval = true;
         } else {
             $errmsg = _("Access denied (not owner of content)");
         }
     }
     return $retval;
 }
Example #14
Show file File: Langstring.php Project: soitun/wifidog-auth
0
 /**
  * Deletes a Langstring object
  *
  * @param string $errmsg Reference to error message
  *
  * @return bool True if deletion was successful
  * @internal Persistent content will not be deleted
  */
 public function delete(&$errmsg)
 {
     // Init values.
     $_retval = false;
     if ($this->isPersistent()) {
         $errmsg = _("Content is persistent (you must make it non persistent before you can delete it)");
     } else {
         $db = AbstractDb::getObject();
         if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
             $sql = "DELETE FROM content WHERE content_id='{$this->id}'";
             $db->execSqlUpdate($sql, false);
             $_retval = true;
             // Create new cache object.
             $_cache = new Cache('all', $this->id);
             // Check if caching has been enabled.
             if ($_cache->isCachingEnabled) {
                 // Remove old cached data.
                 $_cache->eraseCachedGroupData();
             }
         } else {
             $errmsg = _("Access denied (not owner of content)");
         }
     }
     return $_retval;
 }
Example #15
Show file File: BannerAdGroup.php Project: cnlangzi/wifidog-auth
0
 /**
  * Processes the input of the administration interface for Picture
  *
  * @return void
  */
 public function processAdminUI()
 {
     if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         parent::processAdminUI();
         /* width and height */
         $name = "banner_add_group_{this->getId()}_widthxheight";
         $widthxheight = FormSelectGenerator::getResult($name, null);
         //pretty_print_r($widthxheight);
         $name = "banner_add_group_{this->getId()}_max_width";
         $max_width = $_REQUEST[$name];
         /*max_height*/
         $name = "banner_add_group_{this->getId()}_max_height";
         $max_height = $_REQUEST[$name];
         if (!empty($widthxheight)) {
             $widthxheightArray = explode('/', $widthxheight);
             $max_width_select = $widthxheightArray[0];
             $max_height_select = $widthxheightArray[1];
             if (($max_width_select != $max_width || $max_height_select != $max_height) && ($max_width == $this->getKVP(get_class($this) . '_max_width') && $max_height == $this->getKVP(get_class($this) . '_max_height'))) {
                 /* Width and height weren't manually changed, or were empty */
                 $max_width = $max_width_select;
                 $max_height = $max_height_select;
             }
         }
         $this->setKVP(get_class($this) . '_max_width', $max_width);
         $this->setKVP(get_class($this) . '_max_height', $max_height);
     }
 }
Example #16
Show file File: Vehicle.php Project: rusty1909/Navigator
0
 function getNotifications()
 {
     $db = new Connection();
     $conn = $db->connect();
     $mUser = User::getCurrentUser();
     $companyId = $mUser->getCompany();
     $userId = $mUser->getId();
     $result = array();
     if ($companyId > 0) {
         $sql = "SELECT id FROM notification WHERE vehicle = '{$this->id}' AND company = '{$companyId}' ORDER BY date_added DESC ";
     } else {
         $sql = "SELECT id FROM notification WHERE vehicle = '{$this->id}' AND admin = '{$userId}' ORDER BY date_added DESC ";
     }
     //print_r($sql);
     $action = mysqli_query($conn, $sql);
     if (mysqli_num_rows($action) > 0) {
         // output data of each row
         while ($row = mysqli_fetch_assoc($action)) {
             array_push($result, $row['id']);
         }
     }
     return $result;
 }
Example #17
Show file File: UsersController.php Project: andrelinoge/rezydent
0
 public function actionChangeCurrentPassword()
 {
     $formModel = new ChangePasswordForm();
     $formModel->setUserModel(User::getCurrentUser());
     $this->setModel($formModel);
     if (isPostOrAjaxRequest()) {
         $this->setAjaxResponseSuccessMessage('Пароль змінено');
         $this->setAjaxResponseErrorMessage('Дані введено не вірно!');
         $this->process();
     }
     $this->render('change-password', array('pageTitle' => _('Зміна паролю для поточного користувача'), 'model' => $this->getModel(), 'formId' => $formModel::FORM_ID));
 }
Example #18
Show file File: IFrame.php Project: cnlangzi/wifidog-auth
0
 /**
  * Processes the input of the administration interface for IFrame
  *
  * @return void
  */
 public function processAdminUI()
 {
     if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         parent::processAdminUI();
         // If the URL is not empty
         $name = "iframe_" . $this->id . "_url";
         if (!empty($_REQUEST[$name])) {
             $this->setUrl($_REQUEST[$name]);
         } else {
             $this->setUrl("");
         }
         $name = "iframe_" . $this->id . "_width";
         $this->setWidth(intval($_REQUEST[$name]));
         $name = "iframe_" . $this->id . "_height";
         $this->setHeight(intval($_REQUEST[$name]));
     }
 }
Example #19
Show file File: AnonymisedDataExport.php Project: cnlangzi/wifidog-auth
0
    /** Get the actual report.
     * Classes must override this, but must call the parent's method with what
     * would otherwise be their return value and return that instead.
     * @param $child_html The child method's return value
     * @return A html fragment
     */
    public function getReportUI($child_html = null)
    {
        $db = AbstractDb::getObject();
        $html = '';
        /* User visits */
        // Only Super admin
        if (!User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
            $html .= "<p class='error'>" . _("Access denied") . "</p>";
        } else {
            /** Starting   sql file with geolocation data */
            $tmpdir = sys_get_temp_dir();
            $nodefile = tempnam($tmpdir, 'wd');
            $nfilehndl = fopen($nodefile, 'w');
            $datafile = tempnam($tmpdir, 'wd');
            $datahndl = fopen($datafile, 'w');
            if (!$nfilehndl || !$datahndl) {
                $html .= "<p class='error'>" . _("Could not create files for anonymised data") . "</p>";
            } else {
                /* header('Content-Type: application/octet-stream');
                   header('Content-Disposition: inline; filename="anonymised_nodes.sql"');
                   header("Content-Transfer-Encoding: binary"); */
                $text = <<<EOT
                CREATE TABLE nodes_anonymised
                (
                node_id text NOT NULL,
                latitude  NUMERIC(16, 6),
                longitude  NUMERIC(16, 6)
                );
EOT;
                $text .= "\n";
                fwrite($nfilehndl, $text);
                $node_constraint = $this->stats->getSqlNodeConstraint('nodes.node_id');
                $network_constraint = $this->stats->getSqlNetworkConstraint('nodes.network_id');
                $sql = "SELECT node_id, latitude, longitude \n";
                $sql .= "FROM nodes \n";
                $sql .= "WHERE 1=1 {$node_constraint} {$network_constraint}";
                $db->execSql($sql, $nodes);
                if ($nodes) {
                    foreach ($nodes as $row) {
                        $keys = null;
                        $values = null;
                        $first = true;
                        foreach ($row as $key => $value) {
                            if ($key == 'user_id' || $key == 'node_id' || $key == 'conn_id' || $key == 'user_mac') {
                                $value = "'" . $this->getNonRepeatableHash($value) . "'";
                            } else {
                                if ($key == 'latitude' && empty($value)) {
                                    $value = 'NULL';
                                } else {
                                    if ($key == 'longitude' && empty($value)) {
                                        $value = 'NULL';
                                    } else {
                                        $value = "'{$value}'";
                                    }
                                }
                            }
                            if (!$first) {
                                $keys .= ', ';
                                $values .= ', ';
                            } else {
                                $first = false;
                            }
                            $keys .= $key;
                            $values .= $value;
                        }
                        //fwrite($temp, "INSERT INTO connections_anonymised ($keys) VALUES ($values);\n");
                        fwrite($nfilehndl, "INSERT INTO nodes_anonymised ({$keys}) VALUES ({$values});\n");
                    }
                }
                /** End sql file with node data */
                /** Get the sql file with anonymised connection data */
                /*  header('Content-Type: application/octet-stream');
                    header('Content-Disposition: inline; filename="anonymised_data.sql"');
                    header("Content-Transfer-Encoding: binary");*/
                $text = <<<EOT
                CREATE TABLE connections_anonymised
                (
                conn_id text NOT NULL,
                timestamp_in timestamp,
                node_id text,
                timestamp_out timestamp,
                user_id text NOT NULL DEFAULT '',
                user_mac text,
                incoming int8,
                outgoing int8
                );
EOT;
                $text .= "\n";
                fwrite($datahndl, $text);
                $distinguish_users_by = $this->stats->getDistinguishUsersBy();
                $candidate_connections_sql = $this->stats->getSqlCandidateConnectionsQuery("conn_id, users.user_id, nodes.node_id, connections.user_id, user_mac, timestamp_in, timestamp_out, incoming, outgoing ", true);
                $sql = "{$candidate_connections_sql} ORDER BY timestamp_in DESC";
                $db->execSqlRaw($sql, $resultHandle, false);
                if ($resultHandle) {
                    while ($row = pg_fetch_array($resultHandle, null, PGSQL_ASSOC)) {
                        $keys = null;
                        $values = null;
                        $first = true;
                        foreach ($row as $key => $value) {
                            if ($key == 'user_id' || $key == 'node_id' || $key == 'conn_id' || $key == 'user_mac') {
                                $value = "'" . $this->getNonRepeatableHash($value) . "'";
                            } else {
                                if ($key == 'timestamp_out' && empty($value)) {
                                    $value = 'NULL';
                                } else {
                                    $value = "'{$value}'";
                                }
                            }
                            if (!$first) {
                                $keys .= ', ';
                                $values .= ', ';
                            } else {
                                $first = false;
                            }
                            $keys .= $key;
                            $values .= $value;
                        }
                        //fwrite($temp, "INSERT INTO connections_anonymised ($keys) VALUES ($values);\n");
                        fwrite($datahndl, "INSERT INTO connections_anonymised ({$keys}) VALUES ({$values});\n");
                    }
                }
                fclose($datahndl);
                fclose($nfilehndl);
                $html .= <<<EOS
                <script type="text/javascript">
                \t\twindow.open('/admin/stats.php?file={$nodefile}&type=node', 'Node File');
                \t\twindow.open('/admin/stats.php?file={$datafile}&type=data', 'Data file');
\t\t\t\t\t\t\t\t</script>
EOS;
            }
        }
        return $html;
    }
Example #20
Show file File: ShoutBox.php Project: cnlangzi/wifidog-auth
0
 /**
  * Processes the input of the administration interface for Picture
  *
  * @return void
  */
 public function processAdminUI()
 {
     $db = AbstractDb::getObject();
     if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         parent::processAdminUI();
         /*display_num_items*/
         $name = "shoutbox_{this->getId()}_display_num_items";
         $this->setDisplayNumItems($_REQUEST[$name]);
         /*max_shout_chars*/
         $name = "shoutbox_{this->getId()}_max_num_chars";
         $this->setMaxShoutChars($_REQUEST[$name]);
         /*shout_field_size*/
         $name = "shoutbox_{this->getId()}_shout_field_size";
         $this->setShoutFieldSize($_REQUEST[$name]);
         /* OnclickContent */
         $content = $this->getOnClickContent();
         if (!$content) {
             $name = "shoutbox_" . $this->id . "_onclick_content_new";
             $content = self::processNewContentUI($name);
             $this->setOnClickContent($content);
         } else {
             $name = "shoutbox_" . $this->id . "_onclick_content_erase";
             if (!empty($_REQUEST[$name]) && $_REQUEST[$name] == true) {
                 $this->setOnClickContent(null);
                 $content->delete($errmsg);
             } else {
                 $content->processAdminUI();
             }
         }
     }
 }
Example #21
Show file File: PatternLanguage.php Project: soitun/wifidog-auth
0
 /**
  * Retreives the user interface of this object.
  * @return The HTML fragment for this interface
  */
 public function getUserUI()
 {
     // Init values
     $html = '';
     // Check if the user has already subscribed to Pattern language
     $current_user = User::getCurrentUser();
     if ($current_user == null || $this->isUserSubscribed($current_user) == false) {
         // hyperlink to all users narrative
         $html .= "<ul class='pattern_language_menu'>";
         $html .= "<li><a class='pattern_language_big_links' href='/content/PatternLanguage/subscription.php'>" . _("Subscribe to Pattern Language") . "</a></li>";
         $html .= "<li><a class='pattern_language_big_links' href='/content/PatternLanguage/archives.php'>" . _("Read narratives archives") . "</a></li>";
         $html .= "</ul>";
         // Until subscription is done DO NOT log this !
         $this->setLoggingStatus(false);
         $this->setUserUIMainDisplayContent($html);
         // Tell the content group not to display elements until subscription is done
         $parent_output = parent::getUserUI(true);
     } else {
         /*
          * The user is subscribed to the pattern language show an element!
          * hyperlink to user's narrative
          */
         $html .= "<ul class='pattern_language_menu'>";
         $html .= "<li><a href='/content/PatternLanguage/narrative.php'>" . _("Read my narrative") . "</a></li>";
         $html .= "<li><a href='/content/PatternLanguage/archives.php'>" . _("Read narratives archives") . "</a></li>";
         $html .= "<li><a href='/content/PatternLanguage/subscription.php'>" . _("Unsubscribe") . "</a></li>";
         $html .= "</ul>";
         $this->setUserUIMainDisplayContent($html);
         // Display the random pattern
         $parent_output = parent::getUserUI();
     }
     return $parent_output;
 }
Example #22
Show file File: narrative.php Project: soitun/wifidog-auth
0
    $tool_html .= "<li><a href='/portal/?node_id={$node_id}'>" . _("Go back to this hotspot portal page") . "</a></li>";
}
$tool_html .= '<li><a href="' . BASE_SSL_PATH . 'content/PatternLanguage/index.php?content_id=' . $content_id . '">' . _("About Pattern Language") . '</a><br>' . "\n";
$tool_html .= '<li><a href="' . BASE_SSL_PATH . 'content/PatternLanguage/narrative.php?content_id=' . $content_id . '">' . _("Read narrative") . '</a><br>' . "\n";
$tool_html .= '<li><a href="' . BASE_SSL_PATH . 'content/PatternLanguage/archives.php?content_id=' . $content_id . '">' . _("Archives") . '</a><br>' . "\n";
$tool_html .= '<li><a href="' . BASE_SSL_PATH . 'content/PatternLanguage/hotspots.php?content_id=' . $content_id . '">' . _("Participating hotspots") . '</a><br>' . "\n";
$tool_html .= '<li><a href="' . BASE_SSL_PATH . 'content/PatternLanguage/subscription.php?content_id=' . $content_id . '">' . _("Subscription") . '</a><br>' . "\n";
$tool_html .= '</ul>' . "\n";
$tool_html .= "<div class='pattern_language_credits'>";
$tool_html .= $pattern_language->getSponsorInfo()->__toString();
$tool_html .= "</div>";
// Body
// User's Narrative
try {
    if (empty($_REQUEST['user_id'])) {
        $user = User::getCurrentUser();
    } else {
        $user = User::getObject($_REQUEST['user_id']);
    }
    if ($user) {
        $body_html = "<img src='images/header.gif'>\n";
        $body_html .= "<h1>" . _("Narrative for ") . "{$user->getUsername()}</h1>\n";
        $body_html .= "<div class='pattern_language_body'>\n";
        $body_html .= $pattern_language->displayNarrative($user);
        $body_html .= "</div>\n";
    } else {
        $body_html = "<img src='images/header.gif'><p>\n";
        $body_html .= _("You must be logged in to read your narrative");
    }
} catch (Exception $e) {
    header("Location: archives.php");
Example #23
Show file File: TempController.php Project: jkzleond/car_mate_local_favour
0
    /**
     * 中奖列表页面
     */
    public function winListAction($aid)
    {
        $user = User::getCurrentUser();
        $db = $this->db;
        $get_win_list_sql = <<<SQL
\t\tselect a.name, a.value, convert(varchar(20), ag.winDate, 20) as win_date, ag.randomCode as random_code from AwardGain ag
\t\tleft join Award a on a.id = ag.awid
\t\twhere ag.aid = :aid and ag.userid = :user_id
SQL;
        $get_win_list_bind = array('aid' => $aid, 'user_id' => $user['user_id']);
        $win_list_result = $db->query($get_win_list_sql, $get_win_list_bind);
        $win_list_result->setFetchMode(Db::FETCH_ASSOC);
        $win_list = $win_list_result->fetchAll();
        $this->view->setVar('win_list', $win_list);
    }
Example #24
Show file File: View.php Project: erick305/testing
0
    $this->endWidget();
    ?>
	    
				    
	</div>
<?php 
}
?>
	
			
			
<div id="fullcontent">
<div id="leftside">

<?php 
if (User::getCurrentUser()->id == $job->FK_poster || User::isCurrentUserAdmin()) {
    ?>
	<div id="applicants" style="text-align: left;">
	<div class="titlebox">APPLICANTS</div>
	<div style=clear:both></div>
	<br>
	<?php 
    foreach ($job->applications as $application) {
        ?>
		<?php 
        $applicant = User::getUser($application->userid);
        ?>
		<a  style="margin:0px 10px 0px 10px;; display:block" href="/JobFair/index.php/profile/student/user/<?php 
        echo $applicant->username;
        ?>
"> <img src='/JobFair/images/imgs/user-default.png' height="20" width="20"/> <?php 
Example #25
Show file File: Statistics.php Project: soitun/wifidog-auth
0
 /**
  * Get an interface to pick to which nodes the statistics apply.
  *
  * @return string HTML markup
  *
  * @access private
  */
 private function getSelectedNodesUI()
 {
     $db = AbstractDb::getObject();
     // Init values
     $html = '';
     $name = "selected_nodes[]";
     $user = User::getCurrentUser();
     if (!isset($user)) {
         throw new Exception(_('Access denied!'));
     } else {
         if (!$user->DEPRECATEDisSuperAdmin()) {
             throw new Exception(_('Access denied!'));
         }
     }
     if ($user->DEPRECATEDisSuperAdmin()) {
         $sql_join = '';
     } else {
         $user_id = $db->escapeString($user->getId());
         $sql_join = " JOIN node_stakeholders ON (nodes.node_id=node_stakeholders.node_id AND user_id='{$user_id}') ";
     }
     $selectedNodes = $this->getSelectedNodes();
     $sql = "SELECT nodes.node_id, nodes.name from nodes {$sql_join} WHERE 1=1 ORDER BY lower(nodes.node_id)";
     $userData['preSelectedObjects'] = $selectedNodes;
     $userData['sqlJoin'] = $sql_join;
     $userData['typeInterface'] = "select_multiple";
     $html .= Node::getSelectUI($name, $userData);
     return $html;
 }
Example #26
Show file File: index.php Project: cnlangzi/wifidog-auth
0
/**
 * Load required files
 */
require_once '../include/common.php';
require_once 'classes/Node.php';
require_once 'classes/MainUI.php';
require_once 'classes/Session.php';
$smarty = SmartyWifidog::getObject();
$db = AbstractDb::getObject();
// Init vars
$profile_user = null;
$profile = null;
// Init session
$session = Session::getObject();
// Get the current user
$current_user = User::getCurrentUser();
/*
 * Start general request parameter processing section
 */
if (!empty($_REQUEST['user_id'])) {
    try {
        $profile_user = User::getObject($_REQUEST['user_id']);
        if (!empty($profile_user)) {
            $profiles = $profile_user->getAllProfiles();
            if (!empty($profiles)) {
                $profile = $profiles[0];
            }
        }
    } catch (Exception $e) {
        $ui = MainUI::getObject();
        $ui->displayError($e->getMessage());
Example #27
Show file File: user.php Project: joeymetal/v1
0
 function hasRole($role_name, $force_reload = false)
 {
     if (!isset($this->_activeRecordHasBeenInstantiated)) {
         $User =& User::getCurrentUser();
         return $User->hasRole($role_name, $force_reload);
     }
     $role_name = strtolower($role_name);
     $Roles =& $this->getRoles($force_reload);
     if (!empty($Roles)) {
         foreach (array_keys($Roles) as $k) {
             if (strtolower($Roles[$k]->get('name')) == $role_name) {
                 return true;
             }
         }
     }
     return false;
 }
Example #28
Show file File: Application.php Project: erick305/testing
0
 public static function hasApplied($jobid)
 {
     $user = User::getCurrentUser();
     $application = Application::model()->find("jobid=:jobid AND userid=:userid", array(":jobid" => $jobid, ":userid" => $user->id));
     return $application != null;
 }
Example #29
Show file File: ProfileTemplateField.php Project: cnlangzi/wifidog-auth
0
 /**
  * Deletes a ProfileTemplateField object
  *
  * @param string $errmsg Reference to error message
  *
  * @return bool True if deletion was successful
  * @internal Persistent content will not be deleted
  *
  * @todo Implement proper access control
  */
 public function delete(&$errmsg)
 {
     require_once 'classes/User.php';
     $db = AbstractDb::getObject();
     // Init values
     $_retVal = false;
     if (!User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         $errmsg = _('Access denied (must have super admin access)');
     } else {
         $_id = $db->escapeString($this->getId());
         if (!$db->execSqlUpdate("DELETE FROM profile_template_fields WHERE profile_template_field_id = '{$_id}'", false)) {
             $errmsg = _('Could not delete ProfileTemplateField!');
         } else {
             $_retVal = true;
         }
     }
     return $_retVal;
 }
Example #30
Show file File: File.php Project: cnlangzi/wifidog-auth
0
 /**
  * Processes the input of the administration interface for RssAggregator
  *
  * @return void
  */
 public function processAdminUI()
 {
     //echo "File::processAdminUI()<br/>\n";
     if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         parent::processAdminUI();
         // If no file was uploaded, update filename and mime type
         if (!empty($_REQUEST["file_mode" . $this->getId()])) {
             if ($this->configEnableEditFilename && !empty($_REQUEST["file_file_name" . $this->getId()])) {
                 $this->setFilename($_REQUEST["file_file_name" . $this->getId()]);
             }
             $file_mode = $_REQUEST["file_mode" . $this->getId()];
             if ($file_mode == "by_upload") {
                 if ($this->configEnableEditMimeType && isset($_REQUEST["file_mime_type" . $this->getId()])) {
                     $this->setMimeType($_REQUEST["file_mime_type" . $this->getId()]);
                 }
                 $this->setBinaryDataFromPostVar("file_file_upload" . $this->getId());
                 $this->setURL(null);
                 // Reset the remote file size ( not used )
                 $this->setRemoteFileSize(0);
             } else {
                 if ($file_mode == "remote") {
                     $this->setURL($_REQUEST["file_url" . $this->getId()]);
                     $this->setBinaryDataOid(null);
                     // When switching from local to remote, this field does not exist yet
                     if (isset($_REQUEST["file_old_remote_size" . $this->getId()])) {
                         if ($_REQUEST["file_remote_size" . $this->getId()] != $_REQUEST["file_old_remote_size" . $this->getId()]) {
                             $this->setRemoteFileSize($_REQUEST["file_remote_size" . $this->getId()]);
                         }
                     } else {
                         $this->setRemoteFileSize(0);
                     }
                 }
             }
         }
     }
 }