当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::exists方法代码示例

本文整理汇总了PHP中Application::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::exists方法的具体用法?PHP Application::exists怎么用?PHP Application::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Application的用法示例。


在下文中一共展示了Application::exists方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 function index()
 {
     $auth = $this->authenticate();
     if (!$auth) {
         $this->error('401', 'Not logged in.');
         return;
     }
     if ($auth[2] != 'god') {
         $this->error('403', 'Applications can only be authenticated/revoked/listed via the Koken console.');
         return;
     }
     if ($this->method === 'post') {
         $_POST['token'] = koken_rand();
         $a = new Application();
         $a->from_array($_POST, array(), true);
         $this->redirect('/auth/token:' . $auth[1]);
     }
     if ($this->method === 'delete') {
         list($params, $id) = $this->parse_params(func_get_args());
         $a = new Application();
         $a->where('id', $id)->get();
         if ($a->exists()) {
             $a->delete();
             $this->redirect('/auth/token:' . $auth[1]);
         }
     }
     $a = new Application();
     $a->where('role !=', 'god')->get_iterated();
     $apps = array();
     foreach ($a as $app) {
         $apps[] = $app->to_array();
     }
     $this->set_response_data(array('applications' => $apps));
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:34,代码来源:auth.php

示例2: getAppTitle

 /**
  * Get the [app_title] column value.
  * @return     string
  */
 public function getAppTitle()
 {
     $oApplication = new Application();
     if (!$oApplication->exists($this->getAppUid())) {
         return false;
     }
     if ($this->getAppUid() == '') {
         throw new Exception("Error in getAppTitle, the APP_UID can't be blank");
     }
     $lang = defined('SYS_LANG') ? SYS_LANG : 'en';
     $this->app_title = Content::load('APP_TITLE', '', $this->getAppUid(), $lang);
     return $this->app_title;
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:17,代码来源:Application.php

示例3: auth

 public function auth()
 {
     $client_id = $this->input->get('clent_id');
     $application = new Application();
     $application->client_id = $client_id;
     $application->get();
     if (!$application->exists()) {
         $data['title'] = 'Auth Page';
         $data['content'] = 'oauth/noapplication';
         $this->load->view('master', $data);
     } elseif (!$this->user_id) {
         $redirect = 'users/login?redirect_url=oauth/auth?client_id=' . $application->id;
         redirect($redirect);
     } elseif ($this->input->post()) {
         $allow = $this->input->post('allow');
         if ($allow) {
             $user = new User($this->user_id);
             $existing_token = new Token();
             $existing_token->where('user_id', $user->id);
             $existing_token->where('application_id', $application->id);
             $existing_token->get();
             if ($existing_token->exists()) {
                 $existing_token->delete();
             }
             $token = $this->generate_token();
             $token->save(array($application, $user));
             die;
             echo 'here';
         }
     } else {
         $this->load->helper('form');
         $data['application'] = array('id' => $application->id, 'name' => $application->name, 'client_id' => $application->client_id, 'client_secret' => $application->client_secret, 'redirect_url' => $application->redirect_url);
         $data['title'] = 'Auth Page';
         $data['content'] = 'oauth/authorize';
         $this->load->view('master', $data);
     }
 }
开发者ID:petersonb,项目名称:ourvigor,代码行数:37,代码来源:oauth.php

示例4: Application

<?php

$a = new Application();
$a->where('token', '69ad71aa4e07e9338ac49d33d041941b')->get();
if ($a->exists()) {
    $a->delete();
}
$done = true;
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:8,代码来源:0008.php

示例5: updateCase

    public function updateCase($sAppUid, $Fields = array())

    {

        try {

            $dynContentHistory = "";

            if (isset($Fields["APP_DATA"]) && isset($Fields["APP_DATA"]["DYN_CONTENT_HISTORY"])) {

                $dynContentHistory = $Fields["APP_DATA"]["DYN_CONTENT_HISTORY"];

                unset($Fields["APP_DATA"]["DYN_CONTENT_HISTORY"]);

            }

            $oApplication = new Application;

            if (!$oApplication->exists($sAppUid)) {

                return false;

            }

            $aApplicationFields = $Fields['APP_DATA'];

            $Fields['APP_UID'] = $sAppUid;

            $Fields['APP_UPDATE_DATE'] = 'now';

            $Fields['APP_DATA'] = serialize($Fields['APP_DATA']);

            /*

              $oApp = new Application;

              $appFields = $oApp->load($sAppUid);

             */

            $oApp = ApplicationPeer::retrieveByPk($sAppUid);

            $appFields = $oApp->toArray(BasePeer::TYPE_FIELDNAME);

            if (isset($Fields['APP_TITLE'])) {

                $appFields['APP_TITLE'] = $Fields['APP_TITLE'];

            }

            if (isset($Fields['APP_DESCRIPTION'])) {

                $appFields['APP_DESCRIPTION'] = $Fields['APP_DESCRIPTION'];

            }



            $arrayNewCaseTitleAndDescription = $this->newRefreshCaseTitleAndDescription($sAppUid, $appFields, $aApplicationFields);



            //Start: Save History --By JHL

            if (isset($Fields['CURRENT_DYNAFORM'])) {

                //only when that variable is set.. from Save

                $FieldsBefore = $this->loadCase($sAppUid);

                $FieldsDifference = $this->arrayRecursiveDiff($FieldsBefore['APP_DATA'], $aApplicationFields);

                $fieldsOnBoth = @array_intersect_assoc($FieldsBefore['APP_DATA'], $aApplicationFields);

                //Add fields that weren't in previous version

                foreach ($aApplicationFields as $key => $value) {

                    if (!(isset($fieldsOnBoth[$key]))) {

                        $FieldsDifference[$key] = $value;

                    }

                }

                if ((is_array($FieldsDifference)) && (count($FieldsDifference) > 0)) {

                    //There are changes

                    $Fields['APP_STATUS'] = (isset($Fields['APP_STATUS'])) ? $Fields['APP_STATUS'] : $FieldsBefore['APP_STATUS'];

                    $appHistory = new AppHistory();

                    $aFieldsHistory = $Fields;

                    $FieldsDifference['DYN_CONTENT_HISTORY'] = $dynContentHistory;

                    $aFieldsHistory['APP_DATA'] = serialize($FieldsDifference);

//.........这里部分代码省略.........
开发者ID:nhenderson,项目名称:processmaker,代码行数:101,代码来源:class.case.php

示例6: refreshCaseLabel

 public function refreshCaseLabel($sAppUid, $aAppData, $sLabel)
 {
     $getAppLabel = "getApp{$sLabel}";
     $getTasDef = "getTasDef{$sLabel}";
     $oApplication = new Application();
     if (!$oApplication->exists($sAppUid)) {
         return null;
     } else {
         $oApplication->load($sAppUid);
         $appLabel = $oApplication->{$getAppLabel}();
     }
     $cri = new Criteria();
     $cri->add(AppDelegationPeer::APP_UID, $sAppUid);
     $cri->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN");
     $currentDelegations = AppDelegationPeer::doSelect($cri);
     for ($r = count($currentDelegations) - 1; $r >= 0; $r--) {
         $task = TaskPeer::retrieveByPk($currentDelegations[$r]->getTasUid());
         $caseLabel = $task->{$getTasDef}();
         if ($caseLabel != '') {
             $appLabel = G::replaceDataField($caseLabel, $aAppData);
             break;
         }
     }
     return $appLabel;
 }
开发者ID:rodrigoivan,项目名称:processmaker,代码行数:25,代码来源:class.case.php

示例7: getCompleteDocumentInfo

    public function getCompleteDocumentInfo ($appUid, $appDocUid, $docVersion, $docUid, $usrId)
    {
        //require_once ("classes/model/AppDocument.php");
        //require_once ("classes/model/InputDocument.php");
        //require_once ("classes/model/OutputDocument.php");
        //require_once ("classes/model/Users.php");

        //**** start get Doc Info
        $oApp = new Application();
        $oAppDocument = new AppDocument();
        G::LoadClass( 'case' );
        $oCase = new Cases();
        G::LoadClass( 'process' );
        $oProcess = new Process();
        if (($oApp->exists( $appUid )) || ($appUid == "00000000000000000000000000000000")) {
            if ($appUid == "00000000000000000000000000000000") {
                //External Files
                $row1 = $oAppDocument->load( $appDocUid, $docVersion );
                $row2 = array ('PRO_TITLE' => G::LoadTranslation( 'ID_NOT_PROCESS_RELATED' ));
                $row3 = array ('APP_TITLE' => G::LoadTranslation( 'ID_NOT_PROCESS_RELATED' ));
            } else {
                $row1 = $oAppDocument->load( $appDocUid, $docVersion );
                $row2 = $oCase->loadCase( $appUid );
                $row3 = $oProcess->Load( $row2['PRO_UID'] );
            }
            $lastVersion = $oAppDocument->getLastAppDocVersion( $appDocUid, $appUid );

            switch ($row1['APP_DOC_TYPE']) {
                case "OUTPUT":
                    $oOutputDocument = new OutputDocument();

                    $row4 = array();
                    $swOutDocExists = 0;

                    if ($oOutputDocument->OutputExists($docUid)) {
                        $row4 = $oOutputDocument->load($docUid);
                        $swOutDocExists = 1;
                    }

                    if ($swOutDocExists == 0) {
                        $swpdf = 0;
                        $swdoc = 0;

                        $info = pathinfo($oAppDocument->getAppDocFilename());

                        $version = (!empty($docVersion))? "_" . $docVersion : "_1";
                        $outDocPath = PATH_DOCUMENT . G::getPathFromUID($row1["APP_UID"]) . PATH_SEP . "outdocs" . PATH_SEP;

                        if (file_exists($outDocPath . $appDocUid . $version . ".pdf") ||
                            file_exists($outDocPath . $info["basename"] . $version . ".pdf") ||
                            file_exists($outDocPath . $info["basename"] . ".pdf")
                        ) {
                            $swpdf = 1;
                        }

                        if (file_exists($outDocPath . $appDocUid . $version . ".doc") ||
                            file_exists($outDocPath . $info["basename"] . $version . ".doc") ||
                            file_exists($outDocPath . $info["basename"] . ".doc")
                        ) {
                            $swdoc = 1;
                        }

                        if ($swpdf == 1 && $swdoc == 1) {
                            $row4["OUT_DOC_GENERATE"] = "BOTH";
                        } else {
                            if ($swpdf == 1) {
                                $row4["OUT_DOC_GENERATE"] = "PDF";
                            } else {
                                if ($swdoc == 1) {
                                    $row4["OUT_DOC_GENERATE"] = "DOC";
                                } else {
                                    $row4["OUT_DOC_GENERATE"] = "NOFILE";
                                }
                            }
                        }
                    }

                    $versioningEnabled = false; //$row4['OUT_DOC_VERSIONING']; //Only enabled for Input or Attached documents. Need to study the best way for Output docs.

                    switch ($row4['OUT_DOC_GENERATE']) {
                        case "PDF":
                            $downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=pdf" . "&random=" . rand();
                            $downloadLink1 = "";
                            $downloadLabel = ".pdf";
                            $downloadLabel1 = "";
                            break;
                        case "DOC":
                            $downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=doc" . "&random=" . rand();
                            $downloadLink1 = "";
                            $downloadLabel = ".doc";
                            $downloadLabel1 = "";
                            break;
                        case "BOTH":
                            $downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=pdf" . "&random=" . rand();
                            $downloadLink1 = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=doc" . "&random=" . rand();
                            $downloadLabel = ".pdf";
                            $downloadLabel1 = ".doc";
                            break;
                        case "NOFILE":
                            $downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion;
//.........这里部分代码省略.........
开发者ID:rrsc,项目名称:processmaker,代码行数:101,代码来源:AppFolder.php

示例8: has

 /**
  * @param string $n
  * @return bool
  */
 public static function has($n)
 {
     return Application::exists($n);
 }
开发者ID:Tanklong,项目名称:openvj,代码行数:8,代码来源:ContainerTrait.php

示例9: authenticate

 function authenticate($require_king = false)
 {
     $token = false;
     $cookie = false;
     $cookie_auth = isset($_SERVER['HTTP_X_KOKEN_AUTH']) && $_SERVER['HTTP_X_KOKEN_AUTH'] === 'cookie';
     $this->load->helper('cookie');
     if (isset($_COOKIE['koken_session_ci']) && $cookie_auth) {
         $token = $this->session->userdata('token');
         if ($token) {
             $cookie = true;
         }
     } else {
         if (isset($_COOKIE['koken_session']) && !$this->strict_cookie_auth) {
             $cookie = unserialize($_COOKIE['koken_session']);
             $token = $cookie['token'];
         } else {
             if ($this->method == 'get' && preg_match("/token:([a-zA-Z0-9]{32})/", $this->uri->uri_string(), $matches)) {
                 // TODO: deprecate this in favor of X-KOKEN-TOKEN
                 $token = $matches[1];
             } else {
                 if (isset($_REQUEST['token'])) {
                     $token = $_REQUEST['token'];
                 } else {
                     if (isset($_SERVER['HTTP_X_KOKEN_TOKEN'])) {
                         $token = $_SERVER['HTTP_X_KOKEN_TOKEN'];
                     }
                 }
             }
         }
     }
     if ($token && $token === $this->config->item('encryption_key')) {
         return true;
     } else {
         if ($token) {
             $a = new Application();
             $a->where('token', $token)->limit(1)->get();
             if ($a->exists()) {
                 if ($a->role === 'god' && $this->strict_cookie_auth) {
                     if (!$cookie) {
                         return false;
                     }
                 } else {
                     if ($a->single_use) {
                         $a->delete();
                     }
                 }
                 return array($a->user_id, $token, $a->role);
             }
         } else {
             if ($cookie_auth && get_cookie('remember_me')) {
                 $remember_token = get_cookie('remember_me');
                 $u = new User();
                 $u->where('remember_me', $remember_token)->get();
                 if ($u->exists()) {
                     $token = $u->create_session($this->session, true);
                     return array($u->id, $token, 'god');
                 }
             }
         }
     }
     return false;
 }
开发者ID:Caldis,项目名称:htdocs,代码行数:62,代码来源:Koken_Controller.php

示例10: appUid

 /**
  * Validate app_uid
  *
  * @param string $app_uid, Uid for application
  * @param string $nameField . Name of field for message
  *
  * @access public
  * @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
  * @copyright Colosa - Bolivia
  *
  * @return string
  */
 public static function appUid($app_uid, $nameField = 'app_uid')
 {
     $app_uid = trim($app_uid);
     if ($app_uid == '') {
         throw new \Exception(\G::LoadTranslation("ID_APPLICATION_NOT_EXIST", array($nameField, '')));
     }
     $oApplication = new \Application();
     if (!$oApplication->exists($app_uid)) {
         throw new \Exception(\G::LoadTranslation("ID_APPLICATION_NOT_EXIST", array($nameField, $app_uid)));
     }
     return $app_uid;
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:24,代码来源:Validator.php


注:本文中的Application::exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。