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


PHP G::verifyPath方法代码示例

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


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

示例1: render

 public function render($width = 300)
 {
     $self->url = $this->urlFrom;
     $self->rss = @simplexml_load_file($self->url);
     if ($self->rss) {
         $index = 0;
         $render = '';
         $self->items = $self->rss->channel->item;
         if (count($self->rss->channel) != 0) {
             $status = 'true';
             foreach ($self->items as $self->item) {
                 $self->title = $self->item->title;
                 $self->link = $self->item->link;
                 $self->des = $self->item->description;
                 $render[] = array('link' => '<a href="' . $self->link . '" target="_blank">' . $self->title . '</a><br/>', 'description' => $self->des . '<br/><hr>');
                 $index++;
             }
         } else {
             $status = 'Error';
             $render[] = array('link' => 'Error', 'description' => "Unable to parse XML");
         }
     } else {
         $status = 'Error';
         $render[] = array('link' => 'Error', 'description' => "Unable to parse XML");
     }
     G::verifyPath(PATH_SMARTY_C, true);
     $smarty = new Smarty();
     $smarty->template_dir = PATH_CORE . 'templates/dashboard/';
     $smarty->compile_dir = PATH_SMARTY_C;
     try {
         $smarty->assign('url', $this->urlFrom);
         $smarty->assign('render', $render);
         $smarty->assign('status', $status);
     } catch (Exception $ex) {
         print $item->key;
     }
     $smarty->display('dashletRssReaderTemplate.html', null, null);
 }
开发者ID:nshong,项目名称:processmaker,代码行数:38,代码来源:class.dashletRssReader.php

示例2: saveLog

function saveLog($sSource, $sType, $sDescription)
{
    try {
        global $sObject;
        global $isDebug;
        if ($isDebug) {
            print date("H:i:s") . " ({$sSource}) {$sType} {$sDescription} <br />\n";
        }
        G::verifyPath(PATH_DATA . "log" . PATH_SEP, true);
        //setExecutionMessage( PATH_DATA."log".PATH_SEP);
        $oFile = @fopen(PATH_DATA . "log" . PATH_SEP . "cron.log", "a+");
        @fwrite($oFile, date("Y-m-d H:i:s") . " | {$sObject} | " . $sSource . " | {$sType} | " . $sDescription . "\n");
        @fclose($oFile);
    } catch (Exception $e) {
        //CONTINUE
    }
}
开发者ID:ralpheav,项目名称:processmaker,代码行数:17,代码来源:cron_single.php

示例3: _default

 private function _default()
 {
     require_once PATH_THIRDPARTY . 'smarty/libs/Smarty.class.php';
     // put full path to Smarty.class.php
     global $G_ENABLE_BLANK_SKIN;
     //menu
     global $G_PUBLISH;
     global $G_MAIN_MENU;
     global $G_SUB_MENU;
     global $G_MENU_SELECTED;
     global $G_SUB_MENU_SELECTED;
     global $G_ID_MENU_SELECTED;
     global $G_ID_SUB_MENU_SELECTED;
     G::verifyPath(PATH_SMARTY_C, true);
     G::verifyPath(PATH_SMARTY_CACHE, true);
     $smarty = new Smarty();
     $oHeadPublisher =& headPublisher::getSingleton();
     $smarty->compile_dir = PATH_SMARTY_C;
     $smarty->cache_dir = PATH_SMARTY_CACHE;
     $smarty->config_dir = PATH_THIRDPARTY . 'smarty/configs';
     //To setup en extJS Theme for this Skin
     G::LoadClass('serverConfiguration');
     $oServerConf =& serverConf::getSingleton();
     $extSkin = $oServerConf->getProperty("extSkin");
     if (!$extSkin) {
         $extSkin = array();
     }
     $extSkin[SYS_SKIN] = "xtheme-gray";
     $oServerConf->setProperty("extSkin", $extSkin);
     //End of extJS Theme setup
     if (isset($G_ENABLE_BLANK_SKIN) && $G_ENABLE_BLANK_SKIN) {
         $smarty->template_dir = $this->layoutFileBlank['dirname'];
         $smarty->force_compile = $this->forceTemplateCompile;
         $smarty->display($layoutFileBlank['basename']);
     } else {
         $smarty->template_dir = $this->layoutFile['dirname'];
         $meta = null;
         $header = null;
         if (preg_match("/^.*\\(.*MSIE (\\d+)\\..+\\).*\$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch)) {
             $ie = intval($arrayMatch[1]);
             if ($ie == 10) {
                 $ie = 8;
                 $meta = "<meta http-equiv=\"X-UA-Compatible\" content=\"IE={$ie}\" />";
             }
         }
         if (isset($oHeadPublisher)) {
             if (defined('SYS_SYS')) {
                 $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . SYS_SYS . ')' : '';
             }
             $header = $oHeadPublisher->printHeader();
             $header .= $oHeadPublisher->getExtJsStylesheets($this->cssFileName);
         }
         $smarty->assign("meta", $meta);
         $smarty->assign("header", $header);
         $footer = '';
         if (strpos($_SERVER['REQUEST_URI'], '/login/login') !== false) {
             $freeOfChargeText = "";
             if (!defined('SKIP_FREE_OF_CHARGE_TEXT')) {
                 $freeOfChargeText = "Supplied free of charge with no support, certification, warranty, <br>maintenance nor indemnity by Colosa and its Certified Partners.";
             }
             if (class_exists('pmLicenseManager')) {
                 $freeOfChargeText = "";
             }
             $fileFooter = PATH_SKINS . SYS_SKIN . PATH_SEP . 'footer.html';
             if (file_exists($fileFooter)) {
                 $footer .= file_get_contents($fileFooter);
             } else {
                 $fileFooter = PATH_SKIN_ENGINE . SYS_SKIN . PATH_SEP . 'footer.html';
                 if (file_exists($fileFooter)) {
                     $footer .= file_get_contents($fileFooter);
                 } else {
                     $fileFooter = PATH_CUSTOM_SKINS . SYS_SKIN . PATH_SEP . 'footer.html';
                     if (file_exists($fileFooter)) {
                         $footer .= file_get_contents($fileFooter);
                     } else {
                         $footer .= "<br />Copyright &copy; 2003-" . date('Y') . " <a href=\"http://www.colosa.com\" alt=\"Colosa, Inc.\" target=\"_blank\">Colosa, Inc.</a> All rights reserved.<br /> {$freeOfChargeText} " . "<br><br/><a href=\"http://www.processmaker.com\" alt=\"Powered by ProcessMaker - Open Source Workflow & Business Process Management (BPM) Management Software\" title=\"Powered by ProcessMaker\" target=\"_blank\"></a>";
                     }
                 }
             }
         }
         $oMenu = new Menu();
         $menus = $oMenu->generateArrayForTemplate($G_MAIN_MENU, 'SelectedMenu', 'mainMenu', $G_MENU_SELECTED, $G_ID_MENU_SELECTED);
         $smarty->assign('menus', $menus);
         $oSubMenu = new Menu();
         $subMenus = $oSubMenu->generateArrayForTemplate($G_SUB_MENU, 'selectedSubMenu', 'subMenu', $G_SUB_MENU_SELECTED, $G_ID_SUB_MENU_SELECTED);
         $smarty->assign('subMenus', $subMenus);
         if (!defined('NO_DISPLAY_USERNAME')) {
             define('NO_DISPLAY_USERNAME', 0);
         }
         if (NO_DISPLAY_USERNAME == 0) {
             $switch_interface = isset($_SESSION['user_experience']) && $_SESSION['user_experience'] == 'SWITCHABLE';
             $smarty->assign('user_logged', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '');
             $smarty->assign('tracker', SYS_COLLECTION == 'tracker' ? $G_PUBLISH->Parts[0]['File'] != 'tracker/login' ? true : '' : '');
             $smarty->assign('switch_interface', $switch_interface);
             $smarty->assign('switch_interface_label', G::LoadTranslation('ID_SWITCH_INTERFACE'));
             $smarty->assign('rolename', isset($_SESSION['USR_ROLENAME']) ? $_SESSION['USR_ROLENAME'] . '' : '');
             $smarty->assign('pipe', isset($_SESSION['USR_USERNAME']) ? ' | ' : '');
             $smarty->assign('logout', G::LoadTranslation('ID_LOGOUT'));
             $smarty->assign('workspace', defined('SYS_SYS') ? SYS_SYS : '');
             $uws = isset($_SESSION['USR_ROLENAME']) && $_SESSION['USR_ROLENAME'] != '' ? strtolower(G::LoadTranslation('ID_WORKSPACE_USING')) : G::LoadTranslation('ID_WORKSPACE_USING');
//.........这里部分代码省略.........
开发者ID:bqevin,项目名称:processmaker,代码行数:101,代码来源:skinEngine.php

示例4: uploadFile

 /**
  * Upload a file and then copy to path+ nameToSave
  *
  * @author Mauricio Veliz <mauricio@colosa.com>
  * @access public
  * @param string $file
  * @param string $path
  * @param string $nameToSave
  * @param integer $permission
  * @return void
  */
 public static function uploadFile($file, $path, $nameToSave, $permission = 0755)
 {
     try {
         if ($file == '') {
             throw new Exception('The filename is empty!');
         }
         if (filesize($file) > (ini_get('upload_max_filesize') + 0) * 1024 * 1024) {
             throw new Exception('The size of upload file exceeds the allowed by the server!');
         }
         $oldumask = umask(0);
         if (!is_dir($path)) {
             G::verifyPath($path, true);
         }
         if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
             $file = str_replace("\\\\", "\\", $file, $count);
             if (!$count) {
                 $winPath = explode("\\", $file);
                 $file = "";
                 foreach ($winPath as $k => $v) {
                     if ($v != "") {
                         $file .= $v . "\\";
                     }
                 }
                 $file = substr($file, 0, -1);
             }
         }
         G::LoadSystem('inputfilter');
         $filter = new InputFilter();
         $file = $filter->validateInput($file, "path");
         $path = $filter->validateInput($path, "path");
         move_uploaded_file($file, $path . "/" . $nameToSave);
         $nameToSave = $filter->validateInput($nameToSave, "path");
         @chmod($path . "/" . $nameToSave, $permission);
         umask($oldumask);
     } catch (Exception $oException) {
         throw $oException;
     }
 }
开发者ID:nhenderson,项目名称:processmaker,代码行数:49,代码来源:class.g.php

示例5: rename

 /**
  * With this function we can rename a files
  * @param string $sSouce
  * @param string $sTarget
  * @param string $bSourceAbsolutePath
  * @param string $bTargetAbsolutePath
  * @return void
  */
 public function rename($sSouce, $sTarget, $bSourceAbsolutePath = false, $bTargetAbsolutePath = false)
 {
     if (!$bSourceAbsolutePath) {
         $sSouce = PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . $sSouce;
     }
     if (!$bTargetAbsolutePath) {
         $sTarget = PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . $sTarget;
     }
     G::verifyPath(dirname($sTarget), true);
     @chmod(dirname($sTarget), 0777);
     @rename($sSouce, $sTarget);
 }
开发者ID:bqevin,项目名称:processmaker,代码行数:20,代码来源:class.plugin.php

示例6: casesShowOuputDocumentExist

    }
    $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
    $rs->next();
    $totalCount = 0;
    for ($j = 0; $j < $rs->getRecordCount(); $j++) {
        $result = $rs->getRow();
        $result["FILEDOCEXIST"] = casesShowOuputDocumentExist($result["FILEDOC"]);
        $result["FILEPDFEXIST"] = casesShowOuputDocumentExist($result["FILEPDF"]);
        $aProcesses[] = $result;
        $rs->next();
        $totalCount++;
    }
    //!dateFormat
    G::LoadClass('configuration');
    $conf = new Configurations();
    try {
        $generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', '');
    } catch (Exception $e) {
        $generalConfCasesList = array();
    }
    $dateFormat = "";
    if (isset($generalConfCasesList['casesListDateFormat']) && !empty($generalConfCasesList['casesListDateFormat'])) {
        $dateFormat = $generalConfCasesList['casesListDateFormat'];
    }
    $newDir = '/tmp/test/directory';
    $r = G::verifyPath($newDir);
    $r->data = $aProcesses;
    $r->totalCount = $totalCount;
    $r->dataFormat = $dateFormat;
    echo G::json_encode($r);
}
开发者ID:ralpheav,项目名称:processmaker,代码行数:31,代码来源:casesGenerateDocumentPage_Ajax.php

示例7: getProcessFiles

    public function getProcessFiles ($proUid, $type)

    {

        $filesList = array ();



        switch ($type) {

            case "mail":

            case "email":

                $basePath = PATH_DATA_MAILTEMPLATES;

                break;

            case "public":

                $basePath = PATH_DATA_PUBLIC;

                break;

            default:

                throw new Exception( "Unknow Process Files Type \"$type\"." );

                break;

        }



        $dir = $basePath . $proUid . PATH_SEP;



        G::verifyPath( $dir, true ); //Create if it does not exist





        //Creating the default template (if not exists)

        if (! file_exists( $dir . "alert_message.html" )) {

            @copy( PATH_TPL . "mails" . PATH_SEP . "alert_message.html", $dir . "alert_message.html" );

        }



        if ( (!file_exists( $dir . "unassignedMessage.html")) && file_exists($dir . G::LoadTranslation('ID_UNASSIGNED_MESSAGE'))) {

            if (defined('PARTNER_FLAG')) {

                @copy( PATH_TPL . "mails" . PATH_SEP . "unassignedMessagePartner.html", $dir . G::LoadTranslation('ID_UNASSIGNED_MESSAGE'));

            } else {

                @copy( PATH_TPL . "mails" . PATH_SEP . "unassignedMessage.html", $dir . G::LoadTranslation('ID_UNASSIGNED_MESSAGE'));

            }

        }



        $files = glob( $dir . "*.*" );



        foreach ($files as $file) {

            $fileName = basename( $file );



            if ($fileName != "alert_message.html" && $fileName != G::LoadTranslation('ID_UNASSIGNED_MESSAGE')) {

                $filesList[] = array ("filepath" => $file,"filename" => $fileName);

            }

        }

        return $filesList;

    }
开发者ID:rrsc,项目名称:processmaker,代码行数:91,代码来源:class.processes.php

示例8: array

                break;
        }
        $paramBCC[] = array('id' => replaceQuotes($item), 'name' => $value);
    }
    $_DBArray['eventomsgbcc'] = $paramBCC;
} else {
    $_DBArray['eventomsgbcc'] = array();
}
$aFields['EVN_MESSAGE_TO_TO'] = $paramTO;
$aFields['EVN_MESSAGE_TO_CC'] = isset($parameters->CC) ? $paramCC : '';
$aFields['EVN_MESSAGE_TO_BCC'] = isset($parameters->BCC) ? $paramBCC : '';
$aFields['EVN_MESSAGE_TEMPLATE'] = isset($parameters->TEMPLATE) ? $parameters->TEMPLATE : '';
$aTemplates = array();
$aTemplates[] = array('TEMPLATE1' => 'char', 'TEMPLATE2' => 'char');
$sDirectory = PATH_DATA_MAILTEMPLATES . $aFields['PRO_UID'] . PATH_SEP;
G::verifyPath($sDirectory, true);
if (!file_exists($sDirectory . 'alert_message.html')) {
    @copy(PATH_TPL . 'mails' . PATH_SEP . 'alert_message.html', $sDirectory . 'alert_message.html');
}
$oDirectory = dir($sDirectory);
while ($sObject = $oDirectory->read()) {
    if ($sObject !== '.' && $sObject !== '..' && $sObject !== 'alert_message.html') {
        $aTemplates[] = array('TEMPLATE1' => $sObject, 'TEMPLATE2' => $sObject);
    }
}
$_DBArray['templates'] = $aTemplates;
$aTriggers[] = array('TRI_UID' => 'char', 'TRI_TITLE' => 'char');
G::LoadClass('processMap');
$oProcessMap = new ProcessMap();
$oDataset = TriggersPeer::doSelectRS($oProcessMap->getTriggersCriteria($aFields['PRO_UID']));
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
开发者ID:bqevin,项目名称:processmaker,代码行数:31,代码来源:eventsEditAction.php

示例9: sendNotifications


//.........这里部分代码省略.........
         }
         //erik: new behaviour for messages
         G::loadClass('configuration');
         $oConf = new Configurations();
         $oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aTaskInfo['TAS_UID'], '', '');
         $conf = $oConf->aConfig;
         $pathEmail = PATH_DATA_SITE . "mailTemplates" . PATH_SEP . $aTaskInfo["PRO_UID"] . PATH_SEP;
         $swtplDefault = 0;
         $sBody = null;
         if (isset($conf["TAS_DEF_MESSAGE_TYPE"]) && isset($conf["TAS_DEF_MESSAGE_TEMPLATE"]) && $conf["TAS_DEF_MESSAGE_TYPE"] == "template" && $conf["TAS_DEF_MESSAGE_TEMPLATE"] != "") {
             if ($conf["TAS_DEF_MESSAGE_TEMPLATE"] == "alert_message.html") {
                 $swtplDefault = 1;
             }
             $fileTemplate = $pathEmail . $conf["TAS_DEF_MESSAGE_TEMPLATE"];
             if (!file_exists($fileTemplate)) {
                 throw new Exception("Template file \"{$fileTemplate}\" does not exist.");
             }
             $sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $aFields);
         } else {
             $sBody = nl2br(G::replaceDataGridField($aTaskInfo["TAS_DEF_MESSAGE"], $aFields));
         }
         G::LoadClass("tasks");
         G::LoadClass("groups");
         G::LoadClass("spool");
         $task = new Tasks();
         $group = new Groups();
         $oUser = new Users();
         foreach ($aTasks as $aTask) {
             $sTo = null;
             $sCc = null;
             switch ($aTask["TAS_ASSIGN_TYPE"]) {
                 case "SELF_SERVICE":
                     if ($swtplDefault == 1) {
                         G::verifyPath($pathEmail, true);
                         //Create if it does not exist
                         $fileTemplate = $pathEmail . "unassignedMessage.html";
                         if (!file_exists($fileTemplate)) {
                             @copy(PATH_TPL . "mails" . PATH_SEP . "unassignedMessage.html", $fileTemplate);
                         }
                         $sBody = G::replaceDataField(file_get_contents($fileTemplate), $aFields);
                     }
                     if (isset($aTask["TAS_UID"]) && !empty($aTask["TAS_UID"])) {
                         $arrayTaskUser = array();
                         $arrayAux1 = $task->getGroupsOfTask($aTask["TAS_UID"], 1);
                         foreach ($arrayAux1 as $arrayGroup) {
                             $arrayAux2 = $group->getUsersOfGroup($arrayGroup["GRP_UID"]);
                             foreach ($arrayAux2 as $arrayUser) {
                                 $arrayTaskUser[] = $arrayUser["USR_UID"];
                             }
                         }
                         $arrayAux1 = $task->getUsersOfTask($aTask["TAS_UID"], 1);
                         foreach ($arrayAux1 as $arrayUser) {
                             $arrayTaskUser[] = $arrayUser["USR_UID"];
                         }
                         $criteria = new Criteria("workflow");
                         $criteria->addSelectColumn(UsersPeer::USR_UID);
                         $criteria->addSelectColumn(UsersPeer::USR_USERNAME);
                         $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
                         $criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
                         $criteria->addSelectColumn(UsersPeer::USR_EMAIL);
                         $criteria->add(UsersPeer::USR_UID, $arrayTaskUser, Criteria::IN);
                         $rsCriteria = UsersPeer::doSelectRs($criteria);
                         $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
                         $to = null;
                         $cc = null;
                         $sw = 1;
开发者ID:rodrigoivan,项目名称:processmaker,代码行数:67,代码来源:class.case.php

示例10: setPartner

    /**

     * set_partner

     *

     * @return void

     */

    public function setPartner()

    {

        $partnerFlag = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : false;

        if ($partnerFlag) {

            // Execute sql for partner

            $pathMysqlPartner = PATH_CORE . 'data' . PATH_SEP . 'partner' . PATH_SEP . 'mysql' . PATH_SEP;

            if (G::verifyPath($pathMysqlPartner)) {

                $res = array();

                $filesSlq = glob($pathMysqlPartner . '*.sql');

                foreach ($filesSlq as $value) {

                    $this->query_sql_file($value, $this->connection_database);

                }

            }



            // Execute to change of skin

            $pathSkinPartner = PATH_CORE . 'data' . PATH_SEP . 'partner' . PATH_SEP . 'skin' . PATH_SEP;

            if (G::verifyPath($pathSkinPartner)) {

                $res = array();

                $fileTar = glob($pathSkinPartner . '*.tar');

                foreach ($fileTar as $value) {

                    $dataFile = pathinfo($value);

                    $nameSkinTmp = $dataFile['filename'];

                    G::LoadThirdParty( 'pear/Archive', 'Tar' );

                    $tar = new Archive_Tar( $value );



                    $pathSkinTmp = $pathSkinPartner . 'tmp' . PATH_SEP;

                    G::rm_dir($pathSkinTmp);

                    G::verifyPath($pathSkinTmp, true);

                    chmod( $pathSkinTmp, 0777);

                    $tar->extract($pathSkinTmp);



                    $pathSkinName = $pathSkinTmp . $nameSkinTmp . PATH_SEP;

                    chmod( $pathSkinName, 0777);

                    G::verifyPath(PATH_CORE . 'skinEngine' . PATH_SEP . 'tmp', true);

                    $skinClassic = PATH_CORE . 'skinEngine' . PATH_SEP . 'tmp' . PATH_SEP;



                    if (is_dir($pathSkinName)) {

                        $this->copyFile($pathSkinName, $skinClassic);

                    }



                    G::rm_dir(PATH_CORE . 'skinEngine' . PATH_SEP . 'base');

                    rename(PATH_CORE . 'skinEngine' . PATH_SEP . 'tmp', PATH_CORE . 'skinEngine' . PATH_SEP . 'base');

                    G::rm_dir(PATH_CORE . 'skinEngine' . PATH_SEP . 'tmp');



                    break;

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

示例11: getTemplates

    /**
     * 
     * @url GET /Templates/:proId
     */
    public function getTemplates($proId)
    {
        $templates = array();
        $path = PATH_DATA_MAILTEMPLATES . $proId . PATH_SEP;

        \G::verifyPath($path, true);

        if (defined('PARTNER_FLAG')) {
            if (!file_exists($path . 'actionsByEmailPartner.html')) {
                @copy(PATH_TPL . 'actionsByEmail' . PATH_SEP . 'actionsByEmailPartner.html', $path . 'actionsByEmail.html');
            }
        } else {
            if (!file_exists($path . 'actionsByEmail.html')) {
                @copy(PATH_TPL . 'actionsByEmail' . PATH_SEP . 'actionsByEmail.html', $path . 'actionsByEmail.html');
            }
        }

        $directory = dir($path);

        while ($object = $directory->read()) {
            if (($object !== '.') && ($object !== '..') && ($object !== 'alert_message.html')) {
                $templates[] = array('FILE' => $object, 'NAME' => $object);
            }
        }
        return $templates;
    }
开发者ID:hpx2206,项目名称:processmaker-1,代码行数:30,代码来源:ActionsByEmail.php

示例12: addProcessFilesManager

 /**
  * Return the Process File Manager
  *
  * @param string $sProcessUID {@min 32} {@max 32}
  * @param string $userUID {@min 32} {@max 32}
  * @param array  $aData
  *
  * return array
  *
  * @access public
  */
 public function addProcessFilesManager($sProcessUID, $userUID, $aData)
 {
     try {
         $aData['prf_path'] = rtrim($aData['prf_path'], '/') . '/';
         if (!$aData['prf_filename']) {
             throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('prf_filename')));
         }
         $extention = strstr($aData['prf_filename'], '.');
         if (!$extention) {
             $extention = '.html';
             $aData['prf_filename'] = $aData['prf_filename'].$extention;
         }
         if ($extention == '.docx' || $extention == '.doc' || $extention == '.html' || $extention == '.php' || $extention == '.jsp' ||
             $extention == '.xlsx' || $extention == '.xls' || $extention == '.js' || $extention == '.css' || $extention == '.txt') {
             $sEditable = true;
         } else {
             $sEditable = false;
         }
         $sMainDirectory = current(explode("/", $aData['prf_path']));
         if ($sMainDirectory != 'public' && $sMainDirectory != 'templates') {
             throw new \Exception(\G::LoadTranslation("ID_INVALID_PRF_PATH"));
         }
         if (strstr($aData['prf_path'],'/')) {
             $sSubDirectory = substr($aData['prf_path'], strpos($aData['prf_path'], "/")+1) ;
         } else {
             $sSubDirectory = '';
         }
         switch ($sMainDirectory) {
             case 'templates':
                 $sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $sSubDirectory . $aData['prf_filename'];
                 $sCheckDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $sSubDirectory;
                 if ($extention != '.html') {
                     throw new \Exception(\G::LoadTranslation('ID_FILE_UPLOAD_INCORRECT_EXTENSION'));
                 }
                 break;
             case 'public':
                 $sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . $sSubDirectory . $aData['prf_filename'];
                 $sCheckDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . $sSubDirectory;
                 $sEditable = false;
                 if ($extention == '.exe') {
                     throw new \Exception(\G::LoadTranslation('ID_FILE_UPLOAD_INCORRECT_EXTENSION'));
                 }
                 break;
             default:
                 $sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $sSubDirectory . $aData['prf_filename'];
                 break;
         }
         $content = $aData['prf_content'];
         if (file_exists($sDirectory) ) {
             $directory = $sMainDirectory. PATH_SEP . $sSubDirectory . $aData['prf_filename'];
             throw new \Exception(\G::LoadTranslation("ID_EXISTS_FILE", array($directory)));
         }
         
         if (!file_exists($sCheckDirectory)) {
             $sPkProcessFiles = \G::generateUniqueID();
             $oProcessFiles = new \ProcessFiles();
             $sDate = date('Y-m-d H:i:s');
             $oProcessFiles->setPrfUid($sPkProcessFiles);
             $oProcessFiles->setProUid($sProcessUID);
             $oProcessFiles->setUsrUid($userUID);
             $oProcessFiles->setPrfUpdateUsrUid('');
             $oProcessFiles->setPrfPath($sCheckDirectory);
             $oProcessFiles->setPrfType('folder');
             $oProcessFiles->setPrfEditable('');
             $oProcessFiles->setPrfCreateDate($sDate);
             $oProcessFiles->save();
         }
         \G::verifyPath($sCheckDirectory, true);
         $sPkProcessFiles = \G::generateUniqueID();
         $oProcessFiles = new \ProcessFiles();
         $sDate = date('Y-m-d H:i:s');
         $oProcessFiles->setPrfUid($sPkProcessFiles);
         $oProcessFiles->setProUid($sProcessUID);
         $oProcessFiles->setUsrUid($userUID);
         $oProcessFiles->setPrfUpdateUsrUid('');
         $oProcessFiles->setPrfPath($sDirectory);
         $oProcessFiles->setPrfType('file');
         $oProcessFiles->setPrfEditable($sEditable);
         $oProcessFiles->setPrfCreateDate($sDate);
         $oProcessFiles->save();
         $fp = fopen($sDirectory, 'w');
         $content = stripslashes($aData['prf_content']);
         $content = str_replace("@amp@", "&", $content);
         fwrite($fp, $content);
         fclose($fp);
         $oProcessFile = array('prf_uid' => $oProcessFiles->getPrfUid(),
                               'prf_filename' => $aData['prf_filename'],
                               'usr_uid' => $oProcessFiles->getUsrUid(),
                               'prf_update_usr_uid' => $oProcessFiles->getPrfUpdateUsrUid(),
//.........这里部分代码省略.........
开发者ID:hpx2206,项目名称:processmaker-1,代码行数:101,代码来源:FilesManager.php

示例13: generateFileTranslationMafe

    public function generateFileTranslationMafe ()
    {
        $translation = Array ();

        $c = new Criteria();
        $c->add( TranslationPeer::TRN_ID, '%ID_MAFE_%', Criteria::LIKE );
        $c->addAscendingOrderByColumn( 'TRN_CATEGORY' );
        $c->addAscendingOrderByColumn( 'TRN_ID' );
        //$c->addAscendingOrderByColumn( 'TRN_LANG' );
        $tranlations = TranslationPeer::doSelect( $c );

        $mafeFolder = PATH_HTML . "translations";
        $cacheFileMafe = PATH_HTML . "translations" . PATH_SEP. 'translationsMafe' . ".js";

        foreach ($tranlations as $key => $row) {
            if ($row->getTrnCategory() === 'LABEL') {
                $translation[$row->getTrnLang()][$row->getTrnId()] = $row->getTrnValue();
            }
        }

        try {

            G::verifyPath($mafeFolder, true);
            if (! is_dir( dirname( $cacheFileMafe ) )) {
                G::mk_dir( dirname( $cacheFileMafe ) );
            }

            $f = fopen( $cacheFileMafe, 'w' );
            if ($f == false) {
                error_log("Error: Cannot write into cacheFileMafe: $cacheFileMafe\n");
            } else {
                fwrite( $f, "var __TRANSLATIONMAFE = " . Bootstrap::json_encode( $translation ) . ";\n");
                fclose( $f );
            }

            $res['cacheFileMafe'] = $cacheFileMafe;
            $res['languague'] = count($cacheFileMafe);
            $res['rowsMafeJS'] = count( $translation );
            return $res;
        } catch (Exception $e) {
            echo $e->getMessage();
        }
    }
开发者ID:rrsc,项目名称:processmaker,代码行数:43,代码来源:Translation.php

示例14: getProcessFiles

 function getProcessFiles($proUid, $type)
 {
     $filesList = array();
     switch ($type) {
         case 'mail':
         case 'email':
             $basePath = PATH_DATA_MAILTEMPLATES;
             break;
         case 'public':
             $basePath = PATH_DATA_PUBLIC;
             break;
         default:
             throw new Exception("Unknow Process Files Type '{$type}'.");
     }
     $dir = $basePath . $proUid . PATH_SEP;
     G::verifyPath($dir, true);
     // create if it does not exist.
     // creating the default template (if not exists)
     if (!file_exists($dir . 'alert_message.html')) {
         @copy(PATH_TPL . 'mails' . PATH_SEP . 'alert_message.html', $dir . 'alert_message.html');
     }
     $files = glob($dir . '*.*');
     foreach ($files as $file) {
         $fileName = basename($file);
         if ($fileName !== 'alert_message.html') {
             $filesList[] = array('filepath' => $file, 'filename' => $fileName);
         }
     }
     return $filesList;
 }
开发者ID:nshong,项目名称:processmaker,代码行数:30,代码来源:class.processes.php

示例15: uploadFile

 /**
  * Upload a file and then copy to path+ nameToSave
  *
  * @author Mauricio Veliz <mauricio@colosa.com>
  * @access public
  * @param string $file
  * @param string $path
  * @param string $nameToSave
  * @param integer $permission
  * @return void
  */
 public function uploadFile($file, $path, $nameToSave, $permission = 0666)
 {
     try {
         if ($file == '') {
             throw new Exception('The filename is empty!');
         }
         if (filesize($file) > (ini_get('upload_max_filesize') + 0) * 1024 * 1024) {
             throw new Exception('The size of upload file exceeds the allowed by the server!');
         }
         $oldumask = umask(0);
         if (!is_dir($path)) {
             G::verifyPath($path, true);
         }
         move_uploaded_file($file, $path . "/" . $nameToSave);
         chmod($path . "/" . $nameToSave, $permission);
         umask($oldumask);
     } catch (Exception $oException) {
         throw $oException;
     }
 }
开发者ID:rodrigoivan,项目名称:processmaker,代码行数:31,代码来源:class.g.php


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