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


PHP io::strpos方法代码示例

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


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

示例1: getListBox

    /**
     * Create XHTML select boxes XHTML
     *
     * Example :
     * Array (
     * // Mandatory
     *     'field_name' => '',								// Name of selecte field
     *     'items_possible' => array(integer => string),	// First is the value, second the label of Options
     * // Optional
     *     'default_value' => integer,						// Current category to show as selected
     *     'attributes' => ' class="input_admin_text"',			// A string completing "select" tag with optionnal attributes
     * )
     *
     * USAGE :
     * Add this javascript and HTML to your form
     * and such event to your form :
     *     <form onSubmit="getSelectedOptions_${hidden field name}();">
     * if your hioden field is "IDS", the function to call will be : getSelectedOptions_IDS()
     * To retrieve selected values from $_POST form use :
     *     $my_values = @array_unique(@explode(';', $_POST["ids"]));
     *
     * @param mixed array() $args, This array contains all parameters.
     * @return string, XHTML formated
     */
    function getListBox($args)
    {
        if (!$args || !$args['items_possible']) {
            return '';
        }
        // Rewritre HTML tag attributes
        $attributes = '';
        if (trim($args["attributes"]) != '') {
            if (io::strpos($args["attributes"], 'size') === false) {
                $attributes = 'size="1" ';
            }
            $attributes .= trim($args["attributes"]);
        }
        $s = '
		<select name="' . $args["field_name"] . '" ' . $attributes . '>
			<option value="0"></option>';
        if (is_array($args['items_possible'])) {
            @reset($args['items_possible']);
            while (list($id, $lbl) = each($args['items_possible'])) {
                $sel = $id == $args["default_value"] ? ' selected="selected"' : '';
                $s .= '
				<option value="' . $id . '"' . $sel . '>' . $lbl . '</option>';
            }
        }
        $s .= '
		</select>';
        return $s;
    }
开发者ID:davidmottet,项目名称:automne,代码行数:52,代码来源:dialoglistboxes.php

示例2: create_tar

 /**
  * Creates compressed file by compressing raw data contained into $this->CMS_archive
  * 
  * @return true on success, false on failure
  */
 function create_tar()
 {
     $pwd = getcwd();
     chdir($this->options['basedir']);
     foreach ($this->files as $current) {
         if ($current['name'] == $this->options['name']) {
             continue;
         }
         if (io::strlen($current['name2']) > 99) {
             $path = io::substr($current['name2'], 0, io::strpos($current['name2'], "/", io::strlen($current['name2']) - 100) + 1);
             $current['name2'] = io::substr($current['name2'], io::strlen($path));
             if (io::strlen($path) > 154 || io::strlen($current['name2']) > 99) {
                 $this->raiseError("Could not add {$path}{$current['name2']} to archive because the filename is too long.");
                 continue;
             }
         }
         $block = pack("a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12", $current['name2'], decoct($current['stat'][2]), sprintf("%6s ", decoct($current['stat'][4])), sprintf("%6s ", decoct($current['stat'][5])), sprintf("%11s ", decoct($current['stat'][7])), sprintf("%11s ", decoct($current['stat'][9])), "        ", $current['type'], "", "ustar", "00", "Unknown", "Unknown", "", "", !empty($path) ? $path : "", "");
         $checksum = 0;
         for ($i = 0; $i < 512; $i++) {
             $checksum += ord(io::substr($block, $i, 1));
         }
         $checksum = pack("a8", sprintf("%6s ", decoct($checksum)));
         $block = substr_replace($block, $checksum, 148, 8);
         if ($current['stat'][7] == 0) {
             $this->add_data($block);
         } else {
             if ($fp = @fopen($current['name'], "rb")) {
                 $this->add_data($block);
                 while ($temp = fread($fp, 1048576)) {
                     $this->add_data($temp);
                 }
                 if ($current['stat'][7] % 512 > 0) {
                     $temp = "";
                     for ($i = 0; $i < 512 - $current['stat'][7] % 512; $i++) {
                         $temp .= "";
                     }
                     $this->add_data($temp);
                 }
                 fclose($fp);
             } else {
                 $this->raiseError("Could not open file {$current['name']} for reading. It was not added.");
             }
         }
     }
     $this->add_data(pack("a512", ""));
     chdir($pwd);
     return true;
 }
开发者ID:davidmottet,项目名称:automne,代码行数:53,代码来源:archive-tar.php

示例3: backgroundScript

 /**
  * Constructor.
  * Initializes the process manager and lauches the action if all went well, then delete the PIDFile
  * NOTE : SCRIPT_CODENAME is a constant that must be defined, and unique accross all usage of the background scripts
  * (i.e. One background script for one application should have the same, but two applications having the same script shouldn't collate)
  *
  * @param boolean $debug Set to true if you want a debug of what the script does
  * @return void
  * @access public
  */
 function backgroundScript($debug = false, $scriptID = 'Master')
 {
     $this->_debug = $debug;
     $this->_processManager = new processManager(SCRIPT_CODENAME . '_' . $scriptID);
     // Cleans previous PIDs
     if (isset($_SERVER['argv']['3']) && $_SERVER['argv']['3'] == '-F') {
         if (!APPLICATION_IS_WINDOWS) {
             $tmpDir = dir($this->_processManager->getTempPath());
             while (false !== ($file = $tmpDir->read())) {
                 if (io::strpos($file, SCRIPT_CODENAME) !== false) {
                     @unlink($this->_processManager->getTempPath() . '/' . $file);
                 }
             }
         } else {
             $files = glob(realpath($this->_processManager->getTempPath()) . '/' . SCRIPT_CODENAME . '*.*', GLOB_NOSORT);
             if (is_array($files)) {
                 foreach ($files as $file) {
                     if (!CMS_file::deleteFile($file)) {
                         $this->raiseError("Can't delete file " . $file);
                     }
                 }
             }
         }
     }
     //write script process PID File
     if ($this->_processManager->writePIDFile()) {
         if ($this->_debug) {
             $this->raiseError("PID file successfully written (" . $this->_processManager->getPIDFileName() . ").");
         }
         //start script process
         $this->activate($this->_debug);
         //delete script process PID File
         if ($this->_processManager->deletePIDFile()) {
             if ($this->_debug) {
                 $this->raiseError("PID file successfully deleted (" . $this->_processManager->getPIDFileName() . ").");
             }
         } else {
             $this->raiseError("Can not delete PID file (" . $this->_processManager->getPIDFileName() . ").");
         }
         exit;
     } else {
         if ($this->_debug) {
             $this->raiseError("PID file already exists or impossible to write (" . $this->_processManager->getPIDFileName() . ").");
         }
         exit;
     }
 }
开发者ID:davidmottet,项目名称:automne,代码行数:57,代码来源:backgroundscript.php

示例4: formatBytes

function formatBytes($val, $digits = 3, $mode = "SI", $bB = "B")
{
    $si = array("", "K", "M", "G", "T", "P", "E", "Z", "Y");
    $iec = array("", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi", "Yi");
    switch (io::strtoupper($mode)) {
        case "SI":
            $factor = 1000;
            $symbols = $si;
            break;
        case "IEC":
            $factor = 1024;
            $symbols = $iec;
            break;
        default:
            $factor = 1000;
            $symbols = $si;
            break;
    }
    switch ($bB) {
        case "b":
            $val *= 8;
            break;
        default:
            $bB = "B";
            break;
    }
    for ($i = 0; $i < count($symbols) - 1 && $val >= $factor; $i++) {
        $val /= $factor;
    }
    $p = io::strpos($val, ".");
    if ($p !== false && $p > $digits) {
        $val = round($val);
    } elseif ($p !== false) {
        $val = round($val, $digits - $p);
    }
    return round($val, $digits) . " " . $symbols[$i] . $bB;
}
开发者ID:davidmottet,项目名称:automne,代码行数:37,代码来源:templates-files-nodes.php

示例5: checkFile

function checkFile($value)
{
    return io::strpos($value, '..') === false && io::strpos($value, '/') === false && io::strpos($value, '\\') === false;
}
开发者ID:davidmottet,项目名称:automne,代码行数:4,代码来源:templates-files-controler.php

示例6: array

    $checkedElements['rows'] = true;
}
//define here special search codes for each elements
$searchCodes = array();
$searchCodes[MOD_STANDARD_CODENAME] = CMS_search::getAllCodes();
$searchCodes['users'] = array('user', 'group');
if ($elements) {
    foreach ($searchCodes as $searchElement => $searchCode) {
        foreach ($searchCode as $code) {
            if (io::strpos($search, $code . ':') !== false && isset($elements[$searchElement])) {
                $checkedElements = array();
                $checkedElements[$searchElement] = true;
            }
        }
    }
    if (io::strpos($search, 'row:') !== false && isset($elements['templates'])) {
        $checkedElements['templates'] = true;
    }
    $searchPanel .= "{\n\t\txtype: \t\t'checkboxgroup',\n\t\tid: \t\t'searchCheckboxgroup',\n\t\tfieldLabel: '" . $cms_language->getJsMessage(MESSAGE_PAGE_FIELD_SEARCH_IN) . "',\n\t\tcolumns: \t1,\n\t\titems: [\n\t\t\t{boxLabel: '<em style=\"font-style:italic;\">" . $cms_language->getJSMessage(MESSAGE_PAGE_CHECK_ALL) . "</em>', checked: " . (sizeof($elements) == sizeof($checkedElements) ? 'true' : 'false') . ", listeners: {'check':function(field, checked) {\n\t\t\t\tif (searchWindow.ok) {\n\t\t\t\t\tsearchWindow.ok = false;\n\t\t\t\t\tExt.getCmp('searchCheckboxgroup').items.each(function(el, group, index){\n\t\t\t\t\t\tif (index == 0) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tel.setValue(checked);\n\t\t\t\t\t}, this);\n\t\t\t\t\tsearchWindow.ok = true;\n\t\t\t\t\t//launch search\n\t\t\t\t\tsearchWindow.search();\n\t\t\t\t}\n\t\t\t}, scope:this}},\n\t\t";
    foreach ($elements as $element => $label) {
        $label = io::htmlspecialchars($label);
        //if search use special search code, only search on standard module
        $checked = !$search || isset($checkedElements[$element]) && $checkedElements[$element] ? 'true' : 'false';
        $searchPanel .= "{boxLabel: '{$label}', ctCls:'x-masked', inputValue:'{$element}',  checked: {$checked}, name: 'elements[]', listeners: {'check':searchWindow.search}},";
    }
    //remove last comma from groups
    $searchPanel = substr($searchPanel, 0, -1);
    $searchPanel .= "]\n\t},";
}
$searchCodes = sensitiveIO::jsonEncode($searchCodes);
$searchPanel = io::substr($searchPanel, 0, -1);
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:search.php

示例7: setValues

 /**
  * set object Values
  *
  * @param array $values : the POST result values
  * @param string $prefixname : the prefix used for post names
  * @param boolean newFormat : new automne v4 format (default false for compatibility)
  * @param integer $objectID : the current object id. Must be set, but default is blank for compatibility with other objects
  * @return boolean true on success, false on failure
  * @access public
  */
 function setValues($values, $prefixName, $newFormat = false, $objectID = '')
 {
     if (!sensitiveIO::isPositiveInteger($objectID)) {
         $this->raiseError('ObjectID must be a positive integer : ' . $objectID);
         return false;
     }
     //get module codename
     $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID());
     //create a sub prefix for CMS_dialog_href object
     $subPrefixName = 'href' . $prefixName . $this->_field->getID() . '_0';
     //create object CMS_href & CMS_dialog_href
     $hrefDialog = new CMS_dialog_href(new CMS_href($this->_subfieldValues[0]->getValue()), $subPrefixName);
     if ($newFormat) {
         $hrefDialog->create($values[$subPrefixName], $moduleCodename, $objectID, $this->_field->getID());
         if ($hrefDialog->hasError()) {
             return false;
         }
         $href = $hrefDialog->getHREF();
         if (!$this->_subfieldValues[0]->setValue($href->getTextDefinition())) {
             return false;
         }
         $content = array('datas' => array('polymodFieldsValue[' . $subPrefixName . ']' => sensitiveIO::decodeEntities($this->_subfieldValues[0]->getValue())));
         $view = CMS_view::getInstance();
         $view->addContent($content);
     } else {
         //check for http://
         if ($values[$subPrefixName . 'link_external'] && io::strpos($values[$subPrefixName . 'link_external'], 'http://') !== 0) {
             $values[$subPrefixName . 'link_external'] = 'http://' . $values[$subPrefixName . 'link_external'];
         }
         $hrefDialog->doPost($moduleCodename, $objectID, $this->_field->getID());
         if ($hrefDialog->hasError()) {
             return false;
         }
         $href = $hrefDialog->getHREF();
         if (!$this->_subfieldValues[0]->setValue($href->getTextDefinition())) {
             return false;
         }
     }
     return true;
 }
开发者ID:davidmottet,项目名称:automne,代码行数:50,代码来源:object_href.php

示例8: duplicate

 /**
  * Duplicate this block
  * Used to duplicate a CMS_page.
  *
  * @param CMS_page $destinationPage, the page receiving a copy of this block
  * @param boolean $public The precision needed for USERSPACE location
  * @return CMS_block object
  */
 function duplicate(&$destinationPage, $public = false)
 {
     if (SensitiveIO::isPositiveInteger($this->_dbID) && $this->_file) {
         $table = $this->_getDataTableName(RESOURCE_LOCATION_USERSPACE, $public);
         //Copy linked file
         //In new file name, delete reference to old page and add refernce to new one
         $_newFilename = "p" . $destinationPage->getID() . io::substr($this->_file, io::strpos($this->_file, "_"), io::strlen($this->_file));
         if (@is_file(PATH_MODULES_FILES_STANDARD_FS . "/edited/" . $this->_file) && @copy(PATH_MODULES_FILES_STANDARD_FS . "/edited/" . $this->_file, PATH_MODULES_FILES_STANDARD_FS . "/edited/" . $_newFilename) && @chmod(PATH_MODULES_FILES_STANDARD_FS . "/edited/" . $_newFilename, octdec(FILES_CHMOD))) {
             //Public
             if ($public) {
                 if (!@copy(PATH_MODULES_FILES_STANDARD_FS . "/public/" . $this->_file, PATH_MODULES_FILES_STANDARD_FS . "/public/" . $_newFilename) || !@chmod(PATH_MODULES_FILES_STANDARD_FS . "/public/" . $_newFilename, octdec(FILES_CHMOD))) {
                     $this->raiseError("Duplicate, copy of new file failed : " . PATH_MODULES_FILES_STANDARD_FS . "/public/" . $_newFilename);
                 }
             }
             $_newEnlargedFilename = '';
             //With enlarged file
             if ($this->_enlargedFile != '') {
                 $_newEnlargedFilename = "p" . $destinationPage->getID() . io::substr($this->_enlargedFile, io::strpos($this->_enlargedFile, "_"), io::strlen($this->_enlargedFile));
                 //Edited
                 if (!@copy(PATH_MODULES_FILES_STANDARD_FS . "/edited/" . $this->_enlargedFile, PATH_MODULES_FILES_STANDARD_FS . "/edited/" . $_newEnlargedFilename) || !@chmod(PATH_MODULES_FILES_STANDARD_FS . "/edited/" . $_newEnlargedFilename, octdec(FILES_CHMOD))) {
                     $this->raiseError("Duplicate, copy of new enlarged file failed : " . PATH_MODULES_FILES_STANDARD_FS . "/edited/" . $_newEnlargedFilename);
                 }
                 //Public
                 if ($public) {
                     if (!@copy(PATH_MODULES_FILES_STANDARD_FS . "/public/" . $this->_enlargedFile, PATH_MODULES_FILES_STANDARD_FS . "/public/" . $_newEnlargedFilename) || !@chmod(PATH_MODULES_FILES_STANDARD_FS . "/public/" . $_newEnlargedFilename, octdec(FILES_CHMOD))) {
                         $this->raiseError("Duplicate, copy of new enlarged file failed : " . PATH_MODULES_FILES_STANDARD_FS . "/public/" . $_newEnlargedFilename);
                     }
                 }
             }
             //Save new datas
             $str_set = "\n\t\t\t\t\t\tpage='" . $destinationPage->getID() . "',\n\t\t\t\t\t\tclientSpaceID='" . $this->_clientSpaceID . "',\n\t\t\t\t\t\trowID='" . $this->_rowID . "',\n\t\t\t\t\t\tblockID='" . $this->_tagID . "',\n\t\t\t\t\t\tlabel='" . SensitiveIO::sanitizeSQLString(SensitiveIO::stripPHPTags($this->_label)) . "',\n\t\t\t\t\t\tfile='" . SensitiveIO::sanitizeSQLString(SensitiveIO::stripPHPTags($_newFilename)) . "',\n\t\t\t\t\t\texternalLink='" . SensitiveIO::sanitizeSQLString(SensitiveIO::stripPHPTags($this->_externalLink)) . "',\n\t\t\t\t\t\tenlargedFile='" . SensitiveIO::sanitizeSQLString(SensitiveIO::stripPHPTags($_newEnlargedFilename)) . "'\n\t\t\t\t";
             $sql = "\n\t\t\t\t\tinsert into\n\t\t\t\t\t\t" . $table . "\n\t\t\t\t\tset\n\t\t\t\t\t\t" . $str_set . "\n\t\t\t\t";
             $q = new CMS_query($sql);
             if (!$q->hasError()) {
                 //Table Edition
                 $sql = "\n\t\t\t\t\t\tinsert into\n\t\t\t\t\t\t\t" . $this->_getDataTableName(RESOURCE_LOCATION_EDITION, false) . "\n\t\t\t\t\t\tset\n\t\t\t\t\t\t\tid='" . $q->getLastInsertedID() . "',\n\t\t\t\t\t\t\t" . $str_set . "\n\t\t\t\t\t";
                 $q = new CMS_query($sql);
                 return !$q->hasError();
             } else {
                 $this->raiseError("Duplicate, SQL insertion of new filename failed : " . $sql);
             }
         } else {
             $this->raiseError("Duplicate, copy of file failed :" . PATH_MODULES_FILES_STANDARD_FS . "/edited/" . $this->_file);
         }
     }
     return false;
 }
开发者ID:davidmottet,项目名称:automne,代码行数:55,代码来源:blockimage.php

示例9: activate


//.........这里部分代码省略.........
                                 CMS_grandFather::raiseError('Error during execution of sub script command (cd ' . PATH_REALROOT_FS . '; ' . PATH_PHP_CLI_UNIX . ' ' . $sub_system . '), please check your configuration : ' . $error);
                                 return false;
                             }
                         }
                         $PIDfile = $this->_processManager->getTempPath() . "/" . SCRIPT_CODENAME . "_" . $data["id_reg"];
                         if ($this->_debug) {
                             $this->raiseError(processManager::MASTER_SCRIPT_NAME . " : Executes system(" . $sub_system . ")");
                         }
                         //sleep a little
                         @sleep(SLEEP_TIME);
                     } else {
                         // On windows system
                         //Create the BAT file
                         $command = '@echo off' . "\r\n" . '@start /B /BELOWNORMAL ' . realpath(PATH_PHP_CLI_WINDOWS) . ' ' . realpath(PATH_PACKAGES_FS . '\\scripts\\script.php') . ' -s ' . $data["id_reg"];
                         if (!@touch(realpath(PATH_WINDOWS_BIN_FS) . DIRECTORY_SEPARATOR . "sub_script.bat")) {
                             $this->raiseError(processManager::MASTER_SCRIPT_NAME . " : Create file error : sub_script.bat");
                         }
                         $replace = array('program files (x86)' => 'progra~2', 'program files' => 'progra~1', 'documents and settings' => 'docume~1');
                         $command = str_ireplace(array_keys($replace), $replace, $command);
                         $fh = fopen(realpath(PATH_WINDOWS_BIN_FS . DIRECTORY_SEPARATOR . "sub_script.bat"), "wb");
                         if (is_resource($fh)) {
                             if (!fwrite($fh, $command, io::strlen($command))) {
                                 CMS_grandFather::raiseError(processManager::MASTER_SCRIPT_NAME . " : Save file error : sub_script.bat");
                             }
                             fclose($fh);
                         }
                         $WshShell = new COM("WScript.Shell");
                         $oExec = $WshShell->Run(str_ireplace(array_keys($replace), $replace, realpath(PATH_WINDOWS_BIN_FS . '\\sub_script.bat')), 0, false);
                         $PIDfile = $this->_processManager->getTempPath() . DIRECTORY_SEPARATOR . SCRIPT_CODENAME . "_" . $data["id_reg"];
                         //sleep a little
                         @sleep(SLEEP_TIME);
                     }
                     if ($this->_debug) {
                         $this->raiseError(processManager::MASTER_SCRIPT_NAME . " : script : " . $data["id_reg"] . " - sub_system : " . $sub_system);
                     }
                     $scriptsArray[] = array("PID" => $PIDfile, "startTime" => CMS_stats::getmicrotime(), "scriptID" => $data["id_reg"], "scriptDatas" => $data);
                 }
             } else {
                 // no more scripts to process
                 // > delete all temporary files
                 // > end script
                 if (APPLICATION_IS_WINDOWS) {
                     $files = glob(realpath($this->_processManager->getTempPath()) . DIRECTORY_SEPARATOR . SCRIPT_CODENAME . '*.ok', GLOB_NOSORT);
                     if (is_array($files)) {
                         foreach ($files as $file) {
                             if (!CMS_file::deleteFile($file)) {
                                 $this->raiseError("Can't delete file " . $file);
                                 return false;
                             }
                         }
                     }
                 } else {
                     $tmpDir = dir($this->_processManager->getTempPath());
                     while (false !== ($file = $tmpDir->read())) {
                         if (io::strpos($file, SCRIPT_CODENAME) !== false) {
                             @unlink($this->_processManager->getTempPath() . '/' . $file);
                         }
                     }
                 }
                 break;
             }
             while (true) {
                 @sleep(SLEEP_TIME);
                 //wait a little to check sub_scripts
                 $break = false;
                 $timeStop = CMS_stats::getmicrotime();
                 if ($this->_debug) {
                     $this->raiseError(processManager::MASTER_SCRIPT_NAME . " Scripts in progress : " . sizeof($scriptsArray));
                 }
                 foreach ($scriptsArray as $nb => $aScript) {
                     if ($this->_debug) {
                         $this->raiseError(processManager::MASTER_SCRIPT_NAME . " PID : " . $aScript["PID"] . " - time : " . ($timeStop - $aScript["startTime"]));
                     }
                     $ok = '';
                     $ok = is_file($aScript["PID"] . '.ok');
                     if ($ok) {
                         //$break = true;
                         if ($this->_debug) {
                             $this->raiseError(processManager::MASTER_SCRIPT_NAME . " Script : " . $aScript["PID"] . " OK !");
                         }
                         unset($scriptsArray[$nb]);
                     } elseif ($timeStop - $aScript["startTime"] >= SUB_SCRIPT_TIME_OUT) {
                         if ($this->_debug) {
                             $this->raiseError(processManager::MASTER_SCRIPT_NAME . " : Script : " . $aScript["PID"] . " NOT OK !");
                         }
                         $this->raiseError(processManager::MASTER_SCRIPT_NAME . ' : Error on task : ' . $aScript["scriptID"] . ' ... skip it. Task parameters : ' . print_r($aScript['scriptDatas'], true));
                         //$break = true;
                         unset($scriptsArray[$nb]);
                         //delete the script in error from task list
                         $q_del = "\n\t\t\t\t\t\t\t\tdelete\n\t\t\t\t\t\t\t\tfrom\n\t\t\t\t\t\t\t\t\tregenerator\n\t\t\t\t\t\t\t\twhere\n\t\t\t\t\t\t\t\t\tid_reg='" . $aScript["scriptID"] . "'";
                         $q_del = new CMS_query($q_del);
                     }
                 }
                 if (!$scriptsArray) {
                     break;
                 }
             }
         }
     }
 }
开发者ID:davidmottet,项目名称:automne,代码行数:101,代码来源:script.php

示例10: getRecursiveOutput

 /**
  * Get the recursive HTML display for a recursivelinks, if it passes the condition of course.
  *
  * @param CMS_page $parsedPage The page in which the linx tag is
  * @param integer $level The current level of recursivity
  * @param multidimentionnal array $recursiveTree The tree to display
  * @param array $pages array of pages objects (indexed by id)
  * @param boolean $public Is the page data to show the public or edited one ?
  * @param array $lineage The lineage of the pages (used to see wich recursions need to be done in closed link display mode)
  * @return string The html of the recursive link
  * @access public
  */
 function getRecursiveOutput(&$parsedPage, $level = 0, $recursiveTree, &$pages, $public, $lineage = array())
 {
     $html = '';
     if (is_array($recursiveTree) && $recursiveTree) {
         $rank = 1;
         $levelhtml = '';
         foreach ($recursiveTree as $pageID => $subPages) {
             //get Page Object
             $page = $pages[$pageID];
             //instanciate page if not exists as object
             if (!is_object($page) && sensitiveIO::isPositiveInteger($page)) {
                 $page = CMS_tree::getPageByID($page);
             }
             $pagehtml = '';
             //check if page pass the condition
             if (is_object($page) && (!$this->hasCondition() || $this->pagePassesConditions($parsedPage, $page, $public, $rank)) && (!$public || $public && $page->isUseable() && $page->getPublication() == RESOURCE_PUBLICATION_PUBLIC)) {
                 //get pages infos
                 $linkTitle = $page->getLinkTitle($public);
                 $title = $page->getTitle($public);
                 //set pages infos in html template
                 $replace = array("{{title}}" => io::sanitizeHTMLString($linkTitle), "{{jstitle}}" => io::sanitizeHTMLString($linkTitle), "{{pagetitle}}" => io::sanitizeHTMLString($title), "{{jspagetitle}}" => io::sanitizeHTMLString($title), "{{desc}}" => io::sanitizeHTMLString($page->getDescription($public)), "{{href}}" => $page->getURL(), "{{id}}" => $page->getID(), "{{codename}}" => $page->getCodename($public), "{{number}}" => $rank - 1, "{{modulo}}" => ($rank - 1) % 2, "{{lvlClass}}" => "CMS_lvl" . ($level + 1), "{{currentClass}}" => $parsedPage->getID() == $page->getID() ? "CMS_current" : "", 'id="{{currentID}}"' => $parsedPage->getID() == $page->getID() ? 'id="CMS_current"' : "");
                 if (io::strpos($this->_htmlTemplate, '{{isParent}}') !== false) {
                     //only if needed because getLineage require a lot of query
                     $pagelineage = CMS_tree::getLineage($page->getID(), $parsedPage->getID(), false);
                     $replace['class="{{isParent}}"'] = is_array($pagelineage) && in_array($parsedPage->getID(), $pagelineage) ? 'class="CMS_parent"' : "";
                     $replace['{{isParent}}'] = is_array($pagelineage) && in_array($parsedPage->getID(), $pagelineage) ? 'CMS_parent' : "";
                     $replace['id="{{isParent}}"'] = is_array($pagelineage) && in_array($parsedPage->getID(), $pagelineage) ? 'id="CMS_parent"' : "";
                 }
                 if (io::strpos($this->_htmlTemplate, '{{website') !== false) {
                     //only if needed because getWebsite require a lot of query
                     $website = $page->getWebsite();
                     $replace['{{websitetitle}}'] = $website->getLabel();
                     $replace['{{websitecodename}}'] = $website->getCodename($public);
                 }
                 $pagehtml = str_replace(array_keys($replace), $replace, $this->_htmlTemplate);
                 if ($level == 0 && ($this->_root === 'false' || !$this->_root)) {
                     $pagehtml = str_replace(array_keys($replace), $replace, $this->getRecursiveOutput($parsedPage, $level + 1, $subPages, $pages, $public, $lineage));
                 } else {
                     //check if link is in open or closed mode
                     if ($this->_mode == "open") {
                         //if it is open mode recurse indefinitely (until end of tree)
                         //then mark info of sublevels or not
                         $replace = array("{{typeClass}}" => $subPages ? "CMS_sub" : "CMS_nosub", "{{sublevel}}" => $this->getRecursiveOutput($parsedPage, $level + 1, $subPages, $pages, $public));
                         $pagehtml = str_replace(array_keys($replace), $replace, $pagehtml);
                     } else {
                         //if it is 'close' mode recurse only for pages in current lineage
                         $recurse = false;
                         if (is_array($lineage)) {
                             $recurse = in_array($page->getID(), $lineage) ? true : false;
                         }
                         //then mark info of sublevels or not and if level is open or not
                         $sub = $recurse ? "CMS_open" : "CMS_sub";
                         $replace = array("{{typeClass}}" => $subPages ? $sub : "CMS_nosub", "{{sublevel}}" => $recurse ? $this->getRecursiveOutput($parsedPage, $level + 1, $subPages, $pages, $public, $lineage) : "");
                         if (!$recurse) {
                             //needed to update link targets which is used after to register watched links
                             $it = new RecursiveArrayIterator($subPages);
                             foreach ($it as $pageID => $element) {
                                 unset($pages[$pageID]);
                             }
                         }
                         $pagehtml = str_replace(array_keys($replace), $replace, $pagehtml);
                     }
                 }
                 //add APPLICATION_ENFORCES_ACCESS_CONTROL php access checking
                 if (APPLICATION_ENFORCES_ACCESS_CONTROL && $public) {
                     $pagehtml = $this->_addSlashAroundPHPContent($pagehtml);
                     $replace = array("<?php" => "';", "?>" => "echo '");
                     $pagehtml = str_replace(array_keys($replace), $replace, $pagehtml);
                     $pagehtml = '<?php if ($cms_user->hasPageClearance(' . $page->getID() . ', CLEARANCE_PAGE_VIEW)) {' . "\n" . 'echo \'' . $pagehtml . '\';' . "\n" . '}' . "\n" . '?>';
                 }
                 $rank++;
             } else {
                 //needed to update link targets which is used after to register watched links
                 unset($pages[$pageID]);
             }
             $levelhtml .= $pagehtml;
         }
         if ($level == 0 && ($this->_root === 'false' || !$this->_root)) {
             $html = $levelhtml;
         } else {
             if ($levelhtml && io::strpos($this->_subleveltemplate, "{{sublevel}}") !== false) {
                 $replace = array("{{sublevel}}" => $levelhtml, "{{lvlClass}}" => "CMS_lvl" . ($level + 1));
                 $html = str_replace(array_keys($replace), $replace, $this->_subleveltemplate);
             } else {
                 $html = $levelhtml;
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:davidmottet,项目名称:automne,代码行数:101,代码来源:linxdisplay.php

示例11: asArray

 /**
  * Get object field as an array structure used for export
  *
  * @param array $params The export parameters. Not used here
  * @param array $files The reference to the found files used by object
  * @return array : the object array structure
  * @access public
  */
 public function asArray($params = array(), &$files)
 {
     $aField = array('id' => $this->_fieldID, 'uuid' => $this->_objectFieldValues['uuid'], 'labels' => CMS_object_i18nm::getValues($this->_objectFieldValues['labelID']), 'descriptions' => CMS_object_i18nm::getValues($this->_objectFieldValues['descriptionID']), 'objectID' => $this->_objectFieldValues['objectID'], 'type' => null, 'multi' => null, 'params' => array('order' => $this->_objectFieldValues['order'], 'required' => $this->_objectFieldValues['required'], 'indexable' => $this->_objectFieldValues['indexable'], 'searchlist' => $this->_objectFieldValues['searchlist'], 'searchable' => $this->_objectFieldValues['searchable']));
     $linkedObjectId = null;
     if (io::strpos($this->_objectFieldValues['type'], 'multi|') !== false) {
         $aField['multi'] = 1;
         $type = explode('|', $this->_objectFieldValues['type']);
         $aField['type'] = $type[1];
         $linkedObjectId = $type[1];
     } else {
         $aField['multi'] = 0;
         $aField['type'] = $this->_objectFieldValues['type'];
         if (io::isPositiveInteger($aField['type'])) {
             $linkedObjectId = $this->_objectFieldValues['type'];
         }
     }
     if ($linkedObjectId) {
         $objectDefition = new CMS_poly_object_definition($linkedObjectId);
         if ($objectDefition) {
             $aField['params']['linkedObjectUuid'] = $objectDefition->getValue('uuid');
         }
     }
     if (!io::isPositiveInteger($aField['type'])) {
         if (class_exists($aField['type'])) {
             $oType = new $aField['type'](array(), $this, false);
             $aField['params']['params'] = $oType->asArray();
         }
     } elseif ($aField['multi']) {
         $oType = new CMS_multi_poly_object($aField['type'], array(), $this, false);
         $aField['params']['params'] = $oType->asArray();
     }
     return $aField;
 }
开发者ID:davidmottet,项目名称:automne,代码行数:41,代码来源:poly_object_field.php

示例12: setValues

 /**
  * set object Values
  *
  * @param array $values : the POST result values
  * @param string prefixname : the prefix used for post names
  * @param boolean newFormat : new automne v4 format (default false for compatibility)
  * @param integer $objectID : the current object id. Must be set, but default is blank for compatibility with other objects
  * @return boolean true on success, false on failure
  * @access public
  */
 function setValues($values, $prefixName, $newFormat = false, $objectID = '')
 {
     if (!sensitiveIO::isPositiveInteger($objectID)) {
         $this->raiseError('ObjectID must be a positive integer : ' . $objectID);
         return false;
     }
     //get field parameters
     $params = $this->getParamsValues();
     //get module codename
     $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID());
     if ($newFormat) {
         //delete old images ?
         //thumbnail
         if ($this->_subfieldValues[0]->getValue() && (!$values[$prefixName . $this->_field->getID() . '_0'] || pathinfo($values[$prefixName . $this->_field->getID() . '_0'], PATHINFO_BASENAME) != $this->_subfieldValues[0]->getValue())) {
             @unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[0]->getValue());
             $this->_subfieldValues[0]->setValue('');
         }
         //image zoom
         if ($this->_subfieldValues[2]->getValue() && (!isset($values[$prefixName . $this->_field->getID() . '_2']) || !$values[$prefixName . $this->_field->getID() . '_2'] || pathinfo($values[$prefixName . $this->_field->getID() . '_2'], PATHINFO_BASENAME) != $this->_subfieldValues[2]->getValue())) {
             @unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[2]->getValue());
             $this->_subfieldValues[2]->setValue('');
         }
         //set label from label field
         if (!$this->_subfieldValues[1]->setValue(io::htmlspecialchars($values[$prefixName . $this->_field->getID() . '_1']))) {
             return false;
         }
         //image zoom (if needed)
         if ((!isset($values[$prefixName . $this->_field->getID() . '_makeZoom']) || $values[$prefixName . $this->_field->getID() . '_makeZoom'] != 1) && isset($values[$prefixName . $this->_field->getID() . '_2']) && $values[$prefixName . $this->_field->getID() . '_2'] && io::strpos($values[$prefixName . $this->_field->getID() . '_2'], PATH_UPLOAD_WR . '/') !== false) {
             $filename = $values[$prefixName . $this->_field->getID() . '_2'];
             //check for image type before doing anything
             if (!in_array(io::strtolower(pathinfo($filename, PATHINFO_EXTENSION)), $this->_allowedExtensions)) {
                 return false;
             }
             //destroy old image if any
             if ($this->_subfieldValues[2]->getValue()) {
                 @unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[2]->getValue());
                 $this->_subfieldValues[2]->setValue('');
             }
             //move and rename uploaded file
             $filename = str_replace(PATH_UPLOAD_WR . '/', PATH_UPLOAD_FS . '/', $filename);
             $basename = pathinfo($filename, PATHINFO_BASENAME);
             //set thumbnail
             $path = PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED;
             $zoomBasename = "r" . $objectID . "_" . $this->_field->getID() . "_" . io::strtolower(SensitiveIO::sanitizeAsciiString($basename));
             if (io::strlen($zoomBasename) > 255) {
                 $zoomBasename = sensitiveIO::ellipsis($zoomBasename, 255, '-', true);
             }
             $zoomFilename = $path . '/' . $zoomBasename;
             CMS_file::moveTo($filename, $zoomFilename);
             CMS_file::chmodFile(FILES_CHMOD, $zoomFilename);
             //set it
             if (!$this->_subfieldValues[2]->setValue($zoomBasename)) {
                 return false;
             }
         }
         //thumbnail
         if ($values[$prefixName . $this->_field->getID() . '_0'] && io::strpos($values[$prefixName . $this->_field->getID() . '_0'], PATH_UPLOAD_WR . '/') !== false) {
             $filename = $values[$prefixName . $this->_field->getID() . '_0'];
             //check for image type before doing anything
             if (!in_array(io::strtolower(pathinfo($filename, PATHINFO_EXTENSION)), $this->_allowedExtensions)) {
                 return false;
             }
             //destroy old image if any
             if ($this->_subfieldValues[0]->getValue()) {
                 @unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[0]->getValue());
                 $this->_subfieldValues[0]->setValue('');
             }
             //move and rename uploaded file
             $filename = str_replace(PATH_UPLOAD_WR . '/', PATH_UPLOAD_FS . '/', $filename);
             $basename = pathinfo($filename, PATHINFO_BASENAME);
             //set thumbnail
             $path = PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED;
             $newBasename = "r" . $objectID . "_" . $this->_field->getID() . "_" . io::strtolower(SensitiveIO::sanitizeAsciiString($basename));
             //rename image
             $path_parts = pathinfo($newBasename);
             $extension = io::strtolower($path_parts['extension']);
             $newBasename = io::substr($path_parts['basename'], 0, -(io::strlen($extension) + 1)) . '_thumbnail.' . $extension;
             if (io::strlen($newBasename) > 255) {
                 $newBasename = sensitiveIO::ellipsis($newBasename, 255, '-', true);
             }
             $newFilename = $path . '/' . $newBasename;
             //move file from upload dir to new dir
             CMS_file::moveTo($filename, $newFilename);
             CMS_file::chmodFile(FILES_CHMOD, $newFilename);
             //if we use original image as image zoom, set it
             if (isset($values[$prefixName . $this->_field->getID() . '_makeZoom']) && $values[$prefixName . $this->_field->getID() . '_makeZoom'] == 1) {
                 $zoomFilename = str_replace('_thumbnail.' . $extension, '.' . $extension, $newFilename);
                 //copy image as zoom
                 CMS_file::copyTo($newFilename, $zoomFilename);
                 $zoomBasename = pathinfo($zoomFilename, PATHINFO_BASENAME);
//.........这里部分代码省略.........
开发者ID:davidmottet,项目名称:automne,代码行数:101,代码来源:object_image.php

示例13: authenticate


//.........这里部分代码省略.........
                             }
                         } else {
                             $this->_messages[] = self::AUTH_INVALID_CREDENTIALS;
                             $this->_result = new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, null, $this->_messages);
                             //wait a little (5 seconds) to avoid multiple simultaneous attempts
                             sleep(5);
                         }
                     }
                 }
                 break;
             case 'session':
                 $authStorage = new Zend_Auth_Storage_Session('atm-auth');
                 $userId = $authStorage->read();
                 if (io::isPositiveInteger($userId)) {
                     if (!isset($this->_params['disconnect']) || !$this->_params['disconnect']) {
                         //check user from session table
                         if ($this->_checkSession($userId)) {
                             $this->_user = CMS_profile_usersCatalog::getByID($userId);
                             if ($this->_user && !$this->_user->hasError() && !$this->_user->isDeleted() && $this->_user->isActive()) {
                                 $this->_messages[] = self::AUTH_VALID_USER_SESSION;
                                 $this->_result = new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $this->_user->getUserId(), $this->_messages);
                                 return $this->_result;
                             } else {
                                 $this->_messages[] = self::AUTH_INVALID_USER_SESSION;
                                 $this->_result = new Zend_Auth_Result(Zend_Auth_Result::FAILURE, null, $this->_messages);
                                 //clear session content
                                 CMS_session::deleteSession(true);
                             }
                         } else {
                             //clear session content
                             CMS_session::deleteSession();
                         }
                     }
                 }
                 break;
             case 'cookie':
                 if (isset($_COOKIE[CMS_session::getAutoLoginCookieName()])) {
                     if (!isset($this->_params['disconnect']) || !$this->_params['disconnect']) {
                         if (!$this->_autoLogin()) {
                             //remove cookie
                             CMS_session::setCookie(CMS_session::getAutoLoginCookieName());
                         } else {
                             return $this->_result;
                         }
                     }
                 }
                 break;
             case 'sso':
                 if (!(isset($this->_params['login']) && isset($this->_params['password']) && $this->_params['login'] && $this->_params['password'])) {
                     if (defined('MOD_STANDARD_SSO_LOGIN') && MOD_STANDARD_SSO_LOGIN) {
                         $this->_user = CMS_profile_usersCatalog::getByLogin(MOD_STANDARD_SSO_LOGIN);
                         if ($this->_user && !$this->_user->hasError()) {
                             $this->_messages[] = self::AUTH_SSOLOGIN_VALID;
                             $this->_result = new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $this->_user->getUserId(), $this->_messages);
                             return $this->_result;
                         } else {
                             $this->_messages[] = self::AUTH_SSOLOGIN_INVALID_USER;
                             $this->_result = new Zend_Auth_Result(Zend_Auth_Result::FAILURE, null, $this->_messages);
                         }
                     } elseif (defined('MOD_STANDARD_SSO_FUNCTION') && MOD_STANDARD_SSO_FUNCTION) {
                         if (is_callable(MOD_STANDARD_SSO_FUNCTION, false)) {
                             //check if function/method name exists.
                             $login = '';
                             if (io::strpos(MOD_STANDARD_SSO_FUNCTION, '::') !== false) {
                                 //static method call
                                 $method = explode('::', MOD_STANDARD_SSO_FUNCTION);
                                 $login = call_user_func(array($method[0], $method[1]));
                             } else {
                                 //function call
                                 $login = call_user_func(MOD_STANDARD_SSO_FUNCTION);
                             }
                             if ($login) {
                                 $this->_user = CMS_profile_usersCatalog::getByLogin($login);
                                 if ($this->_user && !$this->_user->hasError()) {
                                     $this->_messages[] = self::AUTH_SSOLOGIN_VALID;
                                     $this->_result = new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $this->_user->getUserId(), $this->_messages);
                                     return $this->_result;
                                 } else {
                                     $this->_messages[] = self::AUTH_SSOLOGIN_INVALID_USER;
                                     $this->_result = new Zend_Auth_Result(Zend_Auth_Result::FAILURE, null, $this->_messages);
                                 }
                             }
                         } else {
                             $this->raiseError('Cannot call SSO method/function: ' . MOD_STANDARD_SSO_FUNCTION);
                         }
                     }
                 }
                 break;
             default:
                 CMS_grandFather::raiseError('Unknown authType: ' . $this->_params['authType']);
                 break;
         }
     }
     //Nothing found
     if (!$this->_result) {
         $this->_messages[] = self::AUTH_MISSING_CREDENTIALS;
         $this->_result = new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, null, $this->_messages);
     }
     return $this->_result;
 }
开发者ID:davidmottet,项目名称:automne,代码行数:101,代码来源:auth.php

示例14: load

 /**
  * Module autoload handler
  *
  * @param string $classname the classname required for loading
  * @return string : the file to use for required classname
  * @access public
  */
 function load($classname)
 {
     static $classes;
     if (!isset($classes)) {
         $classes = array('cms_poly_object_field' => PATH_MODULES_FS . '/polymod/polyobjects/poly_object_field.php', 'cms_poly_object' => PATH_MODULES_FS . '/polymod/polyobjects/poly_object.php', 'cms_poly_object_definition' => PATH_MODULES_FS . '/polymod/polyobjects/poly_object_definition.php', 'cms_poly_object_catalog' => PATH_MODULES_FS . '/polymod/polyobjects/poly_object_catalog.php', 'cms_multi_poly_object' => PATH_MODULES_FS . '/polymod/polyobjects/multi_poly_object.php', 'cms_object_search' => PATH_MODULES_FS . '/polymod/object_search.php', 'cms_poly_plugin_definitions' => PATH_MODULES_FS . '/polymod/poly_plugin_definition.php', 'cms_object_i18nm' => PATH_MODULES_FS . '/polymod/object_i18nm.php', 'cms_polymod_definition_parsing' => PATH_MODULES_FS . '/polymod/poly_definition_parsing.php', 'cms_poly_module_structure' => PATH_MODULES_FS . '/polymod/poly_module_structure.php', 'cms_poly_rss_definitions' => PATH_MODULES_FS . '/polymod/poly_rss_definition.php', 'cms_block_polymod' => PATH_MODULES_FS . '/polymod/block.php', 'cms_poly_definition_functions' => PATH_MODULES_FS . '/polymod/poly_definition_functions.php', 'cms_xmltag_if' => PATH_MODULES_FS . '/polymod/tags/if.php', 'cms_xmltag_else' => PATH_MODULES_FS . '/polymod/tags/else.php', 'cms_xmltag_start' => PATH_MODULES_FS . '/polymod/tags/start.php', 'cms_xmltag_end' => PATH_MODULES_FS . '/polymod/tags/end.php', 'cms_xmltag_setvar' => PATH_MODULES_FS . '/polymod/tags/setvar.php', 'cms_polymod_oembed_definition' => PATH_MODULES_FS . '/polymod/poly_oembed_definition.php', 'cms_polymod_oembed_definition_catalog' => PATH_MODULES_FS . '/polymod/poly_oembed_definition_catalog.php');
     }
     $file = '';
     if (isset($classes[io::strtolower($classname)])) {
         $file = $classes[io::strtolower($classname)];
     } elseif (io::strpos($classname, 'CMS_object_') === 0 && file_exists(PATH_MODULES_FS . '/polymod/objects/object_' . io::substr($classname, 11) . '.php')) {
         $file = PATH_MODULES_FS . '/polymod/objects/object_' . io::substr($classname, 11) . '.php';
     } elseif (io::strpos($classname, 'CMS_subobject_') === 0 && file_exists(PATH_MODULES_FS . '/polymod/subobjects/subobject_' . io::substr($classname, 14) . '.php')) {
         $file = PATH_MODULES_FS . '/polymod/subobjects/subobject_' . io::substr($classname, 14) . '.php';
     }
     return $file;
 }
开发者ID:davidmottet,项目名称:automne,代码行数:23,代码来源:polymod.php

示例15: getAllObjects

 /**
  * Return a list of all objects of given type
  *
  * @param mixed $objectID the object ID to get names (integer or 'multi|objectID')
  * @param boolean $public are the needed datas public ? (default false)
  * @param array $searchConditions, search conditions to add. Format : array(conditionType => conditionValue)
  * @param boolean $returnObjects, search return list of objects (default) or list of objects ID
  * @param constant $searchMethod, search method used (default : false => POLYMOD_SEARCH_RETURN_OBJECTS)
  * @return array(integer objectID => string objectName)
  * @access public
  * @static
  */
 static function getAllObjects($objectID, $public = false, $searchConditions = array(), $returnObjects = true, $searchMethod = false)
 {
     $return = array();
     if (io::strpos($objectID, 'multi|') !== false) {
         $objectID = io::substr($objectID, 6);
     }
     if (!sensitiveIO::isPositiveInteger($objectID)) {
         CMS_grandFather::raiseError('objectID is not a positive integer : ' . $objectID);
         return array();
     }
     //load current object definition
     $object = CMS_poly_object_catalog::getObjectDefinition($objectID);
     $search = new CMS_object_search($object, $public);
     if (is_array($searchConditions) && $searchConditions) {
         foreach ($searchConditions as $conditionType => $conditionValue) {
             $search->addWhereCondition($conditionType, $conditionValue);
         }
     }
     if ($returnObjects) {
         if ($searchMethod !== false) {
             return $search->search($searchMethod);
         } else {
             return $search->search();
         }
     } else {
         //here in some case we can have a strange error if search result is returned directly (using function as a reference should cause this)
         $ids = $search->search(CMS_object_search::POLYMOD_SEARCH_RETURN_IDS);
         //so we use a variable
         return $ids;
     }
 }
开发者ID:davidmottet,项目名称:automne,代码行数:43,代码来源:poly_object_catalog.php


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