コード例 #1
0
/**
 * Return the folder list in provided directory
 * folders are returned with absolute path
 *
 * @param string $dir
 * @param int $mode - binary flag [1-files; 2-folders; 3-both]
 * @param boolean $recursive
 * @return array
 */
function cw_files_get_dir($dir, $mode = 1, $recursive = false)
{
    if (!is_dir($dir)) {
        return false;
    }
    // if
    $folders = array();
    if ($dirstream = @opendir($dir)) {
        while (false !== ($filename = readdir($dirstream))) {
            $path = with_slash($dir) . $filename;
            if ($filename != '.' && $filename != '..') {
                if ($mode & 1 && is_file($path)) {
                    $folders[] = $path;
                }
                if ($mode & 2 && is_dir($path)) {
                    $folders[] = $path;
                }
                if ($recursive && is_dir($path)) {
                    $sub_folders = cw_files_get_dir($path, $mode, $recursive);
                    if (is_array($sub_folders)) {
                        $folders = array_merge($folders, $sub_folders);
                    }
                    // if
                }
                // if
            }
            // if
        }
        // while
    }
    // if
    closedir($dirstream);
    return $folders;
}
コード例 #2
0
 /**
  * Settings form
  * 
  * @param void
  * @return null
  */
 function index()
 {
     js_assign('test_svn_url', assemble_url('admin_source_test_svn'));
     $source_data = $this->request->post('source');
     if (!is_foreachable($source_data)) {
         $source_data = array('svn_path' => ConfigOptions::getValue('source_svn_path'), 'svn_config_dir' => ConfigOptions::getValue('source_svn_config_dir'), 'source_svn_use_output_redirect' => ConfigOptions::getValue('source_svn_use_output_redirect'), 'source_svn_trust_server_cert' => ConfigOptions::getValue('source_svn_trust_server_cert'));
     }
     // if
     if ($this->request->isSubmitted()) {
         $svn_path = array_var($source_data, 'svn_path', null);
         $svn_path = $svn_path ? with_slash($svn_path) : null;
         ConfigOptions::setValue('source_svn_path', $svn_path);
         $svn_config_dir = array_var($source_data, 'svn_config_dir') == '' ? null : array_var($source_data, 'svn_config_dir');
         ConfigOptions::setValue('source_svn_config_dir', $svn_config_dir);
         $svn_use_output_redirection = array_var($source_data, 'source_svn_use_output_redirect') == "1";
         ConfigOptions::setValue('source_svn_use_output_redirect', $svn_use_output_redirection);
         $svn_trust_server_certificate = array_var($source_data, 'source_svn_trust_server_cert') == "1";
         ConfigOptions::setValue('source_svn_trust_server_cert', $svn_trust_server_certificate);
         flash_success("Source settings successfully saved");
         $this->redirectTo('admin_source');
     }
     // if
     if (!RepositoryEngine::executableExists()) {
         $this->wireframe->addPageMessage(lang("SVN executable not found. You won't be able to use this module"), 'error');
     }
     // if
     $this->smarty->assign(array('source_data' => $source_data));
 }
コード例 #3
0
 /**
 * Constructor
 *
 * @param void
 * @return ThemeConfigHandler
 */
 function __construct() {
   $themes_dir = with_slash(THEMES_DIR);
   
   if(is_dir($themes_dir)) {
     $d = dir($themes_dir);
     while(($entry = $d->read()) !== false) {
       if (str_starts_with($entry, '.') || $entry == "CVS") {
         continue;
       } // if
       
       if(is_dir($themes_dir . $entry)) {
         $this->available_themes[] = $entry;
       } // if
     } // while
     $d->close();
   } // if
 } // __construct
コード例 #4
0
	/**
	 * Constructor
	 *
	 * @param void
	 * @return LocalizationConfigHandler
	 */
	function __construct() {
		$language_dir = with_slash(ROOT . "/language");

		if (is_dir($language_dir)) {
			$d = dir($language_dir);
			while (($entry = $d->read()) !== false) {
				if (str_starts_with($entry, '.') || $entry == "CVS") {
					continue;
				} // if

				if (is_dir($language_dir . $entry)) {
					$this->available_locales[] = $entry;
				} // if
			} // while
			$d->close();
			sort($this->available_locales);
		} // if
	} // __construct
コード例 #5
0
 /**
 * Set repository_url value
 *
 * @param string $value
 * @return null
 */
 static function setRepositoryUrl($value) {
   self::$repository_url = with_slash($value);
 } // setRepositoryUrl
コード例 #6
0
 /**
  * Set cache dir value
  *
  * @param string $value
  * @return null
  */
 function setCacheDir($value)
 {
     $this->cache_dir = with_slash($value);
 }
コード例 #7
0
 /**
  * Execute the script
  *
  * @param void
  * @return boolean
  */
 function execute()
 {
     // ---------------------------------------------------
     //  Check MySQL version
     // ---------------------------------------------------
     $mysql_version = mysql_get_server_info($this->database_connection);
     if ($mysql_version && version_compare($mysql_version, '4.1', '>=')) {
         $constants['DB_CHARSET'] = 'utf8';
         @mysql_query("SET NAMES 'utf8'", $this->database_connection);
         tpl_assign('default_collation', $default_collation = 'collate utf8_unicode_ci');
         tpl_assign('default_charset', $default_charset = 'DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci');
     } else {
         tpl_assign('default_collation', $default_collation = '');
         tpl_assign('default_charset', $default_charset = '');
     }
     // if
     $installed_version = installed_version();
     $t_prefix = TABLE_PREFIX;
     if (version_compare($installed_version, '1.7.5') <= 0 && TABLE_PREFIX != "fo_") {
         $t_prefix = "fo_";
     }
     tpl_assign('table_prefix', $t_prefix);
     if (defined('DB_ENGINE')) {
         tpl_assign('engine', DB_ENGINE);
     } else {
         tpl_assign('engine', 'InnoDB');
     }
     // ---------------------------------------------------
     //  Execute migration
     // ---------------------------------------------------
     $additional_upgrade_steps = array();
     // RUN QUERIES
     $total_queries = 0;
     $executed_queries = 0;
     $upgrade_script = "";
     // upgrading from version 1.x
     if (version_compare($installed_version, '2.0.0.0-beta') < 0) {
         ini_set('memory_limit', '1024M');
         @set_time_limit(0);
         $upgrade_script .= tpl_fetch(get_template_path('db_migration/2_0_asado'));
         if ($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) {
             $this->printMessage("Database schema transformations executed (total queries: {$total_queries})");
         } else {
             $this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true);
             return false;
         }
         $_SESSION['from_feng1'] = true;
         $upgrade_script = "";
         @unlink(ROOT . '/cache/autoloader.php');
         include ROOT . '/environment/classes/AutoLoader.class.php';
         include ROOT . '/environment/constants.php';
         if (!($callbacks = spl_autoload_functions())) {
             $callbacks = array();
         }
         foreach ($callbacks as $callback) {
             spl_autoload_unregister($callback);
         }
         spl_autoload_register('feng_upg_autoload');
         foreach ($callbacks as $callback) {
             spl_autoload_register($callback);
         }
         @(include ROOT . '/cache/autoloader.php');
         define('DONT_LOG', true);
         define('FORCED_TABLE_PREFIX', 'fo_');
         if (!defined('FILE_STORAGE_FILE_SYSTEM')) {
             define('FILE_STORAGE_FILE_SYSTEM', 'fs');
         }
         if (!defined('FILE_STORAGE_MYSQL')) {
             define('FILE_STORAGE_MYSQL', 'mysql');
         }
         if (!defined('MAX_SEARCHABLE_FILE_SIZE')) {
             define('MAX_SEARCHABLE_FILE_SIZE', 1048576);
         }
         try {
             DB::connect(DB_ADAPTER, array('host' => DB_HOST, 'user' => DB_USER, 'pass' => DB_PASS, 'name' => DB_NAME, 'persist' => DB_PERSIST));
             if (defined('DB_CHARSET') && trim(DB_CHARSET)) {
                 DB::execute("SET NAMES ?", DB_CHARSET);
             }
         } catch (Exception $e) {
             $this->printMessage("Error connecting to database: " . $e->getMessage() . "\n" . $e->getTraceAsString());
         }
         try {
             $db_result = DB::execute("SELECT value FROM " . $t_prefix . "config_options WHERE name = 'file_storage_adapter'");
             $db_result_row = $db_result->fetchRow();
             if ($db_result_row['value'] == FILE_STORAGE_FILE_SYSTEM) {
                 if (!defined('FILES_DIR')) {
                     define('FILES_DIR', ROOT . '/upload');
                 }
                 FileRepository::setBackend(new FileRepository_Backend_FileSystem(FILES_DIR, TABLE_PREFIX));
             } else {
                 FileRepository::setBackend(new FileRepository_Backend_DB(TABLE_PREFIX));
             }
             PublicFiles::setRepositoryPath(ROOT . '/public/files');
             if (!defined('PUBLIC_FOLDER')) {
                 define('PUBLIC_FOLDER', 'public');
             }
             if (trim(PUBLIC_FOLDER) == '') {
                 PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . 'files');
             } else {
                 PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . 'public/files');
             }
             $member_parents = array();
             $members = Members::findAll();
             foreach ($members as $member) {
                 $member_parents[$member->getId()] = $member->getAllParentMembersInHierarchy(false, false);
             }
             $object_members = DB::executeAll('SELECT * FROM ' . $t_prefix . 'object_members WHERE is_optimization=0 and not exists (SELECT x.object_id FROM ' . $t_prefix . 'object_members x where x.object_id=fo_object_members.object_id and x.is_optimization=1)');
             foreach ($object_members as $om) {
                 $parents = isset($member_parents[$om['member_id']]) ? $member_parents[$om['member_id']] : array();
                 if (count($parents) > 0) {
                     $sql_values = "";
                     foreach ($parents as $p) {
                         $sql_values .= ($sql_values == "" ? "" : ",") . "(" . $om['object_id'] . "," . $p->getId() . ",1)";
                     }
                     $sql = "INSERT INTO " . $t_prefix . "object_members (object_id, member_id, is_optimization) VALUES {$sql_values} ON DUPLICATE KEY UPDATE is_optimization=1;";
                     DB::execute($sql);
                 }
             }
             $this->printMessage("Finished generating Object Members");
             foreach ($members as $m) {
                 if ($m->getParentMember() instanceof Member && $m->getDimensionId() != $m->getParentMember()->getDimensionId()) {
                     $m->setDimensionId($m->getParentMember()->getDimensionId());
                     $m->save();
                 }
             }
             $app_move_logs = ApplicationLogs::findAll(array("conditions" => "action = 'move'"));
             foreach ($app_move_logs as &$app_log) {
                 /* @var $app_log ApplicationLog */
                 $exp_log_data = explode(";", $app_log->getLogData());
                 if (count($exp_log_data) > 1) {
                     $old_to = array_var($exp_log_data, 1);
                     $old_from = array_var($exp_log_data, 0);
                 } else {
                     $old_to = array_var($exp_log_data, 0);
                     $old_from = "";
                 }
                 $to_id = str_replace("to:", "", $old_to);
                 $new_to_id = Members::instance()->findOne(array("id" => true, "conditions" => "ws_id = '{$to_id}'"));
                 if (count($new_to_id) > 0) {
                     $new_to_id = $new_to_id[0];
                 }
                 $new_from_ids = "";
                 $from_ids = str_replace("from:", "", $old_from);
                 if ($from_ids != "") {
                     $new_from_ids_array = Members::instance()->findAll(array("id" => true, "conditions" => "ws_id IN ({$from_ids})"));
                     $new_from_ids = implode(",", $new_from_ids_array);
                 }
                 if ($new_to_id) {
                     if ($new_from_ids) {
                         $log_data = "from:{$new_from_ids};to:{$new_to_id}";
                     } else {
                         $log_data = "to:{$new_to_id}";
                     }
                     $app_log->setLogData($log_data);
                     $app_log->save();
                 }
             }
         } catch (Exception $e) {
             die("\nError occurred:\n-----------------\n" . $e->getMessage() . "\n" . $e->getTraceAsString());
         }
         //tpl_assign('install_inv_dw', true);
         $additional_upgrade_steps[] = array('url' => 'complete_migration.php?out=file', 'name' => 'Fill searchable objects and sharing table', 'filename' => dirname(__FILE__) . "/../complete_migration.php");
     } else {
         // upgrading from a pre-release of this version (beta, rc, etc)
         if (version_compare($installed_version, '2.0.0.4') <= 0) {
             if (!$this->checkTableExists($t_prefix . 'role_object_type_permissions', $this->database_connection)) {
                 $upgrade_script .= "\r\n\t\t\t\t\t\tCREATE TABLE `" . $t_prefix . "role_object_type_permissions` (\r\n\t\t\t\t\t\t  `role_id` INTEGER UNSIGNED NOT NULL,\r\n\t\t\t\t\t\t  `object_type_id` INTEGER UNSIGNED NOT NULL,\r\n\t\t\t\t\t\t  `can_delete` BOOLEAN NOT NULL,\r\n\t\t\t\t\t\t  `can_write` BOOLEAN NOT NULL,\r\n\t\t\t\t\t\t  PRIMARY KEY (`role_id`, `object_type_id`)\r\n\t\t\t\t\t\t) ENGINE = InnoDB;\r\n\t\t\t\t\t\tINSERT INTO " . $t_prefix . "role_object_type_permissions (role_id, object_type_id, can_delete, can_write)\r\n\t\t\t\t\t\t SELECT p.id, o.id, 1, 1\r\n\t\t\t\t\t\t FROM `" . $t_prefix . "object_types` o JOIN `" . $t_prefix . "permission_groups` p\r\n\t\t\t\t\t\t WHERE o.`name` IN ('message','weblink','file','task','milestone','event','contact','mail','timeslot','report','comment')\r\n\t\t\t\t\t\t AND p.`name` IN ('Super Administrator','Administrator','Manager','Executive');\r\n\t\t\t\t\t\tINSERT INTO " . $t_prefix . "role_object_type_permissions (role_id, object_type_id, can_delete, can_write)\r\n\t\t\t\t\t\t SELECT p.id, o.id, 0, 1\r\n\t\t\t\t\t\t FROM `" . $t_prefix . "object_types` o JOIN `" . $t_prefix . "permission_groups` p\r\n\t\t\t\t\t\t WHERE o.`name` IN ('message','weblink','file','task','milestone','event','contact','timeslot','report','comment')\r\n\t\t\t\t\t\t AND p.`name` IN ('Collaborator Customer');\r\n\t\t\t\t\t\tINSERT INTO " . $t_prefix . "role_object_type_permissions (role_id, object_type_id, can_delete, can_write)\r\n\t\t\t\t\t\t SELECT p.id, o.id, 0, 1\r\n\t\t\t\t\t\t FROM `" . $t_prefix . "object_types` o JOIN `" . $t_prefix . "permission_groups` p\r\n\t\t\t\t\t\t WHERE o.`name` IN ('message','weblink','file','task','milestone','event','timeslot','comment')\r\n\t\t\t\t\t\t AND p.`name` IN ('Internal Collaborator','External Collaborator');\r\n\t\t\t\t\t\tINSERT INTO " . $t_prefix . "role_object_type_permissions (role_id, object_type_id, can_delete, can_write)\r\n\t\t\t\t\t\t SELECT p.id, o.id, 0, 0\r\n\t\t\t\t\t\t FROM `" . $t_prefix . "object_types` o JOIN `" . $t_prefix . "permission_groups` p\r\n\t\t\t\t\t\t WHERE o.`name` IN ('message','weblink','file','event','comment')\r\n\t\t\t\t\t\t AND p.`name` IN ('Guest Customer');\r\n\t\t\t\t\t\tINSERT INTO " . $t_prefix . "role_object_type_permissions (role_id, object_type_id, can_delete, can_write)\r\n\t\t\t\t\t\t SELECT p.id, o.id, 0, 0\r\n\t\t\t\t\t\t FROM `" . $t_prefix . "object_types` o JOIN `" . $t_prefix . "permission_groups` p\r\n\t\t\t\t\t\t WHERE o.`name` IN ('message','weblink','event','comment')\r\n\t\t\t\t\t\t AND p.`name` IN ('Guest');\r\n\t\t\t\t\t\tINSERT INTO " . $t_prefix . "role_object_type_permissions (role_id, object_type_id, can_delete, can_write)\r\n\t\t\t\t\t\t SELECT p.id, o.id, 0, 0\r\n\t\t\t\t\t\t FROM `" . $t_prefix . "object_types` o JOIN `" . $t_prefix . "permission_groups` p\r\n\t\t\t\t\t\t WHERE o.`name` IN ('message','weblink','file','task','milestone','event','contact','timeslot','report','comment')\r\n\t\t\t\t\t\t AND p.`name` IN ('Non-Exec Director');\r\n\t\t\t\t\t\tUPDATE " . $t_prefix . "role_object_type_permissions SET can_write = 1 WHERE object_type_id = (SELECT id FROM " . $t_prefix . "object_types WHERE name='comment');\r\n\t\t\t\t\t";
             }
             if (!$this->checkTableExists($t_prefix . 'widgets', $this->database_connection)) {
                 $upgrade_script .= "\r\n\t\t\t\t\t\tCREATE TABLE  `" . $t_prefix . "widgets` (\r\n\t\t\t\t\t\t  `name` varchar(64) NOT NULL,\r\n\t\t\t\t\t\t  `title` varchar(255) NOT NULL,\r\n\t\t\t\t\t\t  `plugin_id` int(10) unsigned NOT NULL,\r\n\t\t\t\t\t\t  `path` varchar(512) NOT NULL,\r\n\t\t\t\t\t\t  `default_options` text NOT NULL,\r\n\t\t\t\t\t\t  `default_section` varchar(64) NOT NULL,\r\n\t\t\t\t\t\t  `default_order` int(10) NOT NULL,\r\n\t\t\t\t\t\t  PRIMARY KEY (`name`)\r\n\t\t\t\t\t\t) ENGINE = InnoDB;\r\n\t\t\t\t\t";
             }
             if ($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) {
                 $this->printMessage("Database schema transformations executed (total queries: {$total_queries})");
             } else {
                 $this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true);
                 return false;
             }
         }
         if (version_compare($installed_version, '2.0.0.5') <= 0) {
             if (!$this->checkColumnExists($t_prefix . 'contacts', 'default_billing_id', $this->database_connection)) {
                 $upgrade_script = "\r\n\t\t\t\t\t\tALTER TABLE `" . $t_prefix . "contacts` ADD COLUMN `default_billing_id` INTEGER NOT NULL DEFAULT 0;\r\n\t\t\t\t\t\tALTER TABLE `" . $t_prefix . "project_tasks`\r\n\t\t\t\t\t\t ADD COLUMN `use_due_time` BOOLEAN DEFAULT 0,\r\n\t\t\t\t\t\t ADD COLUMN `use_start_time` BOOLEAN DEFAULT 0;\r\n\t\t\t\t\t\tUPDATE " . $t_prefix . "project_tasks t SET\r\n\t\t\t\t\t\t t.due_date = ADDTIME(t.due_date, CONCAT(SUBSTRING_INDEX((SELECT c.timezone FROM " . $t_prefix . "contacts c WHERE c.object_id=(SELECT o.updated_by_id FROM " . $t_prefix . "objects o WHERE o.id=t.object_id)), '.', 1), ':', SUBSTRING_INDEX(abs((SELECT c.timezone FROM " . $t_prefix . "contacts c WHERE c.object_id=(SELECT o.updated_by_id FROM " . $t_prefix . "objects o WHERE o.id=t.object_id)) % 1)*60, '.', 1)))\r\n\t\t\t\t\t\t WHERE t.due_date > 0;\r\n\t\t\t\t\t\tUPDATE " . $t_prefix . "project_tasks t SET\r\n\t\t\t\t\t\t t.start_date = ADDTIME(t.start_date, CONCAT(SUBSTRING_INDEX((SELECT c.timezone FROM " . $t_prefix . "contacts c WHERE c.object_id=(SELECT o.updated_by_id FROM " . $t_prefix . "objects o WHERE o.id=t.object_id)), '.', 1), ':', SUBSTRING_INDEX(abs((SELECT c.timezone FROM " . $t_prefix . "contacts c WHERE c.object_id=(SELECT o.updated_by_id FROM " . $t_prefix . "objects o WHERE o.id=t.object_id)) % 1)*60, '.', 1)))\r\n\t\t\t\t\t\t WHERE t.start_date > 0;\r\n\t\t\t\t\t\tINSERT INTO `" . $t_prefix . "contact_config_options` (`category_name`, `name`, `default_value`, `config_handler_class`, `is_system`, `option_order`, `dev_comment`) VALUES\r\n\t\t\t\t\t\t ('general', 'work_day_end_time', '18:00', 'TimeConfigHandler', 0, 410, 'Work day end time');\t\t\t\t\t\t\r\n\t\t\t\t\t";
             }
             if ($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) {
                 $this->printMessage("Database schema transformations executed (total queries: {$total_queries})");
             } else {
                 $this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true);
                 return false;
             }
         }
         if (version_compare($installed_version, '2.0.0.6') <= 0) {
             //WS Widgets
             $upgrade_script = "\r\n\t\t\t\t\tUPDATE `" . $t_prefix . "contact_config_options` SET `default_value` = '15' WHERE `" . $t_prefix . "contact_config_options`.`name` = 'noOfTasks' LIMIT 1 ;\r\n\t\t\t\t\tUPDATE " . $t_prefix . "widgets SET default_section = 'none' WHERE name = 'people' AND NOT EXISTS (SELECT id from " . $t_prefix . "plugins WHERE name = 'crpm');\r\n\t\t\t\t\tUPDATE " . $t_prefix . "dimensions SET options = '{\"defaultAjax\":{\"controller\":\"dashboard\", \"action\": \"main_dashboard\"}, \"quickAdd\":true,\"showInPaths\":true}' \r\n\t\t\t\t\t\tWHERE  code='workspaces';\r\n\t\t\t\t\tUPDATE `" . $t_prefix . "tab_panels` SET default_action = 'main_dashboard', initial_action = 'main_dashboard'\r\n\t\t\t\t\t\tWHERE id = 'overview-panel' ;\r\n\t\t\t\t\tUPDATE " . $t_prefix . "object_types SET type = 'dimension_object', handler_class='Workspaces', table_name = 'workpaces' WHERE name = 'workspace' ;\r\n\t\t\t\t\tUPDATE " . $t_prefix . "dimension_object_types SET OPTIONS = '{\"defaultAjax\":{\"controller\":\"dashboard\", \"action\": \"main_dashboard\"}}' \r\n\t\t\t\t\t\tWHERE dimension_id = (SELECT id FROM " . $t_prefix . "dimensions WHERE code = 'workspaces');\r\n\t\t\t\t\tCREATE TABLE IF NOT EXISTS `" . $t_prefix . "contact_widgets` (\r\n\t\t\t\t\t  `widget_name` varchar(40) NOT NULL,\r\n\t\t\t\t\t  `contact_id` int(11) NOT NULL,\r\n\t\t\t\t\t  `section` varchar(40) NOT NULL,\r\n\t\t\t\t\t  `order` int(11) NOT NULL,\r\n\t\t\t\t\t  `options` varchar(255) NOT NULL,\r\n\t\t\t\t\t  PRIMARY KEY (`widget_name`,`contact_id`) USING BTREE\r\n\t\t\t\t\t) ENGINE=InnoDB;\r\n\t\t\t\t\tINSERT INTO " . $t_prefix . "widgets(name, title, plugin_id, default_section,default_order) \r\n\t\t\t\t\t VALUES ('messages','notes',0,'none',1000)\r\n\t\t\t\t\t ON DUPLICATE KEY update name = name;\r\n\t\t\t\t\tINSERT INTO " . $t_prefix . "dimension_object_type_contents (dimension_id, dimension_object_type_id, content_object_type_id, is_required, is_multiple)\r\n\t\t\t\t\t SELECT d.id, ot.id, (SELECT tmp.id FROM " . $t_prefix . "object_types tmp WHERE tmp.name='contact'), 0, 1\r\n\t\t\t\t\t FROM " . $t_prefix . "dimensions d JOIN " . $t_prefix . "object_types ot\r\n\t\t\t\t\t WHERE d.code = 'customer_project' AND ot.name IN ('customer', 'project', 'folder', 'customer_folder', 'project_folder')\r\n\t\t\t\t\tON DUPLICATE KEY UPDATE dimension_id=dimension_id;\r\n\t\t\t\t\tUPDATE " . $t_prefix . "dimension_object_type_contents SET is_multiple = 1 WHERE content_object_type_id = (SELECT id FROM " . $t_prefix . "object_types WHERE name='mail');\r\n\t\t\t\t";
             if (@mysql_fetch_row(@mysql_query("SELECT id from " . $t_prefix . "plugins WHERE name = 'workspaces'"))) {
                 $upgrade_script .= "INSERT INTO " . $t_prefix . "widgets(name, title, plugin_id, default_section,default_order) \r\n\t\t\t\t\t\tVALUES ('ws_description', 'workspace description',(SELECT id from " . $t_prefix . "plugins WHERE name = 'workspaces'), 'left',-100)\r\n\t\t\t\t\t\tON DUPLICATE KEY update name = name ;";
             }
             if ($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) {
                 $this->printMessage("Database schema transformations executed (total queries: {$total_queries})");
             } else {
                 $this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true);
                 return false;
             }
             if ($obj = @mysql_fetch_object(@mysql_query("SELECT id FROM " . $t_prefix . "object_types WHERE name = 'workspace' "))) {
                 $wsTypeId = $obj->id;
                 $res = @mysql_query("SELECT * FROM " . $t_prefix . "members WHERE dimension_id = (SELECT id FROM " . $t_prefix . "dimensions WHERE code='workspaces')");
                 while ($m = @mysql_fetch_object($res)) {
                     @mysql_query("INSERT INTO " . $t_prefix . "objects (object_type_id, name) VALUES ({$wsTypeId}, '" . $m->name . "' )");
                     if ($id = @mysql_insert_id()) {
                         @mysql_query("INSERT INTO " . $t_prefix . "workspaces (object_id) VALUES ({$id})");
                         @mysql_query("UPDATE " . $t_prefix . "members SET object_id={$id} WHERE id = {$m->id} ");
                     }
                 }
             }
         }
         if (version_compare($installed_version, '2.0.0.7') <= 0) {
             $upgrade_script = "";
             if (!$this->checkTableExists($t_prefix . 'mail_spam_filters', $this->database_connection)) {
                 $upgrade_script .= "\r\n                                                    CREATE TABLE IF NOT EXISTS `" . $t_prefix . "mail_spam_filters` (\r\n                                                     `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\r\n                                                     `account_id` int(10) unsigned NOT NULL,\r\n                                                     `text_type` enum('email_address','subject') COLLATE utf8_unicode_ci NOT NULL,\r\n                                                     `text` text COLLATE utf8_unicode_ci NOT NULL,\r\n                                                     `spam_state` enum('no spam','spam') COLLATE utf8_unicode_ci NOT NULL,\r\n                                                     PRIMARY KEY (`id`)\r\n                                                    ) ENGINE=InnoDB;\r\n                                        ";
             }
             $upgrade_script .= "INSERT INTO `" . $t_prefix . "config_options` (`category_name`, `name`, `value`, `config_handler_class`, `is_system`, `option_order`, `dev_comment`) \r\n\t\t\t\t\tVALUES ('general', 'untitled_notes', '0', 'BoolConfigHandler', '0', '0', NULL) ON DUPLICATE KEY UPDATE name=name;";
             if ($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) {
                 $this->printMessage("Database schema transformations executed (total queries: {$total_queries})");
             } else {
                 $this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true);
                 return false;
             }
         }
         if (version_compare($installed_version, '2.0.0.8') < 0) {
             $upgrade_script = "";
             if (!$this->checkTableExists($t_prefix . 'external_calendar_users', $this->database_connection)) {
                 $upgrade_script .= "\r\n                                                    CREATE TABLE IF NOT EXISTS `" . $t_prefix . "external_calendar_users` (\r\n                                                      `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\r\n                                                      `contact_id` int(10) unsigned NOT NULL,\r\n                                                      `auth_user` varchar(100) COLLATE utf8_unicode_ci NOT NULL,\r\n                                                      `auth_pass` varchar(100) COLLATE utf8_unicode_ci NOT NULL,\r\n                                                      `type` text COLLATE utf8_unicode_ci NOT NULL,\r\n                                                      `sync` TINYINT( 1 ) NULL DEFAULT '0',\r\n                                                      PRIMARY KEY (`id`)\r\n                                                    ) ENGINE = InnoDB;\r\n\t\t\t\t\t";
             }
             if (!$this->checkTableExists($t_prefix . 'external_calendars', $this->database_connection)) {
                 $upgrade_script .= "\r\n                                                    CREATE TABLE IF NOT EXISTS `" . $t_prefix . "external_calendars` (\r\n                                                      `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\r\n                                                      `ext_cal_user_id` int(10) unsigned NOT NULL,\r\n                                                      `calendar_user` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\r\n                                                      `calendar_visibility` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\r\n                                                      `calendar_name` text COLLATE utf8_unicode_ci NOT NULL,\r\n                                                      `calendar_feng` TINYINT( 1 ) NOT NULL DEFAULT '0',\r\n                                                      PRIMARY KEY (`id`)\r\n                                                    ) ENGINE = InnoDB;\r\n\t\t\t\t\t";
             }
             if (!$this->checkColumnExists($t_prefix . 'project_events', 'ext_cal_id', $this->database_connection)) {
                 $upgrade_script .= "\r\n\t\t\t\t\t\tALTER TABLE `" . $t_prefix . "project_events`  ADD `ext_cal_id` INT(10) UNSIGNED NOT NULL;\r\n\t\t\t\t\t";
             }
             $upgrade_script .= "\r\n\t\t\t\t\tALTER TABLE `" . $t_prefix . "project_events` CHANGE `special_id` `special_id` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;\r\n\t\t\t\t\tUPDATE `" . $t_prefix . "file_types` SET `is_searchable` = '1' WHERE `extension` = 'docx';\r\n\t\t\t\t\tUPDATE `" . $t_prefix . "file_types` SET `is_searchable` = '1' WHERE `extension` = 'pdf';\r\n\t\t\t\t\tINSERT INTO `" . $t_prefix . "config_options` (`category_name`, `name`, `value`, `config_handler_class`, `is_system`, `option_order`, `dev_comment`)\r\n\t\t\t\t\t\tVALUES ('general', 'repeating_task', '0', 'BoolConfigHandler', '0', '0', '')\r\n\t\t\t\t\tON DUPLICATE KEY UPDATE name=name;\r\n\t\t\t\t\tINSERT INTO `" . $t_prefix . "contact_config_options` (`category_name`, `name`, `default_value`, `config_handler_class`, `is_system`, `option_order`, `dev_comment`)\r\n\t\t\t\t\t\tVALUES ('calendar panel', 'calendar task filter', 'pending', 'StringConfigHandler', '1', '0', NULL),\r\n\t\t\t\t\t\t\t('task panel', 'close timeslot open', '1', 'BoolConfigHandler', '0', '0', NULL),\r\n\t\t\t\t\t\t\t('calendar panel', 'reminders_events', 'reminder_email,1,60', 'StringConfigHandler', '0', '0', NULL)\r\n\t\t\t\t\tON DUPLICATE KEY UPDATE name=name;\r\n\t\t\t\t\tINSERT INTO `" . $t_prefix . "cron_events` (`name`, `recursive`, `delay`, `is_system`, `enabled`, `date`)\r\n\t\t\t\t\t\tVALUES ('import_google_calendar', '1', '10', '0', '0', '0000-00-00 00:00:00'),\r\n\t\t\t\t\t\t\t('export_google_calendar', '1', '10', '0', '0', '0000-00-00 00:00:00')\r\n\t\t\t\t\tON DUPLICATE KEY UPDATE name=name;\r\n\t\t\t\t\t";
             $upgrade_script .= "\r\n\t\t\t\t\tDELETE FROM `" . $t_prefix . "config_options` WHERE `name`='use_time_in_task_dates' AND NOT EXISTS (SELECT id FROM `" . $t_prefix . "plugins` WHERE `name`='crpm' AND is_activated=1);\r\n\t\t\t\t\tINSERT INTO " . $t_prefix . "contact_config_options (category_name, name, default_value, config_handler_class, is_system, option_order) VALUES\r\n\t\t\t\t\t\t('general','show_object_direct_url',0,'BoolConfigHandler',0,0),\r\n\t\t\t\t\t\t('general','drag_drop_prompt','prompt','DragDropPromptConfigHandler',0,0)\r\n\t\t\t\t\t ON DUPLICATE KEY UPDATE name = name;\r\n\t\t\t\t";
             $upgrade_script .= "\r\n\t\t\t\t\tINSERT INTO `" . $t_prefix . "tab_panels` (`id`,`title`,`icon_cls`,`refresh_on_context_change`,`default_controller`,`default_action`,`initial_controller`,`initial_action`,`enabled`,`type`,`ordering`,`plugin_id`,`object_type_id`) VALUES \r\n\t\t\t\t\t('contacts-panel','contacts','ico-contacts',1,'contact','init','','',0,'system',7,0,16) ON DUPLICATE KEY UPDATE title=title;\r\n\t\t\t\t";
             if ($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) {
                 $this->printMessage("Database schema transformations executed (total queries: {$total_queries})");
             } else {
                 $this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true);
                 return false;
             }
         }
         if (version_compare($installed_version, '2.0.1') < 0) {
             $upgrade_script = "";
             $upgrade_script .= "INSERT INTO `" . $t_prefix . "config_options` (`category_name`, `name`, `value`, `config_handler_class`, `is_system`, `option_order`, `dev_comment`)\r\n\t\t\t\t\tVALUES ('general', 'working_days', '1,2,3,4,5,6,7', 'StringConfigHandler', '0', '0', NULL);\r\n\t\t\t\t\tALTER TABLE `" . $t_prefix . "project_tasks` ADD `original_task_id` INT( 10 ) UNSIGNED NULL DEFAULT '0';\r\n\t\t\t\t\tALTER TABLE `" . $t_prefix . "project_tasks` ADD `type_content` ENUM( 'text', 'html' ) NOT NULL DEFAULT 'text';\r\n\t\t\t\t\tALTER TABLE `" . $t_prefix . "project_events` ADD `original_event_id` INT( 10 ) UNSIGNED NULL DEFAULT '0';\r\n\t\t\t\t\tALTER TABLE `" . $t_prefix . "project_messages` ADD `type_content` ENUM( 'text', 'html' ) NOT NULL DEFAULT 'text';\r\n\t\t\t\t";
             $upgrade_script .= "INSERT INTO `" . $t_prefix . "config_options` (`category_name`, `name`, `value`, `config_handler_class`, `is_system`, `option_order`, `dev_comment`)\r\n\t\t\t\t\tVALUES ('general', 'wysiwyg_tasks', '0', 'BoolConfigHandler', '0', '0', NULL),\r\n\t\t\t\t\t('general', 'wysiwyg_messages', '0', 'BoolConfigHandler', '0', '0', NULL),\r\n\t\t\t\t\t('task panel', 'tasksShowTimeEstimates', '1', 'BoolConfigHandler', '1', '0', NULL)\r\n\t\t\t\tON DUPLICATE KEY UPDATE name=name;\r\n\t\t\t\t";
             $upgrade_script .= "UPDATE `" . $t_prefix . "widgets` SET plugin_id = (SELECT id FROM `" . $t_prefix . "plugins` WHERE name='workspaces') WHERE name='workspaces';\r\n\t\t\t\t";
             // clean old users dimension
             $upgrade_script .= "DELETE FROM `" . $t_prefix . "object_members` WHERE member_id IN (SELECT `id` FROM `" . $t_prefix . "members` WHERE `dimension_id` IN (SELECT `id` FROM `" . $t_prefix . "dimensions` WHERE `code`='feng_users'));\r\n\t\t\t\t\tDELETE FROM `" . $t_prefix . "contact_dimension_permissions` WHERE dimension_id IN (SELECT `id` FROM `" . $t_prefix . "dimensions` WHERE `code`='feng_users');\r\n\t\t\t\t\tDELETE FROM `" . $t_prefix . "members` WHERE dimension_id IN (SELECT `id` FROM `" . $t_prefix . "dimensions` WHERE `code`='feng_users');\r\n\t\t\t\t\tDELETE FROM `" . $t_prefix . "dimension_object_type_contents` WHERE dimension_id IN (SELECT `id` FROM `" . $t_prefix . "dimensions` WHERE `code`='feng_users');\r\n\t\t\t\t\tDELETE FROM `" . $t_prefix . "dimension_object_type_hierarchies` WHERE dimension_id IN (SELECT `id` FROM `" . $t_prefix . "dimensions` WHERE `code`='feng_users');\r\n\t\t\t\t\tDELETE FROM `" . $t_prefix . "dimension_object_types` WHERE dimension_id IN (SELECT `id` FROM `" . $t_prefix . "dimensions` WHERE `code`='feng_users');\r\n\t\t\t\t\tDELETE FROM `" . $t_prefix . "dimensions` WHERE code='feng_users';\r\n\t\t\t\t\tDELETE FROM `" . $t_prefix . "object_types` WHERE name='user';\r\n\t\t\t\t\tUPDATE " . $t_prefix . "contacts c SET c.personal_member_id = 0 WHERE c.user_type>0 AND NOT (SELECT count(m2.id) FROM " . $t_prefix . "members m2 WHERE m2.object_id=c.personal_member_id)=0;\r\n\t\t\t\t";
             if ($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) {
                 $this->printMessage("Database schema transformations executed (total queries: {$total_queries})");
             } else {
                 $this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true);
                 return false;
             }
         }
         // Plugin Version Support
         $upgrade_script = '';
         if (!$this->checkColumnExists($t_prefix . "plugins", 'version', $this->database_connection)) {
             $upgrade_script = 'ALTER TABLE ' . $t_prefix . 'plugins ADD COLUMN `version` INTEGER  NOT NULL  DEFAULT 1 AFTER `name` ';
             if ($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) {
                 $this->printMessage("Database schema transformations executed (total queries: {$total_queries})");
             } else {
                 $this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true);
                 return false;
             }
         }
     }
     $this->printMessage('Feng Office has been upgraded. You are now running Feng Office ' . $this->getVersionTo() . ' Enjoy!');
     tpl_assign('additional_steps', $additional_upgrade_steps);
 }
コード例 #8
0
ファイル: files.php プロジェクト: bklein01/Project-Pier
/**
 * Return size of a specific dir in bytes
 *
 * @access public
 * @param string $dir Directory
 * @return integer
 */
function dir_size($dir)
{
    $totalsize = 0;
    if ($dirstream = @opendir($dir)) {
        while (false !== ($filename = readdir($dirstream))) {
            if ($filename != "." && $filename != "..") {
                $path = with_slash($dir) . $filename;
                if (is_file($path)) {
                    $totalsize += filesize($path);
                }
                if (is_dir($path)) {
                    $totalsize += dir_size($path);
                }
            }
            // if
        }
        // while
    }
    // if
    closedir($dirstream);
    return $totalsize;
}
コード例 #9
0
function cw_md_cleanup_skin($dir, $dir_, $int = '')
{
    global $app_dir;
    $int = with_leading_slash($int);
    if (!cw_allowed_path($app_dir, $dir . $int)) {
        return false;
    }
    if (!cw_allowed_path($app_dir, $dir_ . $int)) {
        return false;
    }
    $status = array();
    if (is_dir($dir . $int)) {
        if ($handle = opendir($dir . $int)) {
            while ($file = readdir($handle)) {
                if ($file == "." || $file == "..") {
                    continue;
                }
                $full = $int . $file;
                $is_dir = is_dir($dir . $full);
                if ($is_dir) {
                    $status = array_merge($status, cw_md_cleanup_skin($dir, $dir_, with_slash($full)));
                    if (cw_is_empty_dir($dir_ . $full)) {
                        cw_rm_dir($dir_ . $full);
                        $status[] = '[ ] Dir ' . $dir_ . $full . ' removed';
                    }
                } elseif (in_array(pathinfo($full, PATHINFO_EXTENSION), array('tpl', 'css', 'js', 'gif', 'png', 'jpg', 'jpeg', 'bmp'), true)) {
                    if (file_exists($dir_ . $full)) {
                        $md5 = md5_file($dir . $full);
                        $md5_ = md5_file($dir_ . $full);
                        $same = $md5 == $md5_;
                        if ($same) {
                            if (!unlink($dir_ . $full)) {
                                $status[] = '[!] Can\'t remove file: ' . $dir_ . $full;
                            } else {
                                $status[] = '[ ] File ' . $dir_ . $full . ' removed';
                            }
                        } else {
                            $status[] = '[*] File ' . $dir_ . $full . ' differs';
                        }
                    }
                }
            }
            closedir($handle);
        } else {
            $status[] = '[!] Can\'t open ' . $dir . $int . " directory  (need to check permissions)";
        }
    }
    return $status;
}
コード例 #10
0
ファイル: page.php プロジェクト: rjv/Project-Pier
 /**
 * Return URL relative to public folder
 *
 * @param string $rel
 * @return string
 */
 function get_public_url($rel) {
   $base = trim(PUBLIC_FOLDER) == '' ? with_slash(ROOT_URL) : with_slash(with_slash(ROOT_URL) . PUBLIC_FOLDER);
   return $base . $rel;
 } // get_public_url
コード例 #11
0
ファイル: application.php プロジェクト: bklein01/Project-Pier
        VersionChecker::check(false);
    }
    // if
    if (config_option('file_storage_adapter', 'mysql') == FILE_STORAGE_FILE_SYSTEM) {
        trace(__FILE__, 'FileRepository::setBackend() - use file storage');
        FileRepository::setBackend(new FileRepository_Backend_FileSystem(FILES_DIR));
    } else {
        trace(__FILE__, 'FileRepository::setBackend() - use mysql storage');
        FileRepository::setBackend(new FileRepository_Backend_MySQL(DB::connection()->getLink(), TABLE_PREFIX));
    }
    // if
    PublicFiles::setRepositoryPath(ROOT . '/public/files');
    if (trim(PUBLIC_FOLDER) == '') {
        PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . 'files');
    } else {
        PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . PUBLIC_FOLDER . '/files');
    }
    // if
    // Owner company or administrator doen't exist? Let the user create them
} catch (OwnerCompanyDnxError $e) {
    Env::executeAction('access', 'complete_installation');
} catch (AdministratorDnxError $e) {
    Env::executeAction('access', 'complete_installation');
    // Other type of error? We need to break here
} catch (Exception $e) {
    trace(__FILE__, '- catch ' . $e);
    if (Env::isDebugging()) {
        Env::dumpError($e);
    } else {
        Logger::log($e, Logger::FATAL);
        Env::executeAction('error', 'system');
コード例 #12
0
ファイル: files.php プロジェクト: Jtgadbois/Pedadida
function force_mkdir_from_base($base, $path, $chmod = null) {
	if(is_dir(with_slash($base).$path)) return true;
	$real_path = str_replace('\\', '/', $path);
	$parts = explode('/', $real_path);
	 
	$forced_path = '';
	foreach($parts as $part) {
		if($part !='')
		{
			// Skip first on windows
			if($forced_path == '') {
				$forced_path = with_slash($base) . $part;
			} else {
				$forced_path .= '/' . $part;
			} // if
			if(!is_dir($forced_path)) {
				if(!is_null($chmod)) {
					if(!mkdir($forced_path)) return false;
				} else {
					if(!mkdir($forced_path, $chmod)) return false;
				} // if
			} // if
		} // if
	} // foreach
	 
	return true;
} // force_mkdir
コード例 #13
0
 private function check_valid_localization($localization)
 {
     $language_dir = with_slash(ROOT . "/language");
     $result = false;
     if (is_dir($language_dir)) {
         $d = dir($language_dir);
         while (!$result && ($entry = $d->read()) !== false) {
             if (str_starts_with($entry, '.') || str_starts_with($entry, '..') || $entry == "CVS") {
                 continue;
             }
             $result = is_dir($language_dir . $entry) && $entry == $localization;
         }
         $d->close();
     }
     return $result;
 }
コード例 #14
0
ファイル: files.php プロジェクト: NaszvadiG/activecollab_loc
/**
 * Walks recursively through directory and calculates its total size - returned in bytes
 *
 * @param string $dir Directory
 * @param boolean $skip_files_starting_with_dot (Hidden files)
 * @return integer
 */
function dir_size($dir, $skip_files_starting_with_dot = true)
{
    $totalsize = 0;
    if ($dirstream = @opendir($dir)) {
        while (false !== ($filename = readdir($dirstream))) {
            if ($skip_files_starting_with_dot) {
                if ($filename != '.' && $filename != '..' && $filename[0] != '.') {
                    $path = with_slash($dir) . $filename;
                    if (is_file($path)) {
                        $totalsize += filesize($path);
                    }
                    if (is_dir($path)) {
                        $totalsize += dir_size($path, $skip_files_starting_with_dot);
                    }
                }
                // if
            } else {
                if ($filename != '.' && $filename != '..') {
                    $path = with_slash($dir) . $filename;
                    if (is_file($path)) {
                        $totalsize += filesize($path);
                    }
                    if (is_dir($path)) {
                        $totalsize += dir_size($path, $skip_files_starting_with_dot);
                    }
                }
                // if
            }
        }
        // while
    }
    // if
    closedir($dirstream);
    return $totalsize;
}
コード例 #15
0
ファイル: page.php プロジェクト: pnagaraju25/fengoffice
/**
 * Add a favicon to page
 *
 * @access public
 * @param string $src URL of favicon
 * @return string
 */
function add_favicon_to_page($src)
{
    $page = PageDescription::instance();
    $page->addRelLink(with_slash(ROOT_URL) . $src, 'shortcut icon', null);
}
コード例 #16
0
ファイル: init.php プロジェクト: pnagaraju25/fengoffice
    Logger::log("Javascript injection from " . $_SERVER['REMOTE_ADDR'] . " in URL:" . $url);
    remove_scripts_and_redirect($url);
}
// Get controller and action and execute...
try {
    if (!defined('CONSOLE_MODE')) {
        Env::executeAction(request_controller(), request_action()) or DB::rollback();
    }
} catch (Exception $e) {
    if (Env::isDebugging()) {
        Logger::log($e, Logger::FATAL);
        Env::dumpError($e);
    } else {
        Logger::log($e, Logger::FATAL);
        redirect_to(get_url('error', 'execute_action'));
    }
    // if
}
// try
if (Env::isDebuggingTime()) {
    TimeIt::stop();
    $report = TimeIt::getTimeReportByType();
    //Logger::log(array_var($_SERVER, 'QUERY_STRING', 'No query string')."\n$report");
    //$report = "\n";
    /*foreach (TimeIt::$timeslots as $t) {
    		$report .= $t["type"] . ": (" . $t["start"] . ", " . $t["end"] . ")\n";
    	}*/
    //Logger::log($report);
    $to_log = gmdate("Y-m-d H:i:s") . "\n" . array_var($_SERVER, 'QUERY_STRING', 'No query string') . "\n{$report}--------------------------------------------------------\n\n";
    file_put_contents(with_slash(CACHE_DIR) . "log_request_times.txt", $to_log, FILE_APPEND);
}
コード例 #17
0
 /**
  * Return path of file where we save file attributes
  *
  * @param void
  * @return string
  */
 protected function getAttributesFilePath()
 {
     return with_slash($this->getRepositoryDir()) . 'attributes.php';
 }
コード例 #18
0
/**
 * get list of folder names in feedback folder
 * 
 * @param timestamp $time - start time (name)
 * @return array $folders - list folder name, not path
 */
function cw_fbr_get_feedback_folder_list($time)
{
    global $app_dir;
    $dir = $app_dir . '/files/' . feedback_files_folder_name;
    if (is_dir($dir) && $time) {
        $folders = array();
        if ($dirstream = @opendir($dir)) {
            while (false !== ($filename = readdir($dirstream))) {
                $path = with_slash($dir) . $filename;
                if ($filename != '.' && $filename != '..' && is_dir($path)) {
                    list($check_name, $counter) = explode('_', $filename);
                    $check_name = intval($check_name);
                    // if folder is in time period
                    if ($check_name >= $time + 1) {
                        $folders[] = $filename;
                    }
                }
            }
        }
        closedir($dirstream);
        return $folders;
    }
    return array();
}
コード例 #19
0
ファイル: website.php プロジェクト: pnagaraju25/fengoffice
if (is_file(PUBLIC_FOLDER . "/assets/themes/{$theme}/stylesheets/custom.css")) {
    echo stylesheet_tag('custom.css');
}
$css = array();
Hook::fire('autoload_stylesheets', null, $css);
foreach ($css as $c) {
    echo stylesheet_tag($c);
}
if (defined('COMPRESSED_JS') && COMPRESSED_JS) {
    $jss = array("ogmin.js");
} else {
    $jss = (include "javascripts.php");
}
Hook::fire('autoload_javascripts', null, $jss);
if (defined('USE_JS_CACHE') && USE_JS_CACHE) {
    echo add_javascript_to_page(with_slash(ROOT_URL) . "public/tools/combine.php?version={$version}&type=javascript&files=" . implode(',', $jss));
} else {
    foreach ($jss as $onejs) {
        echo add_javascript_to_page($onejs);
    }
}
$ext_lang_file = get_ext_language_file(get_locale());
if ($ext_lang_file) {
    echo add_javascript_to_page("extjs/locale/{$ext_lang_file}");
}
echo add_javascript_to_page("ckeditor/ckeditor.js");
?>
	<?php 
if (config_option("show_feed_links")) {
    ?>
		<link rel="alternate" type="application/rss+xml" title="<?php 
コード例 #20
0
ファイル: functions.php プロジェクト: Jtgadbois/Pedadida
function get_sandbox_url($controller_name = null, $action_name = null, $params = null, $anchor = null, $include_project_id = false) {
	$controller = trim($controller_name) ? $controller_name : DEFAULT_CONTROLLER;
	$action = trim($action_name) ? $action_name : DEFAULT_ACTION;
	if(!is_array($params) && !is_null($params)) {
		$params = array('id' => $params);
	} // if

	$url_params = array('c=' . $controller, 'a=' . $action);

	if($include_project_id) {
		if(function_exists('active_project') && (active_project() instanceof Project)) {
			if(!(is_array($params) && isset($params['active_project']))) {
				$url_params[] = 'active_project=' . active_project()->getId();
			} // if
		} // if
	} // if

	if(is_array($params)) {
		foreach($params as $param_name => $param_value) {
			if(is_bool($param_value)) {
				$url_params[] = $param_name . '=1';
			} else {
				$url_params[] = $param_name . '=' . urlencode($param_value);
			} // if
		} // foreach
	} // if

	if(trim($anchor) <> '') {
		$anchor = '#' . $anchor;
	} // if

	if (defined('SANDBOX_URL')) {
		return with_slash(SANDBOX_URL) . 'index.php?' . implode('&', $url_params) . $anchor;
	} else {
		return with_slash(ROOT_URL) . 'index.php?' . implode('&', $url_params) . $anchor;
	}
} // get_sandbox_url
コード例 #21
0
 /**
  * Assemle URL based on provided input data
  * 
  * This function will use input data and put it into route string. It can 
  * return relative path based on the route string or absolute URL 
  * (PROJECT_URL constant will be used as a base)
  *
  * @param array $data
  * @param string $url_base
  * @param string $query_arg_separator
  * @param string $anchor
  * @return string
  * @throws AssembleURLError
  */
 function assemble($data, $url_base, $query_arg_separator, $anchor = '')
 {
     if (!is_array($data)) {
         if ($data === null) {
             $data = array();
         } else {
             $data = array('id' => $data);
         }
         // if
     }
     // if
     $path_parts = array();
     $part_names = array();
     foreach ($this->parts as $key => $part) {
         if (isset($part['name'])) {
             $part_name = $part['name'];
             $part_names[] = $part_name;
             if (isset($data[$part_name])) {
                 $path_parts[$key] = $data[$part_name];
             } elseif (isset($this->defaults[$part_name])) {
                 $path_parts[$key] = $this->defaults[$part_name];
             } else {
                 use_error('AssembleURLError');
                 return new AssembleURLError($this->getRouteString(), $data, $this->getDefaults());
             }
             // if
         } else {
             $path_parts[$key] = $part['regex'];
         }
         // if
     }
     // foreach
     $query_parts = array();
     foreach ($data as $k => $v) {
         if (!in_array($k, $part_names)) {
             $query_parts[$k] = $v;
         }
         // if
     }
     // foreach
     if (PATH_INFO_THROUGH_QUERY_STRING) {
         $url = $url_base;
         $query_parts = array_merge(array('path_info' => implode('/', $path_parts)), $query_parts);
     } else {
         $url = with_slash($url_base) . implode('/', $path_parts);
         if (!str_ends_with($url, '/') && str_ends_with($this->route_string, '/')) {
             $url .= '/';
         }
         // if
     }
     // if
     if (count($query_parts)) {
         if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
             $url .= '?' . http_build_query($query_parts, '', $query_arg_separator);
         } else {
             $url .= '?' . http_build_query($query_parts, '');
         }
         // if
     }
     // if
     $trimmed_anchor = trim($anchor);
     if ($trimmed_anchor) {
         $url .= '#' . $anchor;
     }
     // if
     return $url;
 }
コード例 #22
0
ファイル: application.php プロジェクト: abhinay100/feng_app
            VersionChecker::check(true);
        }
    }
    $locale = get_locale();
    Localization::instance()->loadSettings($locale, ROOT . '/language');
    if (config_option('file_storage_adapter', 'mysql') == FILE_STORAGE_FILE_SYSTEM) {
        FileRepository::setBackend(new FileRepository_Backend_FileSystem(FILES_DIR, TABLE_PREFIX));
    } else {
        FileRepository::setBackend(new FileRepository_Backend_DB(TABLE_PREFIX));
    }
    // if
    PublicFiles::setRepositoryPath(ROOT . '/public/files');
    if (trim(PUBLIC_FOLDER) == '') {
        PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . 'files');
    } else {
        PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . 'public/files');
    }
    // if
    // Owner company or administrator doen't exist? Let the user create them
} catch (OwnerCompanyDnxError $e) {
    Localization::instance()->loadSettings(DEFAULT_LOCALIZATION, ROOT . '/language');
    Env::executeAction('access', 'complete_installation');
} catch (AdministratorDnxError $e) {
    Localization::instance()->loadSettings(DEFAULT_LOCALIZATION, ROOT . '/language');
    Env::executeAction('access', 'complete_installation');
    // Other type of error? We need to break here
} catch (Exception $e) {
    Localization::instance()->loadSettings(DEFAULT_LOCALIZATION, ROOT . '/language');
    if (Env::isDebugging()) {
        Env::dumpError($e);
    } else {
コード例 #23
0
 function Draw($g, $returnGraphObject = false)
 {
     if (!isset($g)) {
         $g = $this->getGraph();
     }
     $g->set_bg_colour("#FFFFFF");
     $g->set_title($this->getTitle(), "font-size: 12px; color: #404040;font-weight:bold;padding-bottom:4px");
     $max = 0;
     $min = 0;
     $g->set_x_labels($this->data['values'][0]['labels']);
     $c = 0;
     $seriesCount = count($this->data['values']);
     foreach ($this->data['values'] as $series) {
         $max = max(array($max, max($series['values'])));
         $min = min(array($min, min($series['values'])));
         switch ($this->getDisplayId()) {
             case 10:
                 //Bar chart
                 $g->set_data($series['values']);
                 $g->bar(70, $this->getColour($c), $series['name'], $seriesCount > 1 ? 10 : -1);
                 break;
             case 11:
                 //Bar glass chart
                 $g->set_data($series[0]['values']);
                 $g->bar_glass(70, $this->getColour($c), '#505050', $series['name'], $seriesCount > 1 ? 10 : -1);
                 break;
             case 12:
                 //Bar 3d chart
                 $g->set_data($series['values']);
                 $g->bar_3D(70, $this->getColour($c), $series['name'], $seriesCount > 1 ? 10 : -1);
                 break;
             case 13:
                 // Bar sketch
                 $g->set_data($series['values']);
                 $g->bar_sketch(60, 9, $this->getColour($c), '#505050', $series['name'], $seriesCount > 1 ? 10 : -1);
                 break;
             case 20:
                 // Pie chart
                 $g->pie(60, '#505050', "font-size: 10px; color: #404040;");
                 $g->pie_slice_colours(array('#d01f3c', '#356aa0', '#C79810'));
                 $g->pie_values($series['values'], $series['labels']);
                 break;
             case 30:
                 // Line chart
                 $g->set_data($series['values']);
                 $g->line(3, $this->getColour($c), $series['name'], $seriesCount > 1 ? 10 : -1);
                 break;
         }
         $c++;
     }
     $g->set_y_min($min);
     $g->set_y_max($max);
     //echo with_slash(ROOT_URL) . "public/assets/flash/open-flash-chart.swf"; die();
     $g->set_swf_path(with_slash(ROOT_URL) . "public/assets/flash/");
     $g->set_js_path(with_slash(ROOT_URL) . "public/assets/javascript/og/swfobject.js");
     $g->set_output_type('js');
     $g->set_height(400);
     $g->set_width(600);
     if (isset($returnGraphObject) && $returnGraphObject) {
         return $g;
     } else {
         return $g->render();
     }
 }
コード例 #24
0
ファイル: functions.php プロジェクト: bklein01/Project-Pier
/**
 * Return an application URL
 * 
 * If $include_project_id variable is present active_project variable will be added to the list of params if we have a 
 * project selected (active_project() function returns valid project instance)
 *
 * @param string $controller_name
 * @param string $action_name
 * @param array $params
 * @param string $anchor
 * @param boolean $include_project_id
 * @return string
 */
function get_url($controller_name = null, $action_name = null, $params = null, $anchor = null, $include_project_id = true, $separator = '&amp;')
{
    //trace(__FILE__,"get_url($controller_name, $action_name, params?, $anchor, $include_project_id, $separator)");
    $controller = trim($controller_name) ? $controller_name : DEFAULT_CONTROLLER;
    $action = trim($action_name) ? $action_name : DEFAULT_ACTION;
    if (!is_array($params) && !is_null($params)) {
        $params = array('id' => $params);
    }
    // if
    $url_params = array('c=' . $controller, 'a=' . $action);
    if ($include_project_id) {
        if (function_exists('active_project') && active_project() instanceof Project) {
            if (!(is_array($params) && isset($params['active_project']))) {
                $url_params[] = 'active_project=' . active_project()->getId();
            }
            // if
        }
        // if
    }
    // if
    // defeat caches
    $url_params[] = time();
    if (isset($_REQUEST['trace'])) {
        $url_params[] = 'trace';
    }
    if (is_array($params)) {
        foreach ($params as $param_name => $param_value) {
            if (is_bool($param_value)) {
                $url_params[] = $param_name . '=1';
            } else {
                $url_params[] = $param_name . '=' . urlencode($param_value);
            }
            // if
        }
        // foreach
    }
    // if
    if (trim($anchor) != '') {
        $anchor = '#' . $anchor;
    }
    // if
    return with_slash(ROOT_URL) . 'index.php?' . implode($separator, $url_params) . $anchor;
}
 private function _cleanUpDirOld($file_id)
 {
     $path = $this->_idToPathOld($file_id);
     if (!$path) {
         return;
     }
     $path_parts = explode('/', $path);
     $repository_path = with_slash($this->getRepositoryDir());
     $for_cleaning = array($repository_path . $path_parts[0] . '/' . $path_parts[1] . '/' . $path_parts[2], $repository_path . $path_parts[0] . '/' . $path_parts[1], $repository_path . $path_parts[0]);
     // array
     foreach ($for_cleaning as $dir) {
         if (is_dir_empty($dir)) {
             delete_dir($dir);
         } else {
             return;
             // break, not empty
         }
         // if
     }
     // foreach
 }
コード例 #26
0
ファイル: functions.php プロジェクト: rjv/Project-Pier
 function get_available_themes() {
   $themes = array();
   $themes_dir = with_slash(THEMES_DIR);
   
   if (is_dir($themes_dir)) {
     $d = dir($themes_dir);
     while (($entry = $d->read()) !== false) {
       if (str_starts_with($entry, '.')) {
         continue;
       } // if
       
       if (is_dir($themes_dir . $entry)) {
         $theme = new SimpleXmlElement(file_get_contents($themes_dir . $entry.'/theme.xml'));
         $themes[$entry] = $theme->name;
       } // if
     } // while
     $d->close();
   } // if
   return $themes;
 }
コード例 #27
0
ファイル: iframe.php プロジェクト: abhinay100/feng_app
<?php

header('Content-type: text/html; charset=UTF-8', true);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<?php 
echo meta_tag('content-type', 'text/html; charset=utf-8', true);
$favicon_name = 'favicon.ico';
Hook::fire('change_favicon', null, $favicon_name);
echo add_favicon_to_page($favicon_name);
echo link_tag(with_slash(ROOT_URL) . $favicon_name, "rel", "shortcut icon");
?>
</head>
<body>
<script>
var data = <?php 
echo $content_for_layout;
?>
;
//alert(<?php 
echo json_encode($content_for_layout);
?>
);
parent.og.processResponse(data, <?php 
echo json_encode(array('caller' => array_var($_GET, 'current'), 'options' => array()));
?>
);
//alert(<?php 
echo json_encode($content_for_layout);
コード例 #28
0
                }
            }
            cw_flush(count($items) . "\n");
            if (!defined('IS_CRON')) {
                echo '<br />';
            }
        }
        unset($items, $r);
        $xml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
        $xml .= '<?xml-stylesheet type="text/xsl" href="' . $smarty->get_template_vars('SkinDir') . '/addons/sitemap_xml/style.xsl"?>' . "\n";
        $xml .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">' . "\n";
        $xml .= '//<![CDATA[#Generated by sitemap_xml generator by CartWorks software, http://www.cartworks.com //]]>' . "\n";
        fwrite($file, $xml);
        foreach ($data as $type => $list) {
            foreach ($list as $k => $v) {
                $xml = '<url><loc>' . with_slash($http_location) . $v . '</loc><lastmod>' . ($type == 'product' && !empty($lastmod[$k]) ? date('Y-m-d', $lastmod[$k]) : $today) . '</lastmod><changefreq>' . $config['sitemap_xml']['sm_frequency_' . $type] . '</changefreq><priority>' . $config['sitemap_xml']['sm_priority_' . $type] . '</priority></url>' . "\n";
                fwrite($file, $xml);
            }
        }
        fwrite($file, '</urlset>');
        fclose($file);
        if ($config['sitemap_xml']['sm_pack_result'] == 'Y') {
            @unlink($filename . '.gz');
            exec("gzip --suffix .gz {$filename}");
        }
        $index[] = $http_location . '/index.php?target=sitemap&amp;filename=' . $domain['name'];
    }
}
// foreach
// Create index
// http://www.google.com/support/webmasters/bin/answer.py?answer=71453
コード例 #29
0
 /**
  * Parses a directory for class/interface definitions. Saves found definitions
  * in $classIndex
  *
  * @access private
  * @param string $directory_path
  * @throws Exception
  * @return boolean Success
  */
 private function parseDir($directory_path)
 {
     $directory_path = with_slash($directory_path);
     if (in_array($directory_path, $this->parsed_directories)) {
         return;
     } else {
         $this->parsed_directories[] = $directory_path;
     }
     // if
     $dir = dir($directory_path);
     while (false !== ($entry = $dir->read())) {
         if ($entry == '.' || $entry == '..') {
             continue;
         }
         // if
         $path = $directory_path . $entry;
         if (is_dir($path)) {
             if ($this->getIgnoreHiddenFiles() && $entry[0] == '.') {
                 continue;
             }
             // if
             if (!is_readable($path)) {
                 continue;
             }
             // if
             $this->parseDir($path);
         } elseif (is_file($path)) {
             if (!is_readable($path)) {
                 continue;
             }
             // if
             if (str_ends_with($path, $this->getScanFileExtension())) {
                 $this->parseFile($path);
             }
             // if
         }
         // if
     }
     // if
     $dir->close();
 }
コード例 #30
0
 /**
  * Check if executable exists (if $path is provided system will check if executable exists in that folder, if not it will check system config option
  *
  * @param string $path
  * @return boolean
  */
 function executableExists($path = null)
 {
     $svn_path = '';
     if (!$path) {
         if (isset($this) && instance_of($this, 'RepositoryEngine')) {
             $svn_path = $this->executable_path;
         } else {
             $svn_path = ConfigOptions::getValue('source_svn_path');
         }
         // if
     } else {
         $svn_path = $path;
     }
     // if
     $svn_path = with_slash($svn_path);
     exec(escapeshellcmd($svn_path . 'svn ' . $this->config_dir . ' --version --quiet') . " " . $this->stderr2stdout, $output);
     $output = first($output);
     if ((bool) version_compare($output, '1.0.0', '>')) {
         return true;
     } else {
         return $output;
     }
     // if
 }