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


PHP ProjectManager::getInstance方法代码示例

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


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

示例1: executeSave

 protected function executeSave()
 {
     $redirect = $this->getRequestParameter('redirect');
     $id = $this->getRequestParameter();
     $m = $this->getRequestParameter('m', 'array', array());
     try {
         $ex = ProjectManager::getInstance()->getByPk($id, true);
         $ex->addField('oldImage', 'string', $ex->image);
         $ex->updateFromRequest($m);
         if (!$ex->isValid()) {
             throw new EUserMessageError("Ошибка при сохранении", $ex);
         }
         if (!$ex->save()) {
             throw new EUserMessageError("Ошибка при сохранении", $ex);
         }
         $this->setFlash('Данные успешно сохранены', self::$FLASH_SUCCESS);
         $this->setHeader('redirect', fvSite::$fvConfig->get('dir_web_root') . $this->getRequest()->getRequestParameter('module') . ($redirect ? "" : "/edit/?id=" . $ex->getPk()));
     } catch (EUserMessageError $e) {
         $this->setFlash($e->getMessage(), self::$FLASH_ERROR);
         $this->setHeader('X-JSON', json_encode($e->getValidationResult()));
     } catch (EDatabaseError $db) {
         $this->setFlash($db->getMessage(), self::$FLASH_ERROR);
     }
     return $this->getRequest()->isXmlHttpRequest() ? self::$FV_AJAX_CALL : self::$FV_OK;
 }
开发者ID:newnamecomua,项目名称:engineown,代码行数:25,代码来源:action.class.php

示例2: showEdit

 function showEdit()
 {
     $id = $this->getRequestParameter();
     $ex = ProjectManager::getInstance()->getByPk($id, true);
     $this->__assign("tmpDir", fvSite::$fvConfig->get("path.upload.web_temp_image"));
     $this->__assign("ex", $ex);
     $this->__assign("wt", range(-20, 20));
     return $this->__display('edit.tpl');
 }
开发者ID:newnamecomua,项目名称:engineown,代码行数:9,代码来源:module.class.php

示例3: validateUrl

 function validateUrl($value)
 {
     $valid = $this->doValidateEmpty($value);
     if (!$valid) {
         $msg = "Поле обязательное.";
     }
     $inst = ProjectManager::getInstance()->getOneByurl($value);
     if (ProjectManager::getInstance()->isRootInstance($inst) && $inst->getPk() != $this->getPk()) {
         $valid = false;
         $msg = "Поле должно быть уникально.";
     }
     $this->setValidationResult('url', $valid, $msg);
     return $valid;
 }
开发者ID:newnamecomua,项目名称:engineown,代码行数:14,代码来源:project.class.php

示例4: dirname

<?php

/***
* This script is intended to be placed in a cronjob.
* It must be run every Thursday, at 01hOO for example.
* On Unix, you can use crontab -e and place this :
* 00 01 * * 4 /path/php/binary /path/to/your/vcs/dir/doc-editor/scripts/cron/check_entities.php
****/
require_once dirname(__FILE__) . '/../../php/Conf.php';
require_once dirname(__FILE__) . '/../../php/LockFile.php';
require_once dirname(__FILE__) . '/../../php/ProjectManager.php';
require_once dirname(__FILE__) . '/../../php/RepositoryManager.php';
require_once dirname(__FILE__) . '/../../php/ToolsCheckEntities.php';
$rm = RepositoryManager::getInstance();
$pm = ProjectManager::getInstance();
$availableProject = $pm->getAvailableProject();
while (list($key, $project) = each($availableProject)) {
    if ($project['code'] != "php") {
        continue;
    }
    // Define it as a project
    $pm->setProject($project['code']);
    $lock = new LockFile('project_' . $project['code'] . '_lock_check_entities');
    if ($lock->lock()) {
        ToolsCheckEntities::getInstance()->startCheck();
        // Set lastUpdate date/time
        $info = array();
        $info['user'] = 'root';
        $rm->setStaticValue('info', 'checkEntities', json_encode($info), true);
    }
    // Remove the lock File
开发者ID:vrkansagara,项目名称:web-doc-editor,代码行数:31,代码来源:check_entities.php

示例5: getAvailableProject

 /**
  * Get all available project
  */
 public function getAvailableProject()
 {
     $r = ProjectManager::getInstance()->getAvailableProject();
     return JsonResponseBuilder::success(array('nbItems' => count($r), 'Items' => $r));
 }
开发者ID:vrkansagara,项目名称:web-doc-editor,代码行数:8,代码来源:ExtJsController.php

示例6: showIndex

 function showIndex()
 {
     $List = ProjectManager::getInstance()->getAll("is_show=1", "weight asc");
     $this->__assign("List", $List);
     return $this->__display("index.tpl");
 }
开发者ID:newnamecomua,项目名称:engineown,代码行数:6,代码来源:module.class.php

示例7: login

 /**
  * Log into this application.
  *
  * @param $project   The project we want to work on.
  * @param $vcsLogin  The login use to identify this user into PHP VCS server.
  * @param $vcsPasswd The password, in plain text, to identify this user into PHP VCS server.
  * @param $email     The email for this user. Need to contact him via the application.
  * @param $lang      The language we want to access.
  * @return An associated array.
  */
 public function login($project, $vcsLogin, $vcsPasswd, $email, $lang = 'en', $authService = 'VCS', $authServiceID)
 {
     // Var to return into ExtJs
     $return = array();
     // We manage the project
     if (ProjectManager::getInstance()->setProject($project)) {
         $this->project = strtoupper($project);
     } else {
         $return['state'] = false;
         $return['msg'] = 'Bad project';
         $return['authMethod'] = '-';
         return $return;
     }
     $this->authService = $authService;
     $this->authServiceID = $authServiceID;
     /*
      *           VCS AUTH SYSTEM
      *
      */
     if ($this->authService == 'VCS') {
         /*
          *           ANONYMOUS VCS
          *
          */
         // Anonymous's user can logging into this app by providing this login/pass => anonymous/(empty) ou (empty)/(empty)
         // The result is the same. $this->vcsLogin will be "anonymous" and $this->vcsPasswd, (empty)
         if ($vcsLogin == "anonymous" && $vcsPasswd == "" || $vcsLogin == "" && $vcsPasswd == "") {
             $this->isAnonymous = true;
             $this->haveKarma = false;
             // Even if the user provide an empty login, we force it to be 'anonymous'
             $vcsLogin = 'anonymous';
             $this->anonymousIdent = isset($_COOKIE['anonymousIdent']) ? $_COOKIE['anonymousIdent'] : uniqid('', true);
             setcookie("anonymousIdent", $this->anonymousIdent, time() + 3600 * 24 * 365, "/");
             // One year ;)
             // Register var
             $this->vcsLogin = $vcsLogin;
             $this->vcsPasswd = '';
             $this->vcsLang = $lang;
             $this->email = $email;
             // Check DB
             $s = 'SELECT * FROM `users` WHERE `project` = "%s" AND `authService` = "VCS" AND `vcs_login` = "%s" AND `anonymousIdent` = "%s"';
             $params = array($project, $this->vcsLogin, $this->anonymousIdent);
             $r = $this->conn->query($s, $params);
             if ($r->num_rows == 1) {
                 //This anonymous user exist into DB. We store his configuration into ...
                 $a = $r->fetch_object();
                 // ... object's property ...
                 $this->userConf = json_decode($a->conf);
                 $this->userID = $a->userID;
                 // ... and into the php's session (only specific var)
                 $_SESSION['userConf'] = $this->userConf;
                 // We update the email if this user have decided to change it.
                 $this->updateEmail();
             } else {
                 // We register this new valid user
                 $userID = $this->register();
                 $this->userID = $userID;
                 // Store in session only specific var
                 $_SESSION['userConf'] = $this->defaultConf;
             }
             // Generic session var for VALID & ANONYMOUS VCS user
             $_SESSION['userID'] = $this->userID;
             $_SESSION['project'] = $this->project;
             $_SESSION['vcsLogin'] = $this->vcsLogin = $this->vcsLogin . ' #' . $this->userID;
             $_SESSION['vcsPasswd'] = $this->vcsPasswd;
             $_SESSION['isAnonymous'] = $this->isAnonymous;
             $_SESSION['haveKarma'] = $this->haveKarma;
             $_SESSION['anonymousIdent'] = $this->anonymousIdent;
             $_SESSION['lang'] = $this->vcsLang;
             $_SESSION['email'] = $this->email;
             $_SESSION['authService'] = $this->authService;
             $_SESSION['authServiceID'] = $this->authServiceID;
             // We set up the CSRF token
             $_SESSION['csrfToken'] = sha1(uniqid(rand(), true));
             // Store some user info in cookies: we can use this to pre-fill the
             // login page if the user's session expires.
             setcookie("loginApp", 'anonymous', time() + 3600 * 24 * 365, "/");
             // One year ;)
             setcookie("email", $this->email, time() + 3600 * 24 * 365, "/");
             setcookie("lang", $this->vcsLang, time() + 3600 * 24 * 365, "/");
             // We construct the return's var for ExtJs
             $return['state'] = true;
             $return['msg'] = 'Welcome !';
             return $return;
         } else {
             $this->isAnonymous = false;
             $this->anonymousIdent = '';
             // If this app is installed into Php's server, we use the standad way to verify login/password
             if ($_SERVER["SERVER_NAME"] == "doc.php.net") {
                 // We try to authenticate this user to master php server.
//.........这里部分代码省略.........
开发者ID:vrkansagara,项目名称:web-doc-editor,代码行数:101,代码来源:AccountManager.php

示例8: startCheck

 /**
  * Start the check.
  *
  */
 public function startCheck()
 {
     $project = ProjectManager::getInstance()->project;
     $this->cleanUpDatabase();
     $file = $this->getEntitiesContent();
     $array = explode('<!-- Obsoletes -->', $file);
     // Find entity names and URLs
     $schemes_preg = '(?:' . join('|', $this->supportedSchemes) . ')';
     preg_match_all("@<!ENTITY\\s+(\\S+)\\s+([\"'])({$schemes_preg}://[^\\2]+)\\2\\s*>@U", $array[0], $entitiesFound);
     // These are the useful parts
     $this->entityNames = $entitiesFound[1];
     $this->entityUrls = $entitiesFound[3];
     if ($this->forkUrlAllow) {
         // use the forking method ... MUCH faster
         declare (ticks=1);
         $children = 0;
         for ($num = 0; $num < count($this->entityUrls); $num++) {
             $name = $this->entityNames[$num];
             $url = $this->entityUrls[$num];
             if ($children < $this->forkNumAllowed) {
                 $pid = pcntl_fork();
                 if ($pid) {
                     // parent
                     ++$children;
                 } else {
                     // child
                     if (!in_array($name, $this->EntitiesNotChecked)) {
                         $r = $this->checkUrl($num, $url);
                         $query = 'INSERT INTO `checkEntities` (`project`, `entities`, `url`, `result`, `date`)
                             VALUES ("%s", "%s", "%s", "%s", now())';
                         $params = array($project, $name, $url, $r[0]);
                         $this->conn->query($query, $params);
                     }
                     exit;
                 }
             } else {
                 // enough $children
                 $status = 0;
                 $child = pcntl_wait($status);
                 --$children;
             }
         }
         while ($children) {
             $status = 0;
             $child = pcntl_wait($status);
             --$children;
         }
     } else {
         // no forking
         // walk through entities found
         foreach ($this->entityUrls as $num => $entityUrl) {
             if (!in_array($this->entityNames[$num], $this->EntitiesNotChecked)) {
                 $r = $this->checkUrl($num, $entityUrl);
                 $query = 'INSERT INTO `checkEntities` (`project`, `entities`, `url`, `result`, `date`)
                     VALUES ("%s", "%s", "%s", "%s", now())';
                 $params = array($project, $this->entityNames[$num], $entityUrl, $r[0]);
                 $this->conn->query($query, $params);
             }
         }
         ++$num;
         // (for the count)
     }
 }
开发者ID:vrkansagara,项目名称:web-doc-editor,代码行数:67,代码来源:ToolsCheckEntities.php

示例9: trim

            $patchID = trim($_REQUEST['patchID'], '/ ');
            $_project = $_REQUEST['project'];
            require_once dirname(__FILE__) . '/php/ProjectManager.php';
            require_once dirname(__FILE__) . '/php/RepositoryManager.php';
            // Set the project
            ProjectManager::getInstance()->setProject($_project);
            $patchInfo = RepositoryManager::getInstance()->getPatchInfo($patchID);
            $jsVar = "\n" . 'var directAccess = {"link":"patchID", "lang":"en", "patchID":"' . htmlspecialchars($patchID) . '", "patchName":"' . htmlspecialchars($patchInfo->name) . '", "project":"' . htmlspecialchars($_project) . '"},';
        } else {
            if (isset($_REQUEST['action'])) {
                $_project = $_REQUEST['project'];
                $_action = $_REQUEST['action'];
                $_idDB = $_REQUEST['idDB'];
                require_once dirname(__FILE__) . '/php/ProjectManager.php';
                // Set the project
                ProjectManager::getInstance()->setProject($_project);
                $jsVar = "\n" . 'var directAccess = {
        "project":"' . htmlspecialchars($_project) . '",
        "action": "' . htmlspecialchars($_action) . '",
        "idDB": "' . htmlspecialchars($_idDB) . '"
    },';
            } else {
                $jsVar = "\nvar directAccess = false,";
            }
        }
    }
}
// Init auth var
if (isset($_COOKIE['loginApp'])) {
    $jsVar .= " loginApp = \"" . html_entity_decode($_COOKIE['loginApp']) . "\",";
} else {
开发者ID:vrkansagara,项目名称:web-doc-editor,代码行数:31,代码来源:index.php


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